]> asedeno.scripts.mit.edu Git - git.git/log
git.git
15 years agogrep: add support for coloring with external greps
René Scharfe [Sat, 7 Mar 2009 12:34:46 +0000 (13:34 +0100)]
grep: add support for coloring with external greps

Add the config variable color.grep.external, which can be used to
switch on coloring of external greps.  To enable auto coloring with
GNU grep, one needs to set color.grep.external to --color=always to
defeat the pager started by git grep.  The value of the config
variable will be passed to the external grep only if it would
colorize internal grep's output, so automatic terminal detected
works.  The default is to not pass any option, because the external
grep command could be a program without color support.

Also set the environment variables GREP_COLOR and GREP_COLORS to
pass the configured color for matches to the external grep.  This
works with GNU grep; other variables could be added as needed.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: color patterns in output
René Scharfe [Sat, 7 Mar 2009 12:32:32 +0000 (13:32 +0100)]
grep: color patterns in output

Coloring matches makes them easier to spot in the output.

Add two options and two parameters: color.grep (to turn coloring on
or off), color.grep.match (to set the color of matches), --color
and --no-color (to turn coloring on or off, respectively).

The output of external greps is not changed.

This patch is based on earlier ones by Nguyễn Thái Ngọc Duy and
Thiago Alves.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: add pmatch and eflags arguments to match_one_pattern()
René Scharfe [Sat, 7 Mar 2009 12:30:27 +0000 (13:30 +0100)]
grep: add pmatch and eflags arguments to match_one_pattern()

Push pmatch and eflags to the callers of match_one_pattern(), which
allows them to specify regex execution flags and to get the location
of a match.

Since we only use the first element of the matches array and aren't
interested in submatches, no provision is made for callers to
provide a larger array.

eflags are ignored for fixed patterns, but that's OK, since they
only have a meaning in connection with regular expressions
containing ^ or $.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: remove grep_opt argument from match_expr_eval()
René Scharfe [Sat, 7 Mar 2009 12:28:40 +0000 (13:28 +0100)]
grep: remove grep_opt argument from match_expr_eval()

The only use of the struct grep_opt argument of match_expr_eval()
is to pass the option word_regexp to match_one_pattern().  By adding
a pattern flag for it we can reduce the number of function arguments
of these two functions, as a cleanup and preparation for adding more
in the next patch.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: micro-optimize hit collection for AND nodes
René Scharfe [Sat, 7 Mar 2009 12:27:15 +0000 (13:27 +0100)]
grep: micro-optimize hit collection for AND nodes

In addition to returning if an expression matches a line,
match_expr_eval() updates the expression's hit flag if the parameter
collect_hits is set.  It never sets collect_hits for children of AND
nodes, though, so their hit flag will never be updated.  Because of
that we can return early if the first child didn't match, no matter
if collect_hits is set or not.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodocument config --bool-or-int
Jeff King [Sat, 7 Mar 2009 17:14:06 +0000 (12:14 -0500)]
document config --bool-or-int

The documentation is just a pointer to the --bool and --int
options, but it makes sense to at least mention that it
exists.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot1300: use test_must_fail as appropriate
Jeff King [Sat, 7 Mar 2009 17:14:04 +0000 (12:14 -0500)]
t1300: use test_must_fail as appropriate

Some of the tests checked the exit code manually, even going
so far as to run git outside of the test_expect harness.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocleanup: add isascii()
René Scharfe [Sat, 7 Mar 2009 13:06:49 +0000 (14:06 +0100)]
cleanup: add isascii()

Add a standard definition of isascii() and use it to replace an open
coded high-bit test in pretty.c.  While we're there, write the ESC
char as the more commonly used '\033' instead of as 0x1b to enhance
its grepability.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: fix badly indented paragraphs in "--bisect-all" description
Christian Couder [Sat, 7 Mar 2009 12:37:24 +0000 (13:37 +0100)]
Documentation: fix badly indented paragraphs in "--bisect-all" description

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate draft release notes to 1.6.3
Junio C Hamano [Fri, 6 Mar 2009 09:37:22 +0000 (01:37 -0800)]
Update draft release notes to 1.6.3

15 years agoMake git blame's date output format configurable, like git log
Eugene Letuchy [Fri, 20 Feb 2009 22:51:11 +0000 (14:51 -0800)]
Make git blame's date output format configurable, like git log

Add the following:

 - git config value blame.date that expects one of the git log date
   formats (e.g. relative,local,default,iso,...);

 - git blame command line option --date expects one of the git
   log date formats;

 - documentation in blame-options.txt;

 - git blame uses the appropriate date.c functions and enums to
   make sense of the date format and provide appropriate data;

git blame continues to line up the output columns by padding the date
column up to the max width of the chosen date format.

The date format for git blame without both blame.date and --date continues
to be ISO for backwards compatibility.

git annotate ignores the date format specifiers and continues to uses the
ISO format, as before.

Signed-off-by: Eugene Letuchy <eugene@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'en/maint-hash-object'
Junio C Hamano [Thu, 5 Mar 2009 23:58:42 +0000 (15:58 -0800)]
Merge branch 'en/maint-hash-object'

* en/maint-hash-object:
  Ensure proper setup of git_dir for git-hash-object

Conflicts:
hash-object.c

15 years agoMerge branch 'jc/blame'
Junio C Hamano [Thu, 5 Mar 2009 23:41:43 +0000 (15:41 -0800)]
Merge branch 'jc/blame'

* jc/blame:
  blame: show "previous" information in --porcelain/--incremental format
  git-blame: refactor code to emit "porcelain format" output

15 years agoMerge branch 'ns/pretty-format'
Junio C Hamano [Thu, 5 Mar 2009 23:41:43 +0000 (15:41 -0800)]
Merge branch 'ns/pretty-format'

* ns/pretty-format:
  bash completion: add --format= and --oneline options for "git log"
  Add tests for git log --pretty, --format and --oneline.
  Add --oneline that is a synonym to "--pretty=oneline --abbrev-commit"
  Give short-hands to --pretty=tformat:%formatstring
  Add --format that is a synonym to --pretty

15 years agoMerge branch 'jk/sane-relative-time'
Junio C Hamano [Thu, 5 Mar 2009 23:41:43 +0000 (15:41 -0800)]
Merge branch 'jk/sane-relative-time'

* jk/sane-relative-time:
  never fallback relative times to absolute

15 years agoMerge branch 'fc/config-editor'
Junio C Hamano [Thu, 5 Mar 2009 23:41:42 +0000 (15:41 -0800)]
Merge branch 'fc/config-editor'

* fc/config-editor:
  git config: trivial cleanup for editor action
  git config: codestyle cleanups
  config: Add new option to open an editor.

15 years agoMerge branch 'js/send-email'
Junio C Hamano [Thu, 5 Mar 2009 23:41:42 +0000 (15:41 -0800)]
Merge branch 'js/send-email'

* js/send-email:
  send-email: add --confirm option and configuration setting
  send-email: don't create temporary compose file until it is needed
  send-email: --suppress-cc improvements
  send-email: handle multiple Cc addresses when reading mbox message
  send-email: allow send-email to run outside a repo

15 years agoMerge branch 'sg/rerere-cleanup'
Junio C Hamano [Thu, 5 Mar 2009 23:41:42 +0000 (15:41 -0800)]
Merge branch 'sg/rerere-cleanup'

* sg/rerere-cleanup:
  rerere: remove duplicated functions

15 years agoMerge branch 'jc/add-p-unquote'
Junio C Hamano [Thu, 5 Mar 2009 23:41:41 +0000 (15:41 -0800)]
Merge branch 'jc/add-p-unquote'

* jc/add-p-unquote:
  git-add -i/-p: learn to unwrap C-quoted paths

15 years agoMerge branch 'jw/imap-preformatted-html'
Junio C Hamano [Thu, 5 Mar 2009 23:41:41 +0000 (15:41 -0800)]
Merge branch 'jw/imap-preformatted-html'

* jw/imap-preformatted-html:
  imap.preformattedHTML to tell Thunderbird to send non-flowed text

15 years agoMerge branch 'jw/format-patch-attach'
Junio C Hamano [Thu, 5 Mar 2009 23:41:41 +0000 (15:41 -0800)]
Merge branch 'jw/format-patch-attach'

* jw/format-patch-attach:
  Enable setting attach as the default in .gitconfig for git-format-patch.

15 years agoMerge branch 'sr/force-rebase'
Junio C Hamano [Thu, 5 Mar 2009 23:41:40 +0000 (15:41 -0800)]
Merge branch 'sr/force-rebase'

* sr/force-rebase:
  Teach rebase to rebase even if upstream is up to date

15 years agoMerge branch 'fg/exclude-bq'
Junio C Hamano [Thu, 5 Mar 2009 23:41:39 +0000 (15:41 -0800)]
Merge branch 'fg/exclude-bq'

* fg/exclude-bq:
  Support "\" in non-wildcard exclusion entries

15 years agoMerge branch 'dm/add-i-edit-abort'
Junio C Hamano [Thu, 5 Mar 2009 23:41:39 +0000 (15:41 -0800)]
Merge branch 'dm/add-i-edit-abort'

* dm/add-i-edit-abort:
  add -i: revisit hunk on editor failure

15 years agoMerge branch 'tp/completion'
Junio C Hamano [Thu, 5 Mar 2009 23:41:39 +0000 (15:41 -0800)]
Merge branch 'tp/completion'

* tp/completion:
  Fixup: Add bare repository indicator for __git_ps1
  Add bare repository indicator for __git_ps1
  completion: More fixes to prevent unbound variable errors
  completion: Better __git_ps1 support when not in working directory
  completion: Use consistent if [...] convention, not "test"
  completion: For consistency, change "git rev-parse" to __gitdir calls

15 years agoMerge branch 'js/branch-symref'
Junio C Hamano [Thu, 5 Mar 2009 23:41:35 +0000 (15:41 -0800)]
Merge branch 'js/branch-symref'

* js/branch-symref:
  add basic branch display tests
  branch: clean up repeated strlen
  Avoid segfault with 'git branch' when the HEAD is detached
  builtin-branch: improve output when displaying remote branches

Conflicts:
builtin-branch.c

15 years agoMerge branch 'al/ansi-color'
Junio C Hamano [Thu, 5 Mar 2009 23:41:19 +0000 (15:41 -0800)]
Merge branch 'al/ansi-color'

* al/ansi-color:
  builtin-branch.c: Rename branch category color names
  Clean up use of ANSI color sequences

15 years agoMerge branch 'js/valgrind'
Junio C Hamano [Thu, 5 Mar 2009 23:41:18 +0000 (15:41 -0800)]
Merge branch 'js/valgrind'

* js/valgrind:
  valgrind: do not require valgrind 3.4.0 or newer
  test-lib: avoid assuming that templates/ are in the GIT_EXEC_PATH
  Tests: let --valgrind imply --verbose and --tee
  Add a script to coalesce the valgrind outputs
  t/Makefile: provide a 'valgrind' target
  test-lib.sh: optionally output to test-results/$TEST.out, too
  Valgrind support: check for more than just programming errors
  valgrind: ignore ldso and more libz errors
  Add valgrind support in test scripts

15 years agoMinGW: 64-bit file offsets
Johannes Schindelin [Thu, 5 Mar 2009 16:05:12 +0000 (17:05 +0100)]
MinGW: 64-bit file offsets

The type 'off_t' should be used everywhere so that the bit-depth of that
type can be adjusted in the standard C library, and you just need to
recompile your program to benefit from the extended precision.

Only that it was not done that way in the MS runtime library.

This patch reroutes off_t to off64_t and provides the other necessary
changes so that finally, clones larger than 2 gigabyte work on Windows
(provided you are on a file system that allows files larger than 2gb).

Initial patch by Sickboy <sb@dev-heaven.net>.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation - More examples for git bisect
John Tapsell [Thu, 5 Mar 2009 12:36:14 +0000 (12:36 +0000)]
Documentation - More examples for git bisect

Including passing parameters to the programs, and running more
complicated checks without requiring a seperate shell script.

Signed-off-by: John Tapsell <johnflux@gmail.com>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDraft release notes: Carry forward the warning for behaviour changes
Junio C Hamano [Thu, 5 Mar 2009 22:50:00 +0000 (14:50 -0800)]
Draft release notes: Carry forward the warning for behaviour changes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Thu, 5 Mar 2009 07:43:23 +0000 (23:43 -0800)]
Merge branch 'maint'

* maint:
  Make the 'lock file' exists error more informative

15 years agoimprove missing repository error message
Jeff King [Wed, 4 Mar 2009 08:32:29 +0000 (03:32 -0500)]
improve missing repository error message

Certain remote commands, when asked to do something in a
particular directory that was not actually a git repository,
would say "unable to chdir or not a git archive". The
"chdir" bit is an unnecessary detail, and the term "git
archive" is much less common these days than "git repository".

So let's switch them all to:

  fatal: '%s' does not appear to be a git repository

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMake the 'lock file' exists error more informative
John Tapsell [Wed, 4 Mar 2009 15:00:44 +0000 (15:00 +0000)]
Make the 'lock file' exists error more informative

It looks like someone did 90% of the work, then forgot to actually use
the function in one place.

Also the helper function did not use the correct variable.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-archive: add --output=<file> to send output to a file
Carlos Manuel Duclos Vergara [Mon, 16 Feb 2009 17:20:25 +0000 (18:20 +0100)]
git-archive: add --output=<file> to send output to a file

When archiving a repository there is no way to specify a file as output.
This patch adds a new option "--output" that redirects the output to a
file instead of stdout.

Signed-off-by: Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoImprove error message for git-filter-branch
John Tapsell [Thu, 19 Feb 2009 07:36:35 +0000 (07:36 +0000)]
Improve error message for git-filter-branch

Tell the user that a backup (original) already exists, and how to solve
this problem (with -f option)

Signed-off-by: John Tapsell <johnflux@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGoogle has renamed the imap folder
John Tapsell [Thu, 19 Feb 2009 07:36:11 +0000 (07:36 +0000)]
Google has renamed the imap folder

Also add a comment that the web interface wraps the lines

Signed-off-by: John Tapsell <johnflux@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoModify description file to say what this file is
John Tapsell [Thu, 19 Feb 2009 07:36:00 +0000 (07:36 +0000)]
Modify description file to say what this file is

A lot of people see this message for the first time on the gitweb
interface, where there is no clue as to what 'this file' means.

Signed-off-by: John Tapsell <johnflux@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorev-list: estimate number of bisection step left
Christian Couder [Sat, 21 Feb 2009 08:26:01 +0000 (09:26 +0100)]
rev-list: estimate number of bisection step left

This patch teaches "git rev-list --bisect-vars" to output an estimate
of the number of bisection step left _after the current one_ along with
the other variables it already outputs.

This patch also makes "git-bisect.sh" display this number of steps left
_after the current one_, along with the estimate of the number of
revisions left to test (after the current one).

Here is a table to help analyse what should be the best estimate for
the number of bisect steps left.

N : linear case                    --> probabilities --> best
-------------------------------------------------------------
1 : G-B                            --> 0             --> 0
2 : G-U1-B                         --> 0             --> 0
3 : G-U1-U2-B                      --> 0(1/3) 1(2/3) --> 1
4 : G-U1-U2-U3-B                   --> 1             --> 1
5 : G-U1-U2-U3-U4-B                --> 1(3/5) 2(2/5) --> 1
6 : G-U1-U2-U3-U4-U5-B             --> 1(2/6) 2(4/6) --> 2
7 : G-U1-U2-U3-U4-U5-U6-B          --> 1(1/7) 2(6/7) --> 2
8 : G-U1-U2-U3-U4-U5-U6-U7-B       --> 2             --> 2
9 : G-U1-U2-U3-U4-U5-U6-U7-U8-B    --> 2(7/9) 3(2/9) --> 2
10: G-U1-U2-U3-U4-U5-U6-U7-U8-U9-B --> 2(6/10)3(4/10)--> 2

In the column "N", there is the number of revisions that could _now_
be the first bad commit we are looking for.

The "linear case" column describes the linear history corresponding to
the number in column N. G means good, B means bad, and Ux means
unknown. Note that the first bad revision we are looking for can be
any Ux or B.

In the "probabilities" column, there are the different outcomes in
number of steps with the odds of each outcome in parenthesis
corresponding to the linear case.

The "best" column gives the most accurate estimate among the different
outcomes in the "probabilities" column.

We have the following:

best(2^n) == n - 1

and for any x between 0 included and 2^n excluded, the probability for
n - 1 steps left looks like:

P(2^n + x) == (2^n - x) / (2^n + x)

and P(2^n + x) < 0.5 means 2^n < 3x

So the algorithm used in this patch calculates 2^n and x, and then
choose between returning n - 1 and n.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix neglect of diff_setup()/diff_setup_done() symmetry.
Keith Cascio [Tue, 17 Feb 2009 02:59:00 +0000 (18:59 -0800)]
Fix neglect of diff_setup()/diff_setup_done() symmetry.

Code that calls diff_setup(), including via init_revisions(), should later call
diff_setup_done(), possibly via setup_revisions(). Failure to do so could cause
errors, especially in the future when we add responsibilities to
diff_setup_done(). This instance causes no known errors with the present code.
But it resulted in an error with an experimental patch.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUse DIFF_XDL_SET/DIFF_OPT_SET instead of raw bit-masking
Keith Cascio [Tue, 17 Feb 2009 03:26:49 +0000 (19:26 -0800)]
Use DIFF_XDL_SET/DIFF_OPT_SET instead of raw bit-masking

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoBeginning of 1.6.3 development track
Junio C Hamano [Wed, 4 Mar 2009 08:41:01 +0000 (00:41 -0800)]
Beginning of 1.6.3 development track

15 years agoBeginning of 1.6.2 maintenance track
Junio C Hamano [Wed, 4 Mar 2009 08:37:50 +0000 (00:37 -0800)]
Beginning of 1.6.2 maintenance track

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2 v1.6.2
Junio C Hamano [Wed, 4 Mar 2009 07:02:16 +0000 (23:02 -0800)]
GIT 1.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit submodule: Fix adding of submodules at paths with ./, .. and //
Michael J Gruber [Tue, 3 Mar 2009 15:08:21 +0000 (16:08 +0100)]
git submodule: Fix adding of submodules at paths with ./, .. and //

Make 'git submodule add' normalize the submodule path in the
same way as 'git ls-files' does, so that 'git submodule init' looks up
the information in .gitmodules with the same key under which 'git
submodule add' stores it.

This fixes 4 known breakages.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit submodule: Add test cases for git submodule add
Michael J Gruber [Tue, 3 Mar 2009 15:08:20 +0000 (16:08 +0100)]
git submodule: Add test cases for git submodule add

Add simple test cases for adding and initialising submodules. The
init step is necessary in order to verify the added information.

The second test exposes a known breakage due to './' in the path: git
ls-files simplifies the path but git add does not, which leads to git
init looking for different lines in .gitmodules than git add adds.

The other tests add test cases for '//' and '..' in the path which
currently fail for the same reason.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: Typo / spelling / formatting fixes
Mike Ralphson [Tue, 3 Mar 2009 19:29:22 +0000 (19:29 +0000)]
Documentation: Typo / spelling / formatting fixes

Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: Expand a couple of abbreviations
Mike Ralphson [Tue, 3 Mar 2009 19:29:21 +0000 (19:29 +0000)]
Documentation: Expand a couple of abbreviations

These may not be obvious to non-native English speakers

Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: Typos / spelling fixes in RelNotes
Mike Ralphson [Tue, 3 Mar 2009 19:29:20 +0000 (19:29 +0000)]
Documentation: Typos / spelling fixes in RelNotes

Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/git-archive.txt: Note attributes
Roy Lee [Tue, 3 Mar 2009 16:49:29 +0000 (00:49 +0800)]
Documentation/git-archive.txt: Note attributes

Signed-off-by: Roy Lee <roylee17@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoclone: run post-checkout hook when checking out
Jeff King [Tue, 3 Mar 2009 05:37:51 +0000 (00:37 -0500)]
clone: run post-checkout hook when checking out

The mental model for clone is that the branch is "checked
out" (and it even says this in Documentation/git-clone.txt:
"...creates and checks out an initial branch"). Therefore it
is reasonable for users to expect that any post-checkout
hook would be run.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: add --confirm option and configuration setting
Jay Soffian [Tue, 3 Mar 2009 04:52:18 +0000 (23:52 -0500)]
send-email: add --confirm option and configuration setting

send-email violates the principle of least surprise by automatically
cc'ing additional recipients without confirming this with the user.

This patch teaches send-email a --confirm option. It takes the
following values:

 --confirm=always   always confirm before sending
 --confirm=never    never confirm before sending
 --confirm=cc       confirm before sending when send-email has
                    automatically added addresses from the patch to
                    the Cc list
 --confirm=compose  confirm before sending the first message when
                    using --compose. (Needed to maintain backwards
                    compatibility with existing behavior.)
 --confirm=auto     'cc' + 'compose'

If sendemail.confirm is unconfigured, the option defaults to 'compose'
if any suppress-Cc related options have been used, otherwise it defaults
to 'auto'.

Unfortunately, it is impossible to introduce this patch such that it
helps new users without potentially annoying some existing users. We
attempt to mitigate the latter by:

 * Allowing the user to set 'git config sendemail.confirm never'
 * Allowing the user to say 'all' after the first prompt to not be
   prompted on remaining emails during the same invocation.
 * Telling the user about the 'sendemail.confirm' setting if it is
   unconfigured whenever we prompt due to Cc before sending.
 * Only prompting if no --suppress related options have been passed, as
   using such an option is likely to indicate an experienced send-email
   user.

There is a slight fib in message informing the user of the
sendemail.confirm setting and this is intentional. Setting 'auto'
differs from leaving sendemail.confirm unset in two ways: 1) 'auto'
obviously squelches the informational message; 2) 'auto' prompts when
the Cc list has been expanded even in the presence of a --suppress
related option, where leaving sendemail.confirm unset does not. This is
intentional to keep the message simple, and to avoid adding another
sendemail.confirm value ('auto-except-suppress'?).

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-pull: Allow --stat and --no-stat to be used with --rebase
Tor Arne Vestbø [Sun, 1 Mar 2009 21:28:28 +0000 (22:28 +0100)]
git-pull: Allow --stat and --no-stat to be used with --rebase

Forwards the --stat, --no-stat, and --summary options on to git-rebase.

Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-rebase: Add --stat and --no-stat for producing diffstat on rebase
Tor Arne Vestbø [Sun, 1 Mar 2009 22:11:38 +0000 (23:11 +0100)]
git-rebase: Add --stat and --no-stat for producing diffstat on rebase

The behavior of --verbose is unchanged, but uses a different state
variable internally, so that the meaning of verbose output may be
expanded without affecting the diffstat. This is also reflected in
the documentation.

The configuration option rebase.stat works the same was as merg.stat,
but the default is currently false.

Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: respect in-reply-to regardless of threading
Thomas Rast [Sun, 1 Mar 2009 22:45:41 +0000 (23:45 +0100)]
send-email: respect in-reply-to regardless of threading

git-send-email supports the --in-reply-to option even with
--no-thread.  However, the code that adds the relevant mail headers
was guarded by a test for --thread.

Remove the test, so that the user's choice is respected.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agooptimize compat/ memmem()
René Scharfe [Mon, 2 Mar 2009 23:19:30 +0000 (00:19 +0100)]
optimize compat/ memmem()

When memmem() was imported from glibc 2.2 into compat/, an optimization
was dropped in the process, in order to make the code smaller and simpler.
It was OK because memmem() wasn't used in performance-critical code.  Now
the situation has changed and we can benefit from this optimization.

The trick is to avoid calling memcmp() if the first character of the needle
already doesn't match.  Checking one character directly is much cheaper
than the function call overhead.  We keep the first character of the needle
in the variable named point and the rest in the one named tail.

The following commands were run in a Linux kernel repository and timed, the
best of five results is shown:

  $ STRING='Ensure that the real time constraints are schedulable.'
  $ git log -S"$STRING" HEAD -- kernel/sched.c >/dev/null

On Windows Vista x64, before:

  real    0m8.470s
  user    0m0.000s
  sys     0m0.000s

And after the patch:

  real    0m1.887s
  user    0m0.000s
  sys     0m0.000s

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiffcore-pickaxe: use memmem()
René Scharfe [Mon, 2 Mar 2009 23:00:55 +0000 (00:00 +0100)]
diffcore-pickaxe: use memmem()

Use memmem() instead of open-coding it.  The system libraries usually have a
much faster version than the memcmp()-loop here.  Even our own fall-back in
compat/, which is used on Windows, is slightly faster.

The following commands were run in a Linux kernel repository and timed, the
best of five results is shown:

  $ STRING='Ensure that the real time constraints are schedulable.'
  $ git log -S"$STRING" HEAD -- kernel/sched.c >/dev/null

On Ubuntu 8.10 x64, before (v1.6.2-rc2):

  8.09user 0.04system 0:08.14elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
  0inputs+0outputs (0major+30952minor)pagefaults 0swaps

And with the patch:

  1.50user 0.04system 0:01.54elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
  0inputs+0outputs (0major+30645minor)pagefaults 0swaps

On Fedora 10 x64, before:

  8.34user 0.05system 0:08.39elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
  0inputs+0outputs (0major+29268minor)pagefaults 0swaps

And with the patch:

  1.15user 0.05system 0:01.20elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
  0inputs+0outputs (0major+32253minor)pagefaults 0swaps

On Windows Vista x64, before:

  real    0m9.204s
  user    0m0.000s
  sys     0m0.000s

And with the patch:

  real    0m8.470s
  user    0m0.000s
  sys     0m0.000s

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: minor grammatical fixes.
David J. Mellor [Mon, 2 Mar 2009 06:42:44 +0000 (22:42 -0800)]
Documentation: minor grammatical fixes.

The final hunk in this patch corrects what appears to be a typo:

of --> or

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: minor grammatical fixes.
David J. Mellor [Mon, 2 Mar 2009 06:38:36 +0000 (22:38 -0800)]
Documentation: minor grammatical fixes.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: minor grammatical fixes.
David J. Mellor [Mon, 2 Mar 2009 06:37:41 +0000 (22:37 -0800)]
Documentation: minor grammatical fixes.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot3400-rebase: Move detached HEAD check earlier
Johannes Sixt [Sun, 1 Mar 2009 10:20:03 +0000 (11:20 +0100)]
t3400-rebase: Move detached HEAD check earlier

Short story: There is a section in t3400 that tests fundamental rebase
properties.  3ec7371f (Add two extra tests for git rebase, 2009-02-09)
added a check that rebase works on a detached HEAD, but the test was put
near the end of the file.  This moves it to a more suitable place.

Long story: The test that preceded the one in question tests that a
rebased commit degrades from a content change with mode change to a
mere mode change.  But on Windows, where we have core.filemode=false,
the original commit did not record the mode change, and so the rebase
operation did not rebase anything.  This caused the subsequent detached
HEAD test to fail.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Mon, 2 Mar 2009 06:20:52 +0000 (22:20 -0800)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Fix possible infinite loop and display corruption

15 years agogitk: Fix possible infinite loop and display corruption
Paul Mackerras [Sun, 1 Mar 2009 22:38:17 +0000 (09:38 +1100)]
gitk: Fix possible infinite loop and display corruption

This fixes an issue reported by Johannes Sixt on the git mailing list:

> This recipe sends gitk into an endless loop. In git.git do:
>
> cd t
> # remove chmod a+x A near the end of the file
> sed -i 's/chmod/: chmod/' t3400-rebase.sh
> sh t3400-rebase.sh --debug
> cd trash\ directory.t3400-rebase/
> gitk master modechange modechange@{1}
>
>
> I briefly see the history chart, but the dot that should be modechange@{1}
> is missing. One automatically selected commit is shown in the diff section
> below. But then the commit list is cleared and gitk goes into an infinite
> loop.
>
> Things work alright if either modechange@{1} is dropped, or the 'chmod'
> line is left unchanged, which is a bit strange.
>
> This is with git version 1.6.1.2.390.gba743

There were actually two problems.  This recipe created a situation where
git log would output a child commit after its parent.  This meant that
we called fix_reversal which called splitvarc, which should call modify_arc
to note the fact that it has modified the arc that it has just split.  It
wasn't, which meant that displayorder and other variables got into an
inconsistent state (a commit appearing twice in displayorder).

This then meant that the targetrow/targetid logic in drawvisible thought
it need to redraw each time.  That, together with the fact that drawvisible
called drawcommits which called drawvisible if a redraw was needed, led
to the infinite loop.

In fact drawvisible is now the only caller of drawcommits.  Thus, the
start and end row arguments to drawcommits always encompass the whole
visible area, so drawcommits doesn't need to call drawvisible to redraw;
it just needs to clear the screen and draw what it's been asked to.

This fixes these two problems by adding a call to modify_arc in
splitvarc and by taking out the call to drawvisible in drawcommits.
It also removes an unrelated left-over debugging puts in external_blame.

Signed-off-by: Paul Mackerras <paulus@samba.org>
15 years agoMerge branch 'jc/maint-1.6.0-pack-directory'
Junio C Hamano [Sun, 1 Mar 2009 00:31:02 +0000 (16:31 -0800)]
Merge branch 'jc/maint-1.6.0-pack-directory'

* jc/maint-1.6.0-pack-directory:
  Fix odb_mkstemp() on AIX

15 years agoMerge branch 'maint'
Junio C Hamano [Sat, 28 Feb 2009 22:39:56 +0000 (14:39 -0800)]
Merge branch 'maint'

* maint:
  Documentation: minor grammatical fixes.
  added missing backtick in git-apply.txt

15 years agoDocumentation: minor grammatical fixes.
David J. Mellor [Sat, 28 Feb 2009 21:12:59 +0000 (13:12 -0800)]
Documentation: minor grammatical fixes.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoEnsure proper setup of git_dir for git-hash-object
Elijah Newren [Sat, 28 Feb 2009 19:56:49 +0000 (12:56 -0700)]
Ensure proper setup of git_dir for git-hash-object

Call setup_git_directory() before git_config() to make sure git_dir is set
to the proper value.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Sat, 28 Feb 2009 22:05:09 +0000 (14:05 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  added missing backtick in git-apply.txt

15 years agoadded missing backtick in git-apply.txt
Danijel Tasov [Sat, 28 Feb 2009 20:03:54 +0000 (21:03 +0100)]
added missing backtick in git-apply.txt

Signed-off-by: Danijel Tasov <dt@korn.shell.la>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-rebase: Update --whitespace documentation
Todd Zullinger [Sat, 28 Feb 2009 18:42:02 +0000 (13:42 -0500)]
git-rebase: Update --whitespace documentation

The parameters accepted by the --whitespace option of "git apply" have
changed over time, and the documentation for "git rebase" was out of
sync.  Remove the specific parameter list from the "git rebase"
documentation and simply point to the "git apply" documentation for
details, as is already done in the "git am" documentation.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agois_kept_pack(): final clean-up
Junio C Hamano [Sat, 28 Feb 2009 08:37:19 +0000 (00:37 -0800)]
is_kept_pack(): final clean-up

Now is_kept_pack() is just a member lookup into a structure, we can write
it as such.

Also rewrite the sole caller of has_sha1_kept_pack() to switch on the
criteria the callee uses (namely, revs->kept_pack_only) between calling
has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not
have to take a pointer to struct rev_info as an argument.

This removes the header file dependency issue temporarily introduced by
the earlier commit, so we revert changes associated to that as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSimplify is_kept_pack()
Junio C Hamano [Sat, 28 Feb 2009 08:00:21 +0000 (00:00 -0800)]
Simplify is_kept_pack()

This removes --unpacked=<packfile> parameter from the revision parser, and
rewrites its use in git-repack to pass a single --kept-pack-only option
instead.

The new --kept-pack-only option means just that.  When this option is
given, is_kept_pack() that used to say "not on the --unpacked=<packfile>
list" now says "the packfile has corresponding .keep file".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoConsolidate ignore_packed logic more
Junio C Hamano [Sat, 28 Feb 2009 07:43:37 +0000 (23:43 -0800)]
Consolidate ignore_packed logic more

This refactors three loops that check if a given packfile is on the
ignore_packed list into a function is_kept_pack().  The function returns
false for a pack on the list, and true for a pack not on the list, because
this list is solely used by "git repack" to pass list of packfiles that do
not have corresponding .keep files, i.e. a packfile not on the list is
"kept".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohas_sha1_kept_pack(): take "struct rev_info"
Junio C Hamano [Sat, 28 Feb 2009 07:30:38 +0000 (23:30 -0800)]
has_sha1_kept_pack(): take "struct rev_info"

Its "ignore_packed" parameter always comes from struct rev_info.  This
patch makes the function take a pointer to the surrounding structure, so
that the refactoring in the next patch becomes easier to review.

There is an unfortunate header file dependency and the easiest workaround
is to temporarily move the function declaration from cache.h to
revision.h; this will be moved back to cache.h once the function loses
this "ignore_packed" parameter altogether in the later part of the
series.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohas_sha1_pack(): refactor "pretend these packs do not exist" interface
Junio C Hamano [Sat, 28 Feb 2009 07:15:53 +0000 (23:15 -0800)]
has_sha1_pack(): refactor "pretend these packs do not exist" interface

Most of the callers of this function except only one pass NULL to its last
parameter, ignore_packed.

Introduce has_sha1_kept_pack() function that has the function signature
and the semantics of this function, and convert the sole caller that does
not pass NULL to call this new function.

All other callers and has_sha1_pack() lose the ignore_packed parameter.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-repack: resist stray environment variable
Junio C Hamano [Sat, 28 Feb 2009 07:58:50 +0000 (23:58 -0800)]
git-repack: resist stray environment variable

The script used $args and $existing without initializing it to empty.  It
would have been confused by an environment variable the end user had
before running it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn - return original format_svn_date semantics
Ben Walton [Sat, 28 Feb 2009 03:11:45 +0000 (22:11 -0500)]
git-svn - return original format_svn_date semantics

When %z was removed from the strftime call and subsituted with a
local gmt offset calculation, time() was no longer the default for
all time functions as it was with the previous localtime(shift).
This is now corrected so that format_svn_time behaves as it used to.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: disable broken symlink workaround by default
Eric Wong [Sat, 28 Feb 2009 03:40:16 +0000 (19:40 -0800)]
git-svn: disable broken symlink workaround by default

Even though this will break things for some extremely rare repositories
used by broken Windows clients, it's probably not worth enabling this by
default as it has negatively affected many more users than it has helped
from what we've seen so far.

The extremely rare repositories that have broken symlinks in them will be
silently corrupted in import; but users can still reenable this option and
restart the import.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'cc/maint-1.6.0-bisect-fix'
Junio C Hamano [Sat, 28 Feb 2009 00:00:33 +0000 (16:00 -0800)]
Merge branch 'cc/maint-1.6.0-bisect-fix'

* cc/maint-1.6.0-bisect-fix:
  bisect: fix another instance of eval'ed string

Conflicts:
git-bisect.sh

15 years agobuiltin-remote: new show output style for push refspecs
Jay Soffian [Wed, 25 Feb 2009 08:32:28 +0000 (03:32 -0500)]
builtin-remote: new show output style for push refspecs

The existing output of "git remote show <remote>" with respect to push
ref specs is basically just to show the raw refspec. This patch teaches
the command to interpret the refspecs and show how each branch will be
pushed to the destination. The output gives the user an idea of what
"git push" should do if it is run w/o any arguments.

Example new output:

1a. Typical output with no push refspec (i.e. matching branches only)

$ git remote show origin
* remote origin
  [...]
  Local refs configured for 'git push':
    master pushes to master (up to date)
    next   pushes to next   (local out of date)

1b. Same as above, w/o querying the remote:

$ git remote show origin -n
* remote origin
  [...]
  Local ref configured for 'git push' (status not queried):
    (matching) pushes to (matching)

2a. With a forcing refspec (+), and a new topic
    (something like push = refs/heads/*:refs/heads/*):

$ git remote show origin
* remote origin
  [...]
  Local refs configured for 'git push':
    master     pushes to master    (fast forwardable)
    new-topic  pushes to new-topic (create)
    next       pushes to next      (local out of date)
    pu         forces to pu        (up to date)

2b. Same as above, w/o querying the remote

$ git remote show origin -n
* remote origin
  [...]
  Local refs configured for 'git push' (status not queried):
    master     pushes to master
    new-topic  pushes to new-topic
    next       pushes to next
    pu         forces to pu

3. With a remote configured as a mirror:

* remote backup
  [...]
  Local refs will be mirrored by 'git push'

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: new show output style
Jay Soffian [Wed, 25 Feb 2009 08:32:27 +0000 (03:32 -0500)]
builtin-remote: new show output style

The existing output of "git remote show <remote>" is too verbose for the
information it provides. This patch teaches it to provide more
information in less space.

The output for push refspecs is addressed in the next patch.

Before the patch:

$ git remote show origin
* remote origin
  URL: git://git.kernel.org/pub/scm/git/git.git
  HEAD branch: master
  Remote branch merged with 'git pull' while on branch master
    master
  Remote branch merged with 'git pull' while on branch next
    next
  Remote branches merged with 'git pull' while on branch octopus
    foo bar baz frotz
  New remote branch (next fetch will store in remotes/origin)
    html
  Stale tracking branch (use 'git remote prune')
    bogus
  Tracked remote branches
    maint
    man
    master
    next
    pu
    todo

After this patch:

$ git remote show origin
* remote origin
  URL: git://git.kernel.org/pub/scm/git/git.git
  HEAD branch: master
  Remote branches:
    bogus  stale (use 'git remote prune' to remove)
    html   new (next fetch will store in remotes/origin)
    maint  tracked
    man    tracked
    master tracked
    next   tracked
    pu     tracked
    todo   tracked
  Local branches configured for 'git pull':
    master  rebases onto remote master
    next    rebases onto remote next
    octopus  merges with remote foo
                and with remote bar
                and with remote baz
                and with remote frotz

$ git remote show origin -n
* remote origin
  URL: git://git.kernel.org/pub/scm/git/git.git
  HEAD branch: (not queried)
  Remote branches: (status not queried)
    bogus
    maint
    man
    master
    next
    pu
    todo
  Local branches configured for 'git pull':
    master  rebases onto remote master
    next    rebases onto remote next
    octopus  merges with remote foo
                and with remote bar
                and with remote baz
                and with remote frotz

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: make guess_remote_head() use exact HEAD lookup if it is available
Jeff King [Fri, 27 Feb 2009 19:10:06 +0000 (14:10 -0500)]
remote: make guess_remote_head() use exact HEAD lookup if it is available

Our usual method for determining the ref pointed to by HEAD
is to compare HEAD's sha1 to the sha1 of all refs, trying to
find a unique match.

However, some transports actually get to look at HEAD
directly; we should make use of that information when it is
available.  Currently, only http remotes support this
feature.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: add set-head subcommand
Jay Soffian [Wed, 25 Feb 2009 08:32:25 +0000 (03:32 -0500)]
builtin-remote: add set-head subcommand

Provide a porcelain command for setting and deleting
$GIT_DIR/remotes/<remote>/HEAD.

While we're at it, document what $GIT_DIR/remotes/<remote>/HEAD is all
about.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: teach show to display remote HEAD
Jay Soffian [Wed, 25 Feb 2009 08:32:24 +0000 (03:32 -0500)]
builtin-remote: teach show to display remote HEAD

This is in preparation for teaching remote how to set
refs/remotes/<remote>/HEAD to match what HEAD is set to at <remote>, but
is useful in its own right.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: fix two inconsistencies in the output of "show <remote>"
Jay Soffian [Wed, 25 Feb 2009 08:32:23 +0000 (03:32 -0500)]
builtin-remote: fix two inconsistencies in the output of "show <remote>"

Remote and stale branches are emitted in alphabetical order, but new and
tracked branches are not. So sort the latter to be consistent with the
former. This also lets us use more efficient string_list_has_string()
instead of unsorted_string_list_has_string().

"show <remote>" prunes symrefs, but "show <remote> -n" does not. Fix the
latter to match the former.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: make get_remote_ref_states() always populate states.tracked
Jay Soffian [Wed, 25 Feb 2009 08:32:22 +0000 (03:32 -0500)]
builtin-remote: make get_remote_ref_states() always populate states.tracked

When not querying the remote, show() was having to populate
states.tracked itself. It makes more sense for get_remote_ref_states()
to do this consistently. Since show() is the only caller of
get_remote_ref_states() with query=0, this change does not affect
other callers.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: rename variables and eliminate redundant function call
Jay Soffian [Wed, 25 Feb 2009 08:32:21 +0000 (03:32 -0500)]
builtin-remote: rename variables and eliminate redundant function call

- The variable name "remote" is used as both a "char *" and as a "struct
  remote *"; this is confusing, so rename the former to remote_name.

- Consistently refer to the refs returned by transport_get_remote_refs()
  as remote_refs.

- There is no need to call "sort_string_list(&branch_list)" as
  branch_list is populated via string_list_insert(), which maintains its
  order.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: remove unused code in get_ref_states
Jay Soffian [Wed, 25 Feb 2009 08:32:20 +0000 (03:32 -0500)]
builtin-remote: remove unused code in get_ref_states

get_ref_states() populates the util pointer of the string_list_item's
that it adds to states->new and states->tracked, but nothing ever uses
the pointer, so we can get rid of the extra code.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: refactor duplicated cleanup code
Jay Soffian [Wed, 25 Feb 2009 08:32:19 +0000 (03:32 -0500)]
builtin-remote: refactor duplicated cleanup code

This patch moves identical lines of code into a cleanup function. The
function has two callers and is about to gain a third.

Also removed a bogus NEEDSWORK comment per Daniel Barkalow:

  Actually, the comment is wrong; "remote" comes from remote_get(),
  which returns things from a cache in remote.c; there could be a
  remote_put() to let the code know that the caller is done with the
  object, but it wouldn't presently do anything.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agostring-list: new for_each_string_list() function
Jay Soffian [Wed, 25 Feb 2009 08:32:18 +0000 (03:32 -0500)]
string-list: new for_each_string_list() function

Add a convenience function for iterating over a string_list's items via
a callback.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: make match_refs() not short-circuit
Jay Soffian [Wed, 25 Feb 2009 08:32:17 +0000 (03:32 -0500)]
remote: make match_refs() not short-circuit

match_refs() returns non-zero if there is an error in
match_explicit_refs(), without handling any remaining pattern ref specs.

Its existing callers exit upon receiving non-zero, so a partial result
is of no consequence to them; however a new caller, builtin-remote, is
interested in the complete result even if there are errors in
match_explicit_refs().

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: make match_refs() copy src ref before assigning to peer_ref
Jay Soffian [Wed, 25 Feb 2009 08:32:16 +0000 (03:32 -0500)]
remote: make match_refs() copy src ref before assigning to peer_ref

In some instances, match_refs() sets the peer_ref field of refs in the
dst list such that it points to a ref in the src list. This prevents
callers from freeing both the src and dst lists, as doing so would cause
a double-free since free_refs() frees the peer_ref.

As well, the following configuration causes two refs in the dst list to
have the same peer_ref, which can also lead to a double-free:

  push = refs/heads/master:refs/heads/backup
  push = refs/heads/master:refs/heads/master

Existing callers of match_heads() call it only once and then terminate,
w/o ever bothering to free the src or dst lists, so this is not
currently a problem.

This patch modifies match_refs() to first copy any refs it plucks from
the src list before assigning them as a peer_ref. This allows
builtin-remote, a future caller, to free the src and dst lists.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: let guess_remote_head() optionally return all matches
Jay Soffian [Fri, 27 Feb 2009 19:10:05 +0000 (14:10 -0500)]
remote: let guess_remote_head() optionally return all matches

Determining HEAD is ambiguous since it is done by comparing SHA1s.

In the case of multiple matches we return refs/heads/master if it
matches, else we return the first match we encounter. builtin-remote
needs all matches returned to it, so add a flag for it to request such.

To be simple and consistent, the return value is now a copy (including
peer_ref) of the matching refs.

Originally contributed by Jeff King along with the prior commit as a
single patch.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: make copy_ref() perform a deep copy
Jay Soffian [Fri, 27 Feb 2009 19:10:04 +0000 (14:10 -0500)]
remote: make copy_ref() perform a deep copy

To ensure that copied refs can always be freed w/o causing a
double-free, make copy_ref() perform a deep copy.

Also have copy_ref() return NULL if asked to copy NULL to simplify
things for the caller.

Background: currently copy_ref() performs a shallow copy. This is fine
for current callers who never free the result and/or only copy refs
which contain NULL pointers. But copy_ref() is about to gain a new
caller (guess_remote_head()) which copies refs where peer_ref is not
NULL and the caller of guess_remote_head() will want to free the result.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobisect: fix another instance of eval'ed string
Christian Couder [Fri, 27 Feb 2009 06:31:22 +0000 (07:31 +0100)]
bisect: fix another instance of eval'ed string

When there is nothing to be skipped, the output from
rev-list --bisect-vars was eval'ed without first being
strung together with &&; this is probably not a problem
as it is much less likely to be a bad input than the list
handcrafted by the filter_skip function, but it still is
a good discipline.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: add --format= and --oneline options for "git log"
Teemu Likonen [Tue, 24 Feb 2009 13:33:29 +0000 (15:33 +0200)]
bash completion: add --format= and --oneline options for "git log"

We also add --format= completion for "git show".

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'cc/maint-1.6.0-bisect-fix'
Junio C Hamano [Fri, 27 Feb 2009 09:03:21 +0000 (01:03 -0800)]
Merge branch 'cc/maint-1.6.0-bisect-fix'

* cc/maint-1.6.0-bisect-fix:
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

Conflicts:
git-bisect.sh

15 years agobisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
Christian Couder [Fri, 27 Feb 2009 06:31:22 +0000 (07:31 +0100)]
bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

When the "bad" commit was also "skip"ped and when more than one
commit was skipped, the "filter_skipped" function would have
printed something like:

    bisect_rev=<hash1>|<hash2>

(where <hash1> and <hash2> are hexadecimal sha1 hashes)

and this would have been evaled later as piping "bisect_rev=<hash1>"
into "<hash2>", which would have failed.

So this patch makes the "filter_skipped" function properly quote
what it outputs, so that it will print something like:

bisect_rev='<hash1>|<hash2>'

which will be properly evaled later.  The caller was not stopping
properly because the scriptlet this function returned to be evaled
was not strung together with && and because of this, an error in
an earlier part of the output was simply ignored.

A test case is added to the test suite.

And while at it, we also initialize the VARS, FOUND and TRIED
variables, so that we protect ourselves from environment variables
the user may have with these names.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am: make --abort less dangerous
Junio C Hamano [Thu, 26 Feb 2009 19:24:29 +0000 (11:24 -0800)]
git-am: make --abort less dangerous

When you are in the middle of "git rebase", "git am --abort" by mistake
would have referred to nonexistent ORIG_HEAD and barfed, or worse yet, used
a stale ORIG_HEAD and taken you to an unexpected commit.

Also the option parsing did not reject "git am --abort --skip".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am: Keep index in case of abort with dirty index
Michael J Gruber [Thu, 26 Feb 2009 09:52:53 +0000 (10:52 +0100)]
git-am: Keep index in case of abort with dirty index

git am --abort resets the index unconditionally. But in case a previous
git am exited due to a dirty index it is preferable to keep that index.
Make it so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>