gitweb.git
git-p4: Improve rename detection supportVitor Antunes Sun, 20 Feb 2011 01:18:24 +0000 (01:18 +0000)

git-p4: Improve rename detection support

Only open files for edit after integrating if the SHA1 of source and destination
differ from each other.
Add git config option detectRenames to allow permanent rename detection. This
options should be set to a true/false value.
Rename "detectRename" variable to "detectRenames" to make it more coherent with
the description in git man pages, which always use plural.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Acked-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t7500-commit.sh: use test_cmp instead of testÆvar Arnfjörð Bjarmason Sat, 19 Feb 2011 18:29:09 +0000 (18:29 +0000)

t/t7500-commit.sh: use test_cmp instead of test

Change commit_msg_is() in t/t7500-commit.sh to use test_cmp instead of
the shell's test function. Now if a test fails we'll get test_cmp
output showing us what failed.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/gitweb-lib.sh: Ensure that errors are shown for ... Ævar Arnfjörð Bjarmason Sat, 19 Feb 2011 18:16:19 +0000 (19:16 +0100)

t/gitweb-lib.sh: Ensure that errors are shown for --debug --immediate

Because '--immediate' stops test suite after first error, therefore in
this mode

test_debug 'cat gitweb.log'

was never ran, thus in effect negating effect of '--debug' option.
This made finidng the cause of errors in gitweb test sute difficult.

Modify the gitweb_run test subroutine to run test_debug itself in the
case of errors (and also remove "test_debug 'cat gitweb.log'" from
gitweb tests).

This makes it possible to run *gitweb tests* with --immediate ---debug
combination of options; also it makes gitweb tests to not output
spurious debug data that is not considered error.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb/gitweb.perl: don't call S_ISREG() with undefÆvar Arnfjörð Bjarmason Sat, 19 Feb 2011 15:27:42 +0000 (15:27 +0000)

gitweb/gitweb.perl: don't call S_ISREG() with undef

Change S_ISREG($to_mode_oct) to S_ISREG($from_mode_oct) in the branch
that handles from modes, not to modes. This logic appears to have been
caused by copy/paste programming by Jakub Narebski in e8e41a93. It
would be better to rewrite this code not to be duplicated, but I
haven't done so.

This issue caused a failing test on perl 5.13.9, which has a warning
that turned this up:

gitweb.perl: Use of uninitialized value in subroutine entry at /home/avar/g/git/t/../gitweb/gitweb.perl line 4415.

Which caused the Git test suite to fail on this test:

./t9500-gitweb-standalone-no-errors.sh (Wstat: 256 Tests: 90 Failed: 84)
Failed tests: 1-8, 10-36, 38-45, 47-48, 50-88
Non-zero exit status: 1

Reported-by: perl 5.13.9
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb/gitweb.perl: remove use of qw(...) as parenthesesÆvar Arnfjörð Bjarmason Sat, 19 Feb 2011 15:27:41 +0000 (15:27 +0000)

gitweb/gitweb.perl: remove use of qw(...) as parentheses

Using the qw(...) construct as implicit parentheses was deprecated in
perl 5.13.5. Change the relevant code in gitweb to not use the
deprecated construct. The offending code was introduced in 3562198b by
Jakub Narebski.

The issue is that perl will now warn about this:

$ perl -wE 'for my $i qw(a b) { say $i }'
Use of qw(...) as parentheses is deprecated at -e line 1.
a
b

This caused gitweb.perl to warn on perl 5.13.5 and above, and these
tests to fail on those perl versions:

./t9501-gitweb-standalone-http-status.sh (Wstat: 256 Tests: 11 Failed: 10)
Failed tests: 2-11
Non-zero exit status: 1
./t9502-gitweb-standalone-parse-output.sh (Wstat: 256 Tests: 10 Failed: 9)
Failed tests: 2-10
Non-zero exit status: 1

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: propagate --progress to mergeJeff King Sun, 20 Feb 2011 09:56:56 +0000 (04:56 -0500)

pull: propagate --progress to merge

Now that merge understands progress, we should pass it
along. While we're at it, pass along --no-progress, too.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: enable progress reporting for rename detectionJeff King Sun, 20 Feb 2011 09:53:21 +0000 (04:53 -0500)

merge: enable progress reporting for rename detection

The user can enable or disable it explicitly with the new
--progress, but it defaults to checking isatty(2).

This works only with merge-recursive and subtree. In theory
we could pass a progress flag to other strategies, but none
of them support progress at this point, so let's wait until
they grow such a feature before worrying about propagating
it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add inexact rename detection progress infrastructureJeff King Sun, 20 Feb 2011 09:51:16 +0000 (04:51 -0500)

add inexact rename detection progress infrastructure

We might spend many seconds doing inexact rename detection
with no output. It's nice to let the user know that
something is actually happening.

This patch adds the infrastructure, but no callers actually
turn on progress reporting.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: stop setting rename limitJeff King Sat, 19 Feb 2011 10:21:57 +0000 (05:21 -0500)

commit: stop setting rename limit

For its post-commit summary, commit was explicitly setting
the default rename limit to 100. Presumably when the code
was added, it was necessary to do so. These days, however,
it will fall back properly to the diff default, and that
default has long since changed from 100.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bump rename limit defaults (again)Jeff King Sat, 19 Feb 2011 10:21:28 +0000 (05:21 -0500)

bump rename limit defaults (again)

We did this once before in 5070591 (bump rename limit
defaults, 2008-04-30). Back then, we were shooting for about
1 second for a diff/log calculation, and 5 seconds for a
merge.

There are a few new things to consider, though:

1. Average processors are faster now.

2. We've seen on the mailing list some ugly merges where
not using inexact rename detection leads to many more
conflicts. Merges of this size take a long time
anyway, so users are probably happy to spend a little
bit of time computing the renames.

Let's bump the diff/merge default limits from 200/500 to
400/1000. Those are 2 seconds and 10 seconds respectively on
my modern hardware.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: improve inexact rename limit warningJeff King Sat, 19 Feb 2011 10:20:51 +0000 (05:20 -0500)

merge: improve inexact rename limit warning

The warning is generated deep in the diffcore code, which
means that it will come first, followed possibly by a spew
of conflicts, making it hard to see.

Instead, let's have diffcore pass back the information about
how big the rename limit would needed to have been, and then
the caller can provide a more appropriate message (and at a
more appropriate time).

No refactoring of other non-merge callers is necessary,
because nobody else was even using the warn_on_rename_limit
feature.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: support clone --barePete Wyckoff Sat, 19 Feb 2011 13:18:01 +0000 (08:18 -0500)

git-p4: support clone --bare

Just like git clone --bare, build a .git directory but no
checked out files.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: decode p4 wildcard charactersPete Wyckoff Sat, 19 Feb 2011 13:18:00 +0000 (08:18 -0500)

git-p4: decode p4 wildcard characters

There are four wildcard characters in p4. Files with these
characters can be added to p4 repos using the "-f" option.
They are stored in %xx notation, and when checked out, p4
converts them back to normal.

This patch does the same thing when importing into git,
converting the four special characters. Without this change,
the files appear with literal %xx in their names.

Be careful not to produce "*" in filenames on windows. That
will fail.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: better message for "git-p4 sync" when not clonedPete Wyckoff Sat, 19 Feb 2011 13:17:59 +0000 (08:17 -0500)

git-p4: better message for "git-p4 sync" when not cloned

A common error is to do "git-p4 sync" in a repository that
was not initialized by "git-p4 clone". There will be no
p4 refs. The error message in this case is a traceback
for an assertion, which is confusing.

Change it instead to explain the likely problem.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: reinterpret confusing p4 messagePete Wyckoff Sat, 19 Feb 2011 13:17:58 +0000 (08:17 -0500)

git-p4: reinterpret confusing p4 message

Error output will look like this:

glom$ git p4 clone //deopt
Importing from //deopt into .
Reinitialized existing Git repository in /tmp/x/.git/
Doing initial import of //deopt from revision #head into refs/remotes/p4/master
p4 returned an error: //deopt/... - must refer to client glom.

This particular p4 error is misleading.
Perhaps the depot path was misspelled.
Depot path: //deopt

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: accommodate new move/delete type in p4Pete Wyckoff Sat, 19 Feb 2011 13:17:57 +0000 (08:17 -0500)

git-p4: accommodate new move/delete type in p4

562d53f (git-p4: Fix sync errors due to new server version, 2010-01-21)
taught git-p4 sync to recognize the new move/delete type, but this type
can also show up in an initial clone and labels output.

Instead of replicating the support in three places, hoist the definition
somewhere global.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add missing newline in initial import messagePete Wyckoff Sat, 19 Feb 2011 13:17:56 +0000 (08:17 -0500)

git-p4: add missing newline in initial import message

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: fix key error for p4 problemPete Wyckoff Sat, 19 Feb 2011 13:17:55 +0000 (08:17 -0500)

git-p4: fix key error for p4 problem

Some p4 failures result in an error, but the info['code'] is not
set. These include a bad p4 executable, or a core dump from p4,
and other odd internal errors where p4 fails to generate proper
marshaled output.

Make sure the info key exists before using it to avoid a python
traceback.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: test scriptPete Wyckoff Sat, 19 Feb 2011 13:17:54 +0000 (08:17 -0500)

git-p4: test script

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diffcore-rename: improve estimate_similarity() heuristicsLinus Torvalds Sat, 19 Feb 2011 04:12:06 +0000 (20:12 -0800)

diffcore-rename: improve estimate_similarity() heuristics

The logic to quickly dismiss potential rename pairs was broken. It
would too eagerly dismiss possible renames when all of the difference
was due to pure new data (or deleted data).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diffcore-rename: properly honor the difference between... Linus Torvalds Sat, 19 Feb 2011 04:10:32 +0000 (20:10 -0800)

diffcore-rename: properly honor the difference between -M and -C

We would allow rename detection to do copy detection even when asked
purely for renames. That confuses users, but more importantly it can
terminally confuse the recursive merge rename logic.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

for_each_hash: allow passing a 'void *data' pointer... Linus Torvalds Sat, 19 Feb 2011 03:55:19 +0000 (19:55 -0800)

for_each_hash: allow passing a 'void *data' pointer to callback

For the find_exact_renames() function, this allows us to pass the
diff_options structure pointer to the low-level routines. We will use
that to distinguish between the "rename" and "copy" cases.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: die when trying to clone missing local pathJeff King Fri, 18 Feb 2011 04:01:52 +0000 (23:01 -0500)

clone: die when trying to clone missing local path

Since 86ac751 (Allow cloning an empty repository,
2009-01-23), doing:

git clone does-not-exist

has created does-not-exist as an empty repository. This was
an unintentional side effect of 86ac751. Even weirder,
doing:

git clone does-not-exist new-dir

_does_ fail, making this "feature" (if you want to consider
it such) broken. Let's detect this situation and explicitly
die. It's almost certainly not what the user intended.

This patch also adds two tests. One for the missing path
case, and one to confirm that a similar case, cloning a
non-repository directory, fails.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: skip terminal output tests on OS XJonathan Nieder Thu, 17 Feb 2011 12:38:52 +0000 (06:38 -0600)

tests: skip terminal output tests on OS X

On Mac OS X 10.5.0, test_terminal gets stuck reading from the pty
master every once in a while. To reproduce the problem:

perl -MIO::Pty -MFile::Copy -e '
for (my $i = 0;; $i++) {
my $master = new IO::Pty;
my $slave = $master->slave;
if (fork == 0) {
close $master or die "close: $!";
open STDOUT, ">&", $slave or die "dup2: $!";
close $slave or die "close: $!";
exec("echo", "hi", $i) or die "exec: $!";
}
close $slave or die "close: $!";
copy($master, \*STDOUT) or die "copy: $!";
close $master or die "close: $!";
wait;
}
'

It blocks after 7000 iterations or so in sysread(). The relevant
sysread() call is the second call by the parent, which presumably
executes before the child dies but after the parent has read all
output from there.

Since this is an intermitent problem, the quick check of terminal
support in lib-terminal doesn't catch it. Skip these tests on the Mac
for now.

Noticed-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7406: "git submodule update {--merge|--rebase]" with... Spencer E. Olson Thu, 17 Feb 2011 16:18:46 +0000 (09:18 -0700)

t7406: "git submodule update {--merge|--rebase]" with new submodules

Add two test cases in t7406 to ensure that the --merge/--rebase options
are ignored for "git submodule update" with new modules. These test that
a simple checkout is performed instead.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: no [--merge|--rebase] when newly clonedSpencer E. Olson Thu, 17 Feb 2011 16:18:45 +0000 (09:18 -0700)

submodule: no [--merge|--rebase] when newly cloned

"git submodule update" can be run with either the "--merge" or "--rebase"
option, or submodule.<name>.update configuration variable can be set to
"merge" or "rebase, to cause local work to get integrated when updating
the submodule.

When a submodule is newly cloned, however, it does not have a check out
when a rebase or merge is attempted, leading to a failure. For newly
cloned submodules, simply check out the appropriate revision. There is no
local work to integrate with for them.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-patch-id: do not trip over "no newline" markersMichael J Gruber Thu, 17 Feb 2011 07:44:42 +0000 (08:44 +0100)

git-patch-id: do not trip over "no newline" markers

Currently, patch-id trips over our very own diff extension for marking
the absence of newline at EOF.

Fix it. (Ignore it, it's whitespace.)

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

git-patch-id: test for "no newline" markersMichael J Gruber Wed, 16 Feb 2011 16:55:37 +0000 (17:55 +0100)

git-patch-id: test for "no newline" markers

Currently, patch-id trips over our very own output that marks the absence
of newline at EOF.

Expose this in a test.

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

Make <identifier> lowercase in DocumentationMichael J Gruber Thu, 17 Feb 2011 07:48:06 +0000 (08:48 +0100)

Make <identifier> lowercase in Documentation

Leaving uppercase abbreviations (e.g. URL) and an identifier named after
an upercase env variable (CVSROOT) in place, this adjusts the few
remaining cases and fixes an unidentified identifier along the way.

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

branch/checkout --track: Ensure that upstream branch... Johan Herland Wed, 16 Feb 2011 23:12:20 +0000 (00:12 +0100)

branch/checkout --track: Ensure that upstream branch is indeed a branch

When creating a new branch using the --track option, we must make sure that
we don't try to set an upstream that does not make sense to follow (using
'git pull') or update (using 'git push'). The current code checks against
using HEAD as upstream (since tracking a symref doesn't make sense). However,
tracking a tag doesn't make sense either. Indeed, tracking _any_ ref that is
not a (local or remote) branch doesn't make sense, and should be disallowed.

This patch achieves this by checking that the ref we're trying to --track
resides within refs/heads/* or refs/remotes/*. This new check replaces the
previous check against HEAD.

A couple of testcases are also added, verifying that we cannot create
branches with tags as upstreams.

Finally, some selftests relying on using a non-branch as an upstream have
been reworked or removed:

- t6040: Reverse the meaning of two tests that depend on the ability to
use (lightweight and annotated) tags as upstreams. These two tests were
originally added in commits 1be570f and 57ffc5f, and this patch reverts the
intention of those two commits.

- t7201: Remove part of a test (introduced in 9188ed8) relying on a
non-branch as upstream.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep --no-index: honor pathspecs correctlyJunio C Hamano Wed, 16 Feb 2011 22:39:00 +0000 (14:39 -0800)

grep --no-index: honor pathspecs correctly

Even though fill_directory() takes pathspec, the returned set of paths
is not guaranteed to be free of paths outside the pathspec. Perhaps we
would need to change that, but the current API is that the caller needs
to further filter them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 16 Feb 2011 22:33:22 +0000 (14:33 -0800)

Merge branch 'maint'

* maint:
parse_tag_buffer(): do not prefixcmp() out of range

Merge branch 'maint-1.7.3' into maintJunio C Hamano Wed, 16 Feb 2011 22:33:11 +0000 (14:33 -0800)

Merge branch 'maint-1.7.3' into maint

* maint-1.7.3:

Merge branch 'maint-1.7.2' into maint-1.7.3Junio C Hamano Wed, 16 Feb 2011 22:32:59 +0000 (14:32 -0800)

Merge branch 'maint-1.7.2' into maint-1.7.3

* maint-1.7.2:
fast-import: introduce "feature notes" command
fast-import: clarify documentation of "feature" command

Merge branch 'maint-1.7.1' into maint-1.7.2Junio C Hamano Wed, 16 Feb 2011 22:32:54 +0000 (14:32 -0800)

Merge branch 'maint-1.7.1' into maint-1.7.2

* maint-1.7.1:
fast-import: introduce "feature notes" command
fast-import: clarify documentation of "feature" command

Merge branch 'maint-1.7.0' into maint-1.7.1Junio C Hamano Wed, 16 Feb 2011 22:32:47 +0000 (14:32 -0800)

Merge branch 'maint-1.7.0' into maint-1.7.1

* maint-1.7.0:
fast-import: introduce "feature notes" command
fast-import: clarify documentation of "feature" command

mergetool: don't skip modify/remove conflictsMartin von Zweigbergk Wed, 16 Feb 2011 10:47:45 +0000 (05:47 -0500)

mergetool: don't skip modify/remove conflicts

Since bb0a484 (mergetool: Skip autoresolved paths, 2010-08-17),
mergetool uses different ways of figuring out the list of files with
merge conflicts depending on whether rerere is active. If rerere is
active, mergetool will use 'git rerere status' to list the files with
remaining conflicts. However, the output from that command does not
list conflicts of types that rerere does not handle, such as
modify/remove conflicts.

Another problem with solely relying on the output from 'git rerere
status' is that, for new conflicts that are not yet known to rerere,
the output from the command will list the files even after adding them
to the index. This means that if the conflicts in some files have been
resolved and 'git mergetool' is run again, it will ask the user
something like the following for each of those files.

file1: file does not need merging
Continue merging other unresolved paths (y/n) ?

Solve both of these problems by replacing the call to 'git rerere
status' with a call to the new 'git rerere remaining' that was
introduced in the previous commit.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rerere "remaining"Martin von Zweigbergk Wed, 16 Feb 2011 10:47:44 +0000 (05:47 -0500)

rerere "remaining"

After "rerere" resolves conflicts by reusing old resolution, there would
be three kinds of paths with conflict in the index:

* paths that have been resolved in the working tree by rerere;
* paths that need further work whose resolution could be recorded;
* paths that need resolving that rerere won't help.

When the user wants a list of paths that need hand-resolving, output from
"rerere status" does not help, as it shows only the second category, but
the paths in the third category still needs work (rerere only makes sense
for regular files that have both our side and their side, and does not
help other kinds of conflicts, e.g. "we modified, they deleted").

The new subcommand "rerere remaining" can be used to show both. As
opposed to "rerere status", this subcommand also skips printing paths
that have been added to the index, since these paths are already
resolved and are no longer "remaining".

Initial patch provided by Junio. Refactored and modified to skip
resolved paths by Martin. Commit message mostly by Junio.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

push.default: Rename 'tracking' to 'upstream'Johan Herland Wed, 16 Feb 2011 00:54:24 +0000 (01:54 +0100)

push.default: Rename 'tracking' to 'upstream'

Users are sometimes confused with two different types of "tracking" behavior
in Git: "remote-tracking" branches (e.g. refs/remotes/*/*) versus the
merge/rebase relationship between a local branch and its @{upstream}
(controlled by branch.foo.remote and branch.foo.merge config settings).

When the push.default is set to 'tracking', it specifies that a branch should
be pushed to its @{upstream} branch. In other words, setting push.default to
'tracking' applies only to the latter of the above two types of "tracking"
behavior.

In order to make this more understandable to the user, we rename the
push.default == 'tracking' option to push.default == 'upstream'.

push.default == 'tracking' is left as a deprecated synonym for 'upstream'.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

parse_tag_buffer(): do not prefixcmp() out of rangeNguyễn Thái Ngọc Duy Mon, 14 Feb 2011 13:02:51 +0000 (20:02 +0700)

parse_tag_buffer(): do not prefixcmp() out of range

There is a check (size < 64) at the beginning of the function, but
that only covers object+type lines.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git.c: reorder builtin command listNguyễn Thái Ngọc Duy Tue, 15 Feb 2011 03:09:03 +0000 (10:09 +0700)

git.c: reorder builtin command list

The majority of commands is in alphabet order except some. Reorder
them so it's easier to locate a command by eye and able to binary
search.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: honor prepare-commit-msg hookJay Soffian Tue, 15 Feb 2011 01:07:50 +0000 (20:07 -0500)

merge: honor prepare-commit-msg hook

When a merge is stopped due to conflicts or --no-commit, the
subsequent commit calls the prepare-commit-msg hook. However,
it is not called after a clean merge. Fix this inconsistency
by invoking the hook after clean merges as well.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Make <identifier> lowercase as per CodingGuidelinesMichael J Gruber Tue, 15 Feb 2011 13:09:13 +0000 (14:09 +0100)

Make <identifier> lowercase as per CodingGuidelines

*.c part for matches with '<[A-Z]+>' (and affected test).

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

Make <identifier> lowercase as per CodingGuidelinesMichael J Gruber Tue, 15 Feb 2011 13:09:12 +0000 (14:09 +0100)

Make <identifier> lowercase as per CodingGuidelines

*.c part for matches with '"[A-Z]+"'.

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

Make <identifier> lowercase as per CodingGuidelinesMichael J Gruber Tue, 15 Feb 2011 13:09:11 +0000 (14:09 +0100)

Make <identifier> lowercase as per CodingGuidelines

parse-options part

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

CodingGuidelines: downcase placeholders in usage messagesJunio C Hamano Tue, 15 Feb 2011 19:02:56 +0000 (11:02 -0800)

CodingGuidelines: downcase placeholders in usage messages

We accumulated some inconsistencies without an explicit guidance to spell
this out over time.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

smart-http: Don't use Expect: 100-ContinueShawn O. Pearce Tue, 15 Feb 2011 16:57:24 +0000 (08:57 -0800)

smart-http: Don't use Expect: 100-Continue

Some HTTP/1.1 servers or proxies don't correctly implement the
100-Continue feature of HTTP/1.1. Its a difficult feature to
implement right, and isn't commonly used by browsers, so many
developers may not even be aware that their server (or proxy)
doesn't honor it.

Within the smart HTTP protocol for Git we only use this newer
"Expect: 100-Continue" feature to probe for missing authentication
before uploading a large payload like a pack file during push.
If authentication is necessary, we expect the server to send the
401 Not Authorized response before the bulk data transfer starts,
thus saving the client bandwidth during the retry.

A different method to probe for working authentication is to send an
empty command list (that is just "0000") to $URL/git-receive-pack.
or $URL/git-upload-pack. All versions of both receive-pack and
upload-pack since the introduction of smart HTTP in Git 1.6.6
cleanly accept just a flush-pkt under --stateless-rpc mode, and
exit with success.

If HTTP level authentication is successful, the backend will return
an empty response, but with HTTP status code 200. This enables
the client to continue with the transfer.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Tue, 15 Feb 2011 19:03:22 +0000 (11:03 -0800)

Merge branch 'maint'

* maint:
pull: do not display fetch usage on --help-all
git-tag.txt: list all modes in the description
commit,status: describe -u likewise
add: describe --patch like checkout, reset
commit,merge,tag: describe -m likewise
clone,init: describe --template using the same wording
commit,status: describe --porcelain just like push
commit,tag: use same wording for -F
configure: use AC_LANG_PROGRAM consistently
string_list_append: always set util pointer to NULL
correct type of EMPTY_TREE_SHA1_BIN

pull: do not display fetch usage on --help-allMichael J Gruber Mon, 14 Feb 2011 16:48:08 +0000 (17:48 +0100)

pull: do not display fetch usage on --help-all

Currently, "git pull --help-all" displays the fetch usage info.

Make it equivalent to "git pull -h" instead since "--help-all" is
documented in gitcli(7).

Do not try to sanitize the pull option parser (aka last hair puller).

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

git-tag.txt: list all modes in the descriptionMichael J Gruber Tue, 15 Feb 2011 13:09:10 +0000 (14:09 +0100)

git-tag.txt: list all modes in the description

Currently, the description sounds as if it applied always, but most of
its content is true in "create tag mode" only.

Make this clearer by listing all modes upfront.

Also, sneak in some linguistic improvements and make it clearer that
lightweight tags are "created" because "written" may be misread as
"are output".

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

commit,status: describe -u likewiseMichael J Gruber Tue, 15 Feb 2011 13:09:09 +0000 (14:09 +0100)

commit,status: describe -u likewise

They differ by one character only. Being exactly equal should help
translations.

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

add: describe --patch like checkout, resetMichael J Gruber Tue, 15 Feb 2011 13:09:08 +0000 (14:09 +0100)

add: describe --patch like checkout, reset

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

commit,merge,tag: describe -m likewiseMichael J Gruber Tue, 15 Feb 2011 13:09:07 +0000 (14:09 +0100)

commit,merge,tag: describe -m likewise

This also removes the superfluous "specify" and rewords the misleading
"if any" which sounds as if omitting "-m" would omit the merge commit
message. (It means "if a merge commit is created at all".)

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

clone,init: describe --template using the same wordingMichael J Gruber Tue, 15 Feb 2011 13:09:06 +0000 (14:09 +0100)

clone,init: describe --template using the same wording

This also corrects a wrong description for clone.

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

commit,status: describe --porcelain just like pushMichael J Gruber Tue, 15 Feb 2011 13:09:05 +0000 (14:09 +0100)

commit,status: describe --porcelain just like push

Push has the clearer description, so take that one for all.

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

commit,tag: use same wording for -FMichael J Gruber Tue, 15 Feb 2011 13:09:04 +0000 (14:09 +0100)

commit,tag: use same wording for -F

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

Revert "unpack_trees(): skip trees that are the same... Junio C Hamano Tue, 15 Feb 2011 18:47:04 +0000 (10:47 -0800)

Revert "unpack_trees(): skip trees that are the same in all input"

This reverts commit 83c90314aa27ae3768c04375d02e4f3fb12b726d, which
seems to have broken merge to report conflicts when there should be
none.

Rename t2019 with typo "amiguous" that meant "ambiguous"Junio C Hamano Tue, 15 Feb 2011 18:43:45 +0000 (10:43 -0800)

Rename t2019 with typo "amiguous" that meant "ambiguous"

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Demonstrate breakage: checkout overwrites untracked... Johannes Sixt Sat, 5 Feb 2011 18:18:44 +0000 (19:18 +0100)

Demonstrate breakage: checkout overwrites untracked symlink with directory

This adds tests where an untracked file and an untracked symlink are in the
way where a directory should be created by 'git checkout'. Commit b1735b1a
(do not overwrite files in leading path, 2010-12-14) fixed the case where
a file is in the way, but the untracked symlink is still removed silently.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: Include version check and test for tearoff... Pat Thoyts Tue, 15 Feb 2011 00:20:36 +0000 (00:20 +0000)

git-gui: Include version check and test for tearoff menu entry

The --all option for git fetch was added in v1.6.6 so ensure we have a usable version before adding
the menu items.
Sometimes people use tearoff menus and these offset the entry indices by one.

Acked-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

perl: command_bidi_pipe() method should set-up git... Masatake Osanai Mon, 14 Feb 2011 22:13:04 +0000 (07:13 +0900)

perl: command_bidi_pipe() method should set-up git environmens

When command_input_pipe and command_output_pipe are used as a
method of a Git::repository instance, they eventually call into
_cmd_exec method that sets up the execution environment such as
GIT_DIR, GIT_WORK_TREE environment variables and the current
working directory in the child process that interacts with the
repository.

command_bidi_pipe however didn't expect to be called as such, and
lacked all these set-up. Because of this, a program that did this
did not work as expected:

my $repo = Git->repository(Directory => '/some/where/else');
my ($pid, $in, $out, $ctx) =
$repo->command_bidi_pipe(qw(hash-object -w --stdin-paths));

This patch refactors the _cmd_exec into _setup_git_cmd_env that
sets up the execution environment, and makes _cmd_exec and
command_bidi_pipe to use it.

Note that unlike _cmd_exec that execv's a git command as an
external process, command_bidi_pipe is called from the main line
of control, and the execution environment needs to be restored
after open2() does its magic.

Signed-off-by: Masatake Osanai <unpush@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

configure: use AC_LANG_PROGRAM consistentlyRalf Wildenhues Sun, 2 Jan 2011 10:24:55 +0000 (11:24 +0100)

configure: use AC_LANG_PROGRAM consistently

Avoid warnings from Autoconf 2.68 about missing use of AC_LANG_PROGRAM
and friends.

Quoting autoconf-2.68/NEWS:

** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and
AC_RUN_IFELSE now warn if the first argument failed to use
AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file
contents. A new macro AC_LANG_DEFINES_PROVIDED exists if you have
a compelling reason why you cannot use AC_LANG_SOURCE but must
avoid the warning.

The underlying reason for that change is that AC_LANG_{SOURCE,PROGRAM}
take care to supply the previously computed set of #defines (and
include standard headers if so desired) for preprocessed languages
like C and C++.

In some cases, AC_LANG_PROGRAM is already used but not sufficiently
m4-quoted, so we just need to add another set of [quotes] to prevent
the autoconf warning from being triggered bogusly. Quoting all
arguments (except when calling special macros that need to be expanded
before recursion) is better style, anyway. These and more rules are
described in detail in 'info Autoconf "Programming in M4"'.

No change in the resulting config.mak.autogen after running
./configure intended.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

string_list_append: always set util pointer to NULLJeff King Sat, 12 Feb 2011 05:18:51 +0000 (00:18 -0500)

string_list_append: always set util pointer to NULL

It is not immediately obvious that the util field may
contain random bytes after appending an item. Especially
since the string_list_insert* functions _do_ explicitly zero
the util pointer.

This does not appear to be a bug in any current git code, as
all callers either fill in the util field immediately or
never use it. However, it is worth it to be less surprising
to new users of the string-list API who may expect it to be
intialized to NULL.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

correct type of EMPTY_TREE_SHA1_BINJonathan Nieder Mon, 7 Feb 2011 08:17:27 +0000 (02:17 -0600)

correct type of EMPTY_TREE_SHA1_BIN

Functions such as hashcmp that expect a binary SHA-1 value take
parameters of type "unsigned char *" to avoid accepting a textual
SHA-1 passed by mistake. Unfortunately, this means passing the string
literal EMPTY_TREE_SHA1_BIN requires an ugly cast. Tweak the
definition of EMPTY_TREE_SHA1_BIN to produce a value of more
convenient type.

In the future the definition might change to

extern const unsigned char empty_tree_sha1_bin[20];
#define EMPTY_TREE_SHA1_BIN empty_tree_sha1_bin

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Obey p4 views when using client specIan Wienand Sat, 12 Feb 2011 00:33:48 +0000 (16:33 -0800)

Obey p4 views when using client spec

When using the p4 client spec, this attempts to obey the client's
output preferences.

For example, a view like

//depot/foo/branch/... //client/branch/foo/...
//depot/bar/branch/... //client/branch/bar/...

will result in a directory layout in the git tree of

branch/
branch/foo
branch/bar

p4 can do various other reordering that this change doesn't support,
but we should detect it and at least fail nicely.

Signed-off-by: Ian Wienand <ianw@vmware.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Acked-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: teach fetch/prune menu to do it for all remotesHeiko Voigt Sun, 13 Feb 2011 13:57:15 +0000 (14:57 +0100)

git-gui: teach fetch/prune menu to do it for all remotes

The commandline fetch already has this option for some time. Since this
was not available at the time git gui was written lets implement it now.

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: refactor remote submenu creation into subroutineHeiko Voigt Sun, 13 Feb 2011 13:50:38 +0000 (14:50 +0100)

git-gui: refactor remote submenu creation into subroutine

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

gitignore: add test-mktemp to ignore listÆvar Arnfjörð Bjarmason Sat, 12 Feb 2011 23:21:17 +0000 (23:21 +0000)

gitignore: add test-mktemp to ignore list

Change the .gitignore to ignore test-mktemp which is built from
test-mktemp.c. Arnout Engelen added this in 6cf6bb3 (Improve error
messages when temporary file creation fails, 2010-12-18) but forgot
to add a corresponding entry to .gitignore.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repo-config: add deprecation warningRené Scharfe Sat, 12 Feb 2011 13:24:10 +0000 (14:24 +0100)

repo-config: add deprecation warning

repo-config was deprecated in 5c66d0d4 on 2008-01-17. Warn the
remaining users that it has been replaced by config and is going to
be removed eventually.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: always default to the last merged branch in... Heiko Voigt Sat, 12 Feb 2011 16:44:58 +0000 (17:44 +0100)

git-gui: always default to the last merged branch in remote delete

This is useful if you are directly working together with other
developers pushing feature branches on a shared remote. You typically
push feature branches to the remote so others can review. Once they are
satisfied and the branch is merged into the main branch it needs to be
deleted on the server.

Since we did not yet have a preselected default branch in the remote
delete dialog lets use the last merged branch if it is found on the
server.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: fix deleting item from all_remotes variableHeiko Voigt Sat, 12 Feb 2011 16:43:44 +0000 (17:43 +0100)

git-gui: fix deleting item from all_remotes variable

lsearch and lreplace both take the variable content as argument and not
just their name.

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Merge branch 'maint'Junio C Hamano Sat, 12 Feb 2011 00:01:47 +0000 (16:01 -0800)

Merge branch 'maint'

* maint:
Git 1.7.4.1
clone: fixup recurse_submodules option
svn-fe: warn about experimental status

Conflicts:
contrib/examples/git-revert.sh
contrib/svn-fe/svn-fe.txt

Git 1.7.4.1 v1.7.4.1Junio C Hamano Fri, 11 Feb 2011 22:39:55 +0000 (14:39 -0800)

Git 1.7.4.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/fsck-fixes' into maintJunio C Hamano Fri, 11 Feb 2011 22:26:10 +0000 (14:26 -0800)

Merge branch 'jc/fsck-fixes' into maint

* jc/fsck-fixes:
fsck: do not give up too early in fsck_dir()
fsck: drop unused parameter from traverse_one_object()

clone: fixup recurse_submodules optionChris Packham Thu, 10 Feb 2011 22:59:31 +0000 (11:59 +1300)

clone: fixup recurse_submodules option

The recurse_submodules option was added in ccdd3da6 to bring 'git clone'
into line with 'git fetch' and future commands. The correct option should
have been "recurse-submodules".

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

svn-fe: warn about experimental statusJonathan Nieder Fri, 11 Feb 2011 10:36:44 +0000 (04:36 -0600)

svn-fe: warn about experimental status

svn-fe is young and some coming cleanups might involve backward
incompatible UI changes. Add some words of warning to the manual so
early adopters that are not following the project closely don't get
burned.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Thu, 10 Feb 2011 22:45:55 +0000 (14:45 -0800)

Merge branch 'maint'

* maint:
compat: helper for detecting unsigned overflow

rebase: use @{upstream} if no upstream specifiedMartin von Zweigbergk Thu, 10 Feb 2011 01:54:02 +0000 (20:54 -0500)

rebase: use @{upstream} if no upstream specified

'git rebase' without arguments is currently not supported. Make it
default to 'git rebase @{upstream}'. That is also what 'git pull
[--rebase]' defaults to, so it only makes sense that 'git rebase'
defaults to the same thing.

Defaulting to @{upstream} will make it possible to run e.g. 'git
rebase -i' without arguments, which is probably a quite common use
case. It also improves the scenario where you have multiple branches
that rebase against a remote-tracking branch, where you currently have
to choose between the extra network delay of 'git pull' or the
slightly awkward keys to enter 'git rebase @{u}'.

The error reporting when no upstream is configured for the current
branch or when no branch is checked out is reused from git-pull.sh. A
function is extracted into git-parse-remote.sh for this purpose.

Helped-by: Yann Dirson <ydirson@altern.org>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: remove unnecessary state rebase-rootMartin von Zweigbergk Sun, 6 Feb 2011 18:44:00 +0000 (13:44 -0500)

rebase -i: remove unnecessary state rebase-root

Before calling 'git cherry-pick', interactive rebase currently checks
if we are rebasing from root (if --root was passed). If we are, the
'--ff' flag to 'git cherry-pick' is omitted. However, according to the
documentation for 'git cherry-pick --ff', "If the current HEAD is the
same as the parent of the cherry-picked commit, then a fast forward to
this commit will be performed.". This should never be the case when
rebasing from root, so it should not matter whether --ff is passed, so
simplify the code by removing the condition.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: don't read unused variable preserve_mergesMartin von Zweigbergk Sun, 6 Feb 2011 18:43:59 +0000 (13:43 -0500)

rebase -i: don't read unused variable preserve_merges

Since 8e4a91b (rebase -i: remember the settings of -v, -s and -p when
interrupted, 2007-07-08), the variable preserve_merges (then called
PRESERVE_MERGES) was detected from the state saved in
$GIT_DIR/rebase-merge in order to be used when the rebase resumed, but
its value was never actually used. The variable's value was only used
when the rebase was initated.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-rebase--am: remove unnecessary --3way optionMartin von Zweigbergk Sun, 6 Feb 2011 18:43:58 +0000 (13:43 -0500)

git-rebase--am: remove unnecessary --3way option

Since 22db240 (git-am: propagate --3way options as well, 2008-12-04),
the --3way has been propageted across failure, so it is since
pointless to pass it to git-am when resuming.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -m: don't print exit code 2 when merge failsMartin von Zweigbergk Sun, 6 Feb 2011 18:43:57 +0000 (13:43 -0500)

rebase -m: don't print exit code 2 when merge fails

When the merge strategy fails, a message suggesting the user to try
another strategy is displayed. Remove the "$rv" (which is always equal
to "2" in this case) from that message.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -m: remember allow_rerere_autoupdate optionMartin von Zweigbergk Sun, 6 Feb 2011 18:43:56 +0000 (13:43 -0500)

rebase -m: remember allow_rerere_autoupdate option

If '--[no-]allow_rerere_autoupdate' is passed when 'git rebase -m' is
called and a merge conflict occurs, the flag will be forgotten for the
rest of the rebase process. Make rebase remember it by saving the
value.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: remember strategy and strategy optionsMartin von Zweigbergk Sun, 6 Feb 2011 18:43:55 +0000 (13:43 -0500)

rebase: remember strategy and strategy options

When a rebase is resumed, interactive rebase remembers any merge
strategy passed when the rebase was initated. Make non-interactive
rebase remember any merge strategy as well. Also make non-interactive
rebase remember any merge strategy options.

To be able to resume a rebase that was initiated with an older version
of git (older than this commit), make sure not to expect the saved
option files to exist.

Test case idea taken from Junio's 71fc224 (t3402: test "rebase
-s<strategy> -X<opt>", 2010-11-11).

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: remember verbose optionMartin von Zweigbergk Sun, 6 Feb 2011 18:43:54 +0000 (13:43 -0500)

rebase: remember verbose option

Currently, only interactive rebase remembers the value of the '-v'
flag from the initial invocation. Make non-interactive rebase also
remember it.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: extract code for writing basic stateMartin von Zweigbergk Sun, 6 Feb 2011 18:43:53 +0000 (13:43 -0500)

rebase: extract code for writing basic state

Extract the code for writing the state to rebase-apply/ or
rebase-merge/ when a rebase is initiated. This will make it easier to
later make both interactive and non-interactive rebase remember the
options used.

Note that non-interactive rebase stores the sha1 of the original head
in a file called orig-head, while interactive rebase stores it in a
file called head. Change this by writing to orig-head in both
cases. When reading, try to read from orig-head. If that fails, read
from head instead. This protects users who upgraded git while they had
an ongoing interactive rebase, while still making it possible to
remove the code that reads from head at some point in the future.

Helped-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: factor out sub command handlingMartin von Zweigbergk Sun, 6 Feb 2011 18:43:52 +0000 (13:43 -0500)

rebase: factor out sub command handling

Factor out the common parts of the handling of the sub commands
'--continue', '--skip' and '--abort'. The '--abort' handling can
handled completely in git-rebase.sh.

After this refactoring, the calls to git-rebase--am.sh,
git-rebase--merge.sh and git-rebase--interactive.sh will be better
aligned. There will only be one call to interactive rebase that will
shortcut the very last part of git-rebase.sh.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: make -v a tiny bit more verboseMartin von Zweigbergk Sun, 6 Feb 2011 18:43:51 +0000 (13:43 -0500)

rebase: make -v a tiny bit more verbose

To make it possible to later remove the handling of --abort from
git-rebase--interactive.sh, align the implementation in git-rebase.sh
with the former by making it a bit more verbose.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: align variable namesMartin von Zweigbergk Sun, 6 Feb 2011 18:43:50 +0000 (13:43 -0500)

rebase -i: align variable names

Rename variables HEAD and OLDHEAD to orig_head and HEADNAME to
head_name, which are the names used in git-rebase.sh. This prepares
for factoring out of the code that persists these variables during the
entire rebase process. Using the same variable names to mean the same
thing in both files also makes the code easier to read.

While at it, also remove the DOTEST variable and use the state_dir
variable that was inherited from git-rebase.sh instead.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: show consistent conflict resolution hintMartin von Zweigbergk Sun, 6 Feb 2011 18:43:49 +0000 (13:43 -0500)

rebase: show consistent conflict resolution hint

When rebase stops due to conflict, interactive rebase currently
displays a different hint to the user than non-interactive rebase
does. Use the same message for both types of rebase.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: extract am code to new source fileMartin von Zweigbergk Sun, 6 Feb 2011 18:43:48 +0000 (13:43 -0500)

rebase: extract am code to new source file

Extract the code for am-based rebase to git-rebase--am.sh.

Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: extract merge code to new source fileMartin von Zweigbergk Sun, 6 Feb 2011 18:43:47 +0000 (13:43 -0500)

rebase: extract merge code to new source file

Extract the code for merge-based rebase to git-rebase--merge.sh.

Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: remove $branch as synonym for $orig_headMartin von Zweigbergk Sun, 6 Feb 2011 18:43:46 +0000 (13:43 -0500)

rebase: remove $branch as synonym for $orig_head

The variables $branch and $orig_head were used as synonyms. To avoid
confusion, remove $branch. The name 'orig_head' seems more suitable,
since that is the name used when the variable is persisted.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: support --statMartin von Zweigbergk Sun, 6 Feb 2011 18:43:45 +0000 (13:43 -0500)

rebase -i: support --stat

Move up the code that displays the diffstat if '--stat' is passed, so
that it will be executed before calling git-rebase--interactive.sh.

A side effect is that the diffstat is now displayed before "First,
rewinding head to replay your work on top of it...".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: factor out call to pre-rebase hookMartin von Zweigbergk Sun, 6 Feb 2011 18:43:44 +0000 (13:43 -0500)

rebase: factor out call to pre-rebase hook

Remove the call to the pre-rebase hook from
git-rebase--interactive.sh and rely on the call in
git-rebase.sh.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: factor out clean work tree checkMartin von Zweigbergk Sun, 6 Feb 2011 18:43:43 +0000 (13:43 -0500)

rebase: factor out clean work tree check

Remove the check for clean work tree from git-rebase--interactive.sh and
rely on the check in git-rebase.sh.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: factor out reference parsingMartin von Zweigbergk Sun, 6 Feb 2011 18:43:42 +0000 (13:43 -0500)

rebase: factor out reference parsing

Remove the parsing and validation of references (onto, upstream, branch)
from git-rebase--interactive.sh and rely on the information exported from
git-rebase.sh.

By using the parsing of the --onto parameter in git-rebase.sh, this
improves the error message when the parameter is invalid.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: reorder validation stepsMartin von Zweigbergk Sun, 6 Feb 2011 18:43:41 +0000 (13:43 -0500)

rebase: reorder validation steps

Reorder validation steps in preparation for the validation to be factored
out from git-rebase--interactive.sh into git-rebase.sh.

The main functional difference is that the pre-rebase hook will no longer
be run if the work tree is dirty.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: remove now unnecessary directory checksMartin von Zweigbergk Sun, 6 Feb 2011 18:43:40 +0000 (13:43 -0500)

rebase -i: remove now unnecessary directory checks

Remove directory checks from git-rebase--interactive.sh that are done in
git-rebase.sh.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: factor out command line option processingMartin von Zweigbergk Sun, 6 Feb 2011 18:43:39 +0000 (13:43 -0500)

rebase: factor out command line option processing

Factor out the command line processing in git-rebase--interactive.sh
to git-rebase.sh. Store the options in variables in git-rebase.sh and
then source git-rebase--interactive.sh.

Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>