gitweb.git
Clean up find_unique_abbrev() callersJunio C Hamano Sun, 2 Mar 2008 07:43:32 +0000 (23:43 -0800)

Clean up find_unique_abbrev() callers

Now find_unique_abbrev() never returns NULL, there is no need for callers
to prepare for seeing NULL and fall back to giving the full 40-hexdigits.

While we are at it, drop "..." in the "git reset" output that reports the
location of the new HEAD, between the abbreviated commit object name and
the one line commit summary. Because we are always showing the HEAD
(which cannot be missing!), we never had a case where we show the full 40
hexdigits that is not followed by three dots, and these three dots were
stealing 3 columns from the precious horizontal screen real estate out of
80 that can better be used for the one line commit summary.

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

find_unique_abbrev(): redefine semanticsJunio C Hamano Sun, 2 Mar 2008 07:35:32 +0000 (23:35 -0800)

find_unique_abbrev(): redefine semantics

The function returned NULL when no object that matches the name
was found, but that made the callers more complicated, as nobody
used that NULL return as an indication that no object with such
a name exists. They (at least the careful ones) instead took
the full 40-hexdigit and used in such a case, and the careless
ones segfaulted.

With this "git rev-parse --short 5555555555555555555555555555555555555555"
would stop segfaulting.

This is based on Jeff King's rewrite to my RFC patch, but "missing"
logic swapped to "exists". The final logic reads:

For existing objects, make sure the abbreviated string uniquely
identifies it. Otherwise, make sure the abbreviated string is
long enough so that it would not name any existing object.

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

git rebase --abort: always restore the right commitMike Hommey Sat, 1 Mar 2008 10:32:14 +0000 (11:32 +0100)

git rebase --abort: always restore the right commit

Previously, --abort would end by git resetting to ORIG_HEAD, but some
commands, such as git reset --hard (which happened in git rebase --skip,
but could just as well be typed by the user), would have already modified
ORIG_HEAD.

Just use the orig-head we store in $dotest instead.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-rebase.txt: Add --strategy to synopsysMike Hommey Sat, 1 Mar 2008 11:39:52 +0000 (12:39 +0100)

Documentation/git-rebase.txt: Add --strategy to synopsys

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

CodingGuidelines: spell out how we use grep in our... Junio C Hamano Sun, 2 Mar 2008 02:18:16 +0000 (18:18 -0800)

CodingGuidelines: spell out how we use grep in our scripts

Our scripts try to stick to fairly limited subset of POSIX BRE for
portability. It is unclear from manual page from GNU grep which is GNU
extension and which is portable, so let's spell it out to help new people
to keep their contributions from hurting porters.

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

allow git-am to run in a subdirectoryJeff King Sat, 1 Mar 2008 06:22:55 +0000 (01:22 -0500)

allow git-am to run in a subdirectory

We just move to the top of the tree and proceed. This
shouldn't break any existing callers, since the behavior was
previously disallowed.

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

rename: warn user when we have turned off rename detectionJeff King Sat, 1 Mar 2008 06:14:31 +0000 (01:14 -0500)

rename: warn user when we have turned off rename detection

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

Add test for git rebase --abortMike Hommey Fri, 29 Feb 2008 22:08:47 +0000 (23:08 +0100)

Add test for git rebase --abort

We expect git rebase --abort to come back to the original (pre-rebase)
head, independently from when it's run during a rebase.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6024: move "git reset" to prepare for a test inside... Junio C Hamano Sat, 1 Mar 2008 09:10:12 +0000 (01:10 -0800)

t6024: move "git reset" to prepare for a test inside the test itself

Noticed by Mike Hommey.

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

gc: Add --quiet optionFrank Lichtenheld Fri, 29 Feb 2008 21:53:39 +0000 (22:53 +0100)

gc: Add --quiet option

Pass -q option to git-repack.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'master' of git://repo.or.cz/git-guiJunio C Hamano Sat, 1 Mar 2008 05:22:52 +0000 (21:22 -0800)

Merge branch 'master' of git://repo.or.cz/git-gui

* 'master' of git://repo.or.cz/git-gui:
git-gui: fix typo in lib/spellcheck.tcl
git-gui: Shorten Aspell version strings to just Aspell version number
git-gui: Gracefully display non-aspell version errors to users
git-gui: Catch and display aspell startup failures to the user
git-gui: Only bind the spellcheck popup suggestion hook once
git-gui: Remove explicit references to 'aspell' in message strings
git-gui: Ensure all spellchecker 'class' variables are initialized
git-gui: Update German translation.
git-gui: (i18n) Add newly added translation strings to template.

Merge branch 'maint'Junio C Hamano Sat, 1 Mar 2008 05:22:31 +0000 (21:22 -0800)

Merge branch 'maint'

* maint:
Documentation cherry-pick: Fix cut-and-paste error
git.el: find the git-status buffer whatever its name is
git-gui: Paper bag fix info dialog when no files are staged at commit

Documentation cherry-pick: Fix cut-and-paste errorMike Ralphson Fri, 29 Feb 2008 17:00:38 +0000 (17:00 +0000)

Documentation cherry-pick: Fix cut-and-paste error

Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git.el: find the git-status buffer whatever its name isRémi Vanicat Fri, 29 Feb 2008 18:28:19 +0000 (19:28 +0100)

git.el: find the git-status buffer whatever its name is

git-status used the buffer name to find git-status buffers, and that
can fail if the buffer has another name, for example when multiple
working directories is tracked.

Signed-off-by: Rémi Vanicat <vanicat@debian.org>
Acked-by: Alexandre Julliard <julliard@winehq.org>
Tested-by: Xavier Maillard <xma@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint' of git://repo.or.cz/git-gui into... Junio C Hamano Sat, 1 Mar 2008 05:19:43 +0000 (21:19 -0800)

Merge branch 'maint' of git://repo.or.cz/git-gui into maint

* 'maint' of git://repo.or.cz/git-gui:
git-gui: Paper bag fix info dialog when no files are staged at commit

clone: support cloning full bundlesSanti Béjar Fri, 29 Feb 2008 19:16:19 +0000 (20:16 +0100)

clone: support cloning full bundles

The "humanish" part of a bundle is made removing the ".bundle" suffix.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes for 1.5.5Junio C Hamano Thu, 28 Feb 2008 07:39:47 +0000 (23:39 -0800)

Update draft release notes for 1.5.5

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

use build-time SHELL_PATH in test scriptsJeff King Sun, 24 Feb 2008 19:40:45 +0000 (14:40 -0500)

use build-time SHELL_PATH in test scripts

The top-level Makefile now creates a GIT-BUILD-OPTIONS file
which stores any options selected by the make process that
may be of use to further parts of the build process.
Specifically, we store the SHELL_PATH so that it can be used
by tests to construct shell scripts on the fly.

The format of the GIT-BUILD-OPTIONS file is Bourne shell,
and it is sourced by test-lib.sh; all tests can rely on just
having $SHELL_PATH correctly set in the environment.

The GIT-BUILD-OPTIONS file is written every time the
toplevel 'make' is invoked. Since the only users right now
are the test scripts, there's no drawback to updating its
timestamp. If something build-related depends on this, we
can do a trick similar to the one used by GIT-CFLAGS.

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

Write index file on any checkout of filesDaniel Barkalow Thu, 28 Feb 2008 21:52:44 +0000 (16:52 -0500)

Write index file on any checkout of files

We need to rewrite the index file when we check out files, even if we
haven't modified the blob info by reading from another tree, so that
we get the stat cache to include the fact that we just modified the
file so it doesn't need to be refreshed.

While we're at it, move everything that needs to be done to check out
some paths from a tree (or the current index) into checkout_paths().

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list: add --branches, --tags and --remotesUwe Kleine-König Thu, 28 Feb 2008 07:24:25 +0000 (08:24 +0100)

rev-list: add --branches, --tags and --remotes

These flags are already known to rev-parse and have the same meaning.

This patch allows to run gitk as follows:

gitk --branches --not --remotes

to show only your local work.

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Improve t6029 to check the real "subtree" caseMiklos Vajna Thu, 28 Feb 2008 12:36:54 +0000 (13:36 +0100)

Improve t6029 to check the real "subtree" case

t6029 already checks if subtree available and works like recursive. This
patch adds code to test test the extra functionality the subtree merge
strategy provides.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use diff_tree() directly in making cover letterDaniel Barkalow Thu, 28 Feb 2008 17:14:13 +0000 (12:14 -0500)

Use diff_tree() directly in making cover letter

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Always use the current connection's remote ref list... Daniel Barkalow Thu, 28 Feb 2008 16:10:51 +0000 (11:10 -0500)

Always use the current connection's remote ref list in git protocol

We always report to the user the list of refs we got from the first
connection, even if we do multiple connections. But we should always
use each connection's own list of refs in the communication with the
server, in case we got a different server out of DNS rotation or the
timing was surprising or something.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: introduce test_must_failJunio C Hamano Thu, 28 Feb 2008 21:09:30 +0000 (13:09 -0800)

tests: introduce test_must_fail

When we expect a git command to notice and signal errors, we
carelessly wrote in our tests:

test_expect_success 'reject bogus request' '
do something &&
do something else &&
! git command
'

but a non-zero exit could come from the "git command" segfaulting.

A new helper function "tset_must_fail" is introduced and it is
meant to be used to make sure the command gracefully fails (iow,
dying and exiting with non zero status is counted as a failure
to "gracefully fail"). The above example should be written as:

test_expect_success 'reject bogus request' '
do something &&
do something else &&
test_must_fail git command
'

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

Fix builtin checkout crashing when given an invalid... Alex Riesen Thu, 28 Feb 2008 16:30:47 +0000 (17:30 +0100)

Fix builtin checkout crashing when given an invalid path

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Fri, 29 Feb 2008 08:00:09 +0000 (00:00 -0800)

Merge branch 'maint'

* maint:
templates/Makefile: don't depend on local umask setting
Correct name of diff_flush() in API documentation
Start preparing for 1.5.4.4

Conflicts:

RelNotes

templates/Makefile: don't depend on local umask settingGerrit Pape Thu, 28 Feb 2008 18:44:42 +0000 (18:44 +0000)

templates/Makefile: don't depend on local umask setting

Don't take the local umask setting into account when installing the
templates/* files and directories, running 'make install' with umask set
to 077 resulted in template/* installed with permissions 700 and 600.

The problem was discovered by Florian Zumbiehl, reported through
http://bugs.debian.org/467518

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Correct name of diff_flush() in API documentationDaniel Barkalow Thu, 28 Feb 2008 17:24:42 +0000 (12:24 -0500)

Correct name of diff_flush() in API documentation

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Start preparing for 1.5.4.4Junio C Hamano Thu, 28 Feb 2008 07:37:39 +0000 (23:37 -0800)

Start preparing for 1.5.4.4

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

Merge branch 'maint'Shawn O. Pearce Thu, 28 Feb 2008 06:29:19 +0000 (01:29 -0500)

Merge branch 'maint'

* maint:
git-gui: Paper bag fix info dialog when no files are staged at commit

git-gui: Paper bag fix info dialog when no files are... gitgui-0.9.3Shawn O. Pearce Thu, 28 Feb 2008 06:28:45 +0000 (01:28 -0500)

git-gui: Paper bag fix info dialog when no files are staged at commit

If the user tries to commit their changes without actually staging
anything we used to display an informational dialog suggesting they
first stage those changes, then retry the commit feature.

Unfortunately I broke this in aba15f7 ("Ensure error dialogs always
appear over all other windows") and failed to fix it in the paper
bag fix that came one day after it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

format-patch: remove a leftover debugging messageJunio C Hamano Thu, 28 Feb 2008 06:08:57 +0000 (22:08 -0800)

format-patch: remove a leftover debugging message

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

completion: support format-patch's --cover-letter optionJohannes Schindelin Thu, 21 Feb 2008 16:21:49 +0000 (16:21 +0000)

completion: support format-patch's --cover-letter option

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 27 Feb 2008 22:07:51 +0000 (14:07 -0800)

Merge branch 'maint'

* maint:
Eliminate confusing "won't bisect on seeked tree" failure
builtin-reflog.c: don't install new reflog on write failure
send-email: fix In-Reply-To regression
Fix 'git cvsexportcommit -w $cvsdir ...' when used with relative $GIT_DIR
Add testcase for 'git cvsexportcommit -w $cvsdir ...' with relative $GIT_DIR
Prompt to continue when editing during rebase --interactive
Documentation/git svn log: add a note about timezones.
Don't use GIT_CONFIG in t5505-remote

Conflicts:

t/t9001-send-email.sh
t/t9200-git-cvsexportcommit.sh

Merge branch 'git-p4' of git://repo.or.cz/git/git-p4Junio C Hamano Wed, 27 Feb 2008 21:56:42 +0000 (13:56 -0800)

Merge branch 'git-p4' of git://repo.or.cz/git/git-p4

* 'git-p4' of git://repo.or.cz/git/git-p4:
git-p4: Support usage of perforce client spec
git-p4: git-p4 submit cleanups.
git-p4: Removed git-p4 submit --direct.
git-p4: Clean up git-p4 submit's log message handling.
git-p4: Remove --log-substitutions feature.
git-p4: support exclude paths

Eliminate confusing "won't bisect on seeked tree" failureCarl Worth Sun, 24 Feb 2008 01:14:17 +0000 (17:14 -0800)

Eliminate confusing "won't bisect on seeked tree" failure

This error message is very confusing---it doesn't tell the user
anything about how to fix the situation. And the actual fix
for the situation ("git bisect reset") does a checkout of a
potentially random branch, (compared to what the user wants to
be on for the bisect she is starting).

The simplest way to eliminate the confusion is to just make
"git bisect start" do the cleanup itself. There's no significant
loss of safety here since we already have a general safety in
the form of the reflog.

Note: We preserve the warning for any cogito users. We do this
by switching from .git/head-name to .git/BISECT_START for the
extra state, (which is a more descriptive name anyway).

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-reflog.c: don't install new reflog on write... Brandon Casey Fri, 22 Feb 2008 18:47:08 +0000 (12:47 -0600)

builtin-reflog.c: don't install new reflog on write failure

When expiring reflog entries, a new temporary log is written which contains
only the entries to retain. After it is written, it is renamed to replace
the existing reflog. Currently, we check that writing of the new log is
successful and print a message on failure, but the original reflog is still
replaced with the new reflog even on failure. This patch causes the
original reflog to be retained if we fail when writing the new reflog.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: fix In-Reply-To regressionJay Soffian Fri, 22 Feb 2008 00:16:04 +0000 (19:16 -0500)

send-email: fix In-Reply-To regression

Fix a regression introduced by

1ca3d6e (send-email: squelch warning due to comparing undefined $_ to "")

where if the user was prompted for an initial In-Reply-To and didn't
provide one, messages would be sent out with an invalid In-Reply-To of
"<>"

Also add test cases for the regression and the fix. A small modification
was needed to allow send-email to take its replies from stdin if the
environment variable GIT_SEND_EMAIL_NOTTY is set.

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

git-svn: Don't prompt for client cert password everytime.Sebastian Noack Mon, 25 Feb 2008 14:56:28 +0000 (15:56 +0100)

git-svn: Don't prompt for client cert password everytime.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git.el: Do not display empty directories.Alexandre Julliard Fri, 22 Feb 2008 15:48:53 +0000 (16:48 +0100)

git.el: Do not display empty directories.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Tested-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jm/free'Junio C Hamano Wed, 27 Feb 2008 21:03:50 +0000 (13:03 -0800)

Merge branch 'jm/free'

* jm/free:
Avoid unnecessary "if-before-free" tests.

Conflicts:

builtin-branch.c

Merge branch 'js/branch-track'Junio C Hamano Wed, 27 Feb 2008 21:02:57 +0000 (13:02 -0800)

Merge branch 'js/branch-track'

* js/branch-track:
doc: documentation update for the branch track changes
branch: optionally setup branch.*.merge from upstream local branches

Conflicts:

Documentation/config.txt
Documentation/git-branch.txt
Documentation/git-checkout.txt
builtin-branch.c
cache.h
t/t7201-co.sh

Merge branch 'db/checkout'Junio C Hamano Wed, 27 Feb 2008 20:53:26 +0000 (12:53 -0800)

Merge branch 'db/checkout'

* db/checkout: (21 commits)
checkout: error out when index is unmerged even with -m
checkout: show progress when checkout takes long time while switching branches
Add merge-subtree back
checkout: updates to tracking report
builtin-checkout.c: Remove unused prefix arguments in switch_branches path
checkout: work from a subdirectory
checkout: tone down the "forked status" diagnostic messages
Clean up reporting differences on branch switch
builtin-checkout.c: fix possible usage segfault
checkout: notice when the switched branch is behind or forked
Build in checkout
Move code to clean up after a branch change to branch.c
Library function to check for unmerged index entries
Use diff -u instead of diff in t7201
Move create_branch into a library file
Build-in merge-recursive
Add "skip_unmerged" option to unpack_trees.
Discard "deleted" cache entries after using them to update the working tree
Send unpack-trees debugging output to stderr
Add flag to make unpack_trees() not print errors.
...

Conflicts:

Makefile

Merge branch 'db/cover-letter'Junio C Hamano Wed, 27 Feb 2008 20:06:41 +0000 (12:06 -0800)

Merge branch 'db/cover-letter'

* db/cover-letter:
Improve collection of information for format-patch --cover-letter
Add API access to shortlog
t4014: Replace sed's non-standard 'Q' by standard 'q'
Support a --cc=<email> option in format-patch
Combine To: and Cc: headers
Fix format.headers not ending with a newline
Add tests for extra headers in format-patch
Add a --cover-letter option to format-patch
Export some email and pretty-printing functions
Improve message-id generation flow control for format-patch
Add more tests for format-patch

Conflicts:

builtin-log.c
builtin-shortlog.c
pretty.c

Merge branch 'js/merge'Junio C Hamano Wed, 27 Feb 2008 19:57:19 +0000 (11:57 -0800)

Merge branch 'js/merge'

* js/merge:
xdl_merge(): introduce XDL_MERGE_ZEALOUS_ALNUM
xdl_merge(): make XDL_MERGE_ZEALOUS output simpler

Merge branch 'cw/bisect'Junio C Hamano Wed, 27 Feb 2008 19:56:08 +0000 (11:56 -0800)

Merge branch 'cw/bisect'

* cw/bisect:
Eliminate confusing "won't bisect on seeked tree" failure

Merge branch 'jk/help-alias'Junio C Hamano Wed, 27 Feb 2008 19:55:43 +0000 (11:55 -0800)

Merge branch 'jk/help-alias'

* jk/help-alias:
help: respect aliases
make alias lookup a public, procedural function
help: use parseopt

Merge branch 'js/run-command'Junio C Hamano Wed, 27 Feb 2008 19:55:32 +0000 (11:55 -0800)

Merge branch 'js/run-command'

* js/run-command:
start_command(), if .in/.out > 0, closes file descriptors, not the callers
start_command(), .in/.out/.err = -1: Callers must close the file descriptor

Merge branch 'jc/diff-relative'Junio C Hamano Wed, 27 Feb 2008 19:55:28 +0000 (11:55 -0800)

Merge branch 'jc/diff-relative'

* jc/diff-relative:
diff --relative: help working in a bare repository
diff --relative: output paths as relative to the current subdirectory

Merge branch 'gp/hash-stdin'Junio C Hamano Wed, 27 Feb 2008 19:55:22 +0000 (11:55 -0800)

Merge branch 'gp/hash-stdin'

* gp/hash-stdin:
hash-object: cleanup handling of command line options

Merge branch 'db/push-single-with-HEAD'Junio C Hamano Wed, 27 Feb 2008 19:54:28 +0000 (11:54 -0800)

Merge branch 'db/push-single-with-HEAD'

* db/push-single-with-HEAD:
Resolve value supplied for no-colon push refspecs

Merge branch 'db/host-alias'Junio C Hamano Wed, 27 Feb 2008 19:54:13 +0000 (11:54 -0800)

Merge branch 'db/host-alias'

* db/host-alias:
url rewriting: take longest and first match
Add support for url aliases in config files
Use ALLOC_GROW in remote.{c,h}

Merge branch 'ae/pack-autothread'Junio C Hamano Wed, 27 Feb 2008 19:54:03 +0000 (11:54 -0800)

Merge branch 'ae/pack-autothread'

* ae/pack-autothread:
Revert "pack-objects: Print a message describing the number of threads for packing"
pack-objects: Print a message describing the number of threads for packing
pack-objects: Add runtime detection of online CPU's

Merge branch 'bc/reflog-fix'Junio C Hamano Wed, 27 Feb 2008 19:53:48 +0000 (11:53 -0800)

Merge branch 'bc/reflog-fix'

* bc/reflog-fix:
builtin-reflog.c: don't install new reflog on write failure

Merge branch 'sp/describe'Junio C Hamano Wed, 27 Feb 2008 19:52:20 +0000 (11:52 -0800)

Merge branch 'sp/describe'

* sp/describe:
Use git-describe --exact-match in bash prompt on detached HEAD
Teach git-describe --exact-match to avoid expensive tag searches
Avoid accessing non-tag refs in git-describe unless --all is requested
Teach git-describe to use peeled ref information when scanning tags
Optimize peel_ref for the current ref of a for_each_ref callback

Fix 'git cvsexportcommit -w $cvsdir ...' when used... Johan Herland Mon, 11 Feb 2008 23:43:41 +0000 (00:43 +0100)

Fix 'git cvsexportcommit -w $cvsdir ...' when used with relative $GIT_DIR

When using the '-w $cvsdir' option to cvsexportcommit, it will chdir into
$cvsdir before executing several other git commands. If $GIT_DIR is set to
a relative path (e.g. '.'), the git commands executed by cvsexportcommit
will naturally fail.

Therefore, ensure that $GIT_DIR is absolute before the chdir to $cvsdir.

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

Add testcase for 'git cvsexportcommit -w $cvsdir .... Johan Herland Wed, 13 Feb 2008 03:11:22 +0000 (04:11 +0100)

Add testcase for 'git cvsexportcommit -w $cvsdir ...' with relative $GIT_DIR

The testcase verifies that 'git cvsexportcommit' functions correctly when
the '-w' option is used, and GIT_DIR is set to a relative path (e.g. '.').

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

Prompt to continue when editing during rebase --interactiveJonathan del Strother Wed, 27 Feb 2008 12:50:22 +0000 (12:50 +0000)

Prompt to continue when editing during rebase --interactive

On hitting an edit point in an interactive rebase, git should prompt
the user to run "git rebase --continue"

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git svn log: add a note about timezones.Miklos Vajna Wed, 27 Feb 2008 13:13:00 +0000 (14:13 +0100)

Documentation/git svn log: add a note about timezones.

git svn log mimics the timezone converting behaviour of svn log, but
this was undocumented.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'js/maint-http-push' into maintJunio C Hamano Wed, 27 Feb 2008 19:09:44 +0000 (11:09 -0800)

Merge branch 'js/maint-http-push' into maint

* js/maint-http-push:
http-push: avoid a needless goto
http-push: do not get confused by submodules
http-push: avoid invalid memory accesses

git-p4: Support usage of perforce client specTor Arvid Lund Mon, 18 Feb 2008 14:22:08 +0000 (15:22 +0100)

git-p4: Support usage of perforce client spec

When syncing, git-p4 will only download files that are included in the active
perforce client spec. This does not change the default behaviour - it requires
that the user either supplies the command line argument --use-client-spec, or
sets the git config option p4.useclientspec to "true".

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>

git-p4: git-p4 submit cleanups.Simon Hausmann Tue, 19 Feb 2008 08:37:16 +0000 (09:37 +0100)

git-p4: git-p4 submit cleanups.

Removed storing the list of commits in a configuration file. We only need the list
of commits at run-time.

Signed-off-by: Simon Hausmann <simon@lst.de>

git-p4: Removed git-p4 submit --direct.Simon Hausmann Tue, 19 Feb 2008 08:33:08 +0000 (09:33 +0100)

git-p4: Removed git-p4 submit --direct.

This feature was originally meant to allow for quicker direct submits into perforce, but
it turns out that it is not actually quicker than doing a git commit and then running
git-p4 submit.

Signed-off-by: Simon Hausmann <simon@lst.de>

git-p4: Clean up git-p4 submit's log message handling.Simon Hausmann Tue, 19 Feb 2008 08:29:06 +0000 (09:29 +0100)

git-p4: Clean up git-p4 submit's log message handling.

Instead of trying to substitute fields in the p4 submit template we now simply
replace the description of the submit with the log message of the git commit.

Signed-off-by: Simon Hausmann <simon@lst.de>

git-p4: Remove --log-substitutions feature.Simon Hausmann Tue, 19 Feb 2008 08:12:29 +0000 (09:12 +0100)

git-p4: Remove --log-substitutions feature.

This turns out to be rarely useful and is already covered by git's commit.template configuration variable.

Signed-off-by: Simon Hausmann <simon@lst.de>

git-p4: support exclude pathsTommy Thorn Sun, 3 Feb 2008 18:38:51 +0000 (10:38 -0800)

git-p4: support exclude paths

Teach git-p4 about the -/ option which adds depot paths to the exclude
list, used when cloning. The option is chosen such that the natural
Perforce syntax works, eg:

git p4 clone //branch/path/... -//branch/path/{large,old}/...

Trailing ... on exclude paths are optional.

This is a generalization of a change by Dmitry Kakurin (thanks).

Signed-off-by: Tommy Thorn <tommy-git@thorn.ws>
Signed-off-by: Simon Hausmann <simon@lst.de>

Don't use GIT_CONFIG in t5505-remoteDaniel Barkalow Tue, 26 Feb 2008 22:15:31 +0000 (17:15 -0500)

Don't use GIT_CONFIG in t5505-remote

For some reason, t5505-remote was setting GIT_CONFIG to .git/config
and exporting it. This should have been no-op, as test framework did
the same for a long time anyway.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add '--fixed-strings' option to "git log --grep" and... Jakub Narebski Tue, 26 Feb 2008 12:22:05 +0000 (13:22 +0100)

Add '--fixed-strings' option to "git log --grep" and friends

Add support for -F | --fixed-strings option to "git log --grep"
and friends: "git log --author", "git log --committer=<pattern>".
Code is based on implementation of this option in "git grep".

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Revert "pack-objects: Print a message describing the... Junio C Hamano Wed, 27 Feb 2008 07:27:31 +0000 (23:27 -0800)

Revert "pack-objects: Print a message describing the number of threads for packing"

This reverts commit 6c723f5e6bc579e06a904874f1ceeb8ff2b5a17c.
The additional message may be interesting for git developers,
but not useful for the end users, and clutters the output.

git-apply --whitespace=fix: fix off by one thinkoJunio C Hamano Tue, 26 Feb 2008 20:24:40 +0000 (12:24 -0800)

git-apply --whitespace=fix: fix off by one thinko

When a patch adds a whitespace followed by end-of-line, the
trailing whitespace error was detected correctly but was not
fixed, due to misconversion in 42ab241 (builtin-apply.c: do not
feed copy_wsfix() leading '+').

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

Merge branch 'maint'Junio C Hamano Tue, 26 Feb 2008 08:14:22 +0000 (00:14 -0800)

Merge branch 'maint'

* maint:
Documentation/git-am.txt: Pass -r in the example invocation of rm -f .dotest
timezone_names[]: fixed the tz offset for New Zealand.
filter-branch documentation: non-zero exit status in command abort the filter
rev-parse: fix potential bus error with --parseopt option spec handling
Use a single implementation and API for copy_file()
Documentation/git-filter-branch: add a new msg-filter example
Correct fast-export file mode strings to match fast-import standard

gitweb: Better cutting matched string and its contextJakub Narebski Mon, 25 Feb 2008 20:07:57 +0000 (21:07 +0100)

gitweb: Better cutting matched string and its context

Improve look of commit search output ('search' view) by better cutting
of matched string and its context in match info, as suggested by Junio.
For example, if you are looking for "very long search string" in the
following line:

Could somebody test this with very long search string, and see how

you would now see:

...this with <<very long ... string>>, and see...

instead of:

Could som... <<very long search...>>, and see...

(where <<something>> denotes emphasized / colored fragment; matched
fragment to be more exact).

For this feature, support for fourth [optional] parameter to chop_str
subroutine was added. This fourth parameter is used to denote where
to cut string to make it shorter. chop_str can now cut at the
beginning (from the _left_ side of the string), in the middle
(_center_ of the string), or at the end (from the _right_ side of
the string); cutting from right is the default:

chop_str(somestring, len, slop, 'left') -> ' ...string'
chop_str(somestring, len, slop, 'center') -> 'som ... ing'
chop_str(somestring, len, slop, 'right') -> 'somestr... '

If you want to use default slop (default additional length), use undef
as value for third parameter to chop_str.

While at it, return from chop_str early if given string is so short
that chop_str couldn't shorten it. Simplify also regexp used by
chop_str. Make ellipsis (dots) stick to shortened fragment for
cutting at ends, to better see which part got shortened.

Simplify passing all arguments to chop_str in chop_and_escape_str
subroutine. This was needed to pass additional options to chop_str.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-am.txt: Pass -r in the example invoca... Bryan Donlan Mon, 25 Feb 2008 22:40:19 +0000 (17:40 -0500)

Documentation/git-am.txt: Pass -r in the example invocation of rm -f .dotest

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

timezone_names[]: fixed the tz offset for New Zealand.Steven Drake Tue, 26 Feb 2008 00:45:53 +0000 (13:45 +1300)

timezone_names[]: fixed the tz offset for New Zealand.

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

filter-branch documentation: non-zero exit status in... Caio Marcelo de Oliveira Filho Tue, 26 Feb 2008 02:14:31 +0000 (23:14 -0300)

filter-branch documentation: non-zero exit status in command abort the filter

Since commit 8c1ce0f46b85d40f215084eed7313896300082df filter-branch fails
when a <command> has a non-zero exit status. This commit makes it clear
in the documentation and also fixes the parent-filter example, that was
incorrectly returning non-zero when the commit being tested wasn't the
one to be rewritten.

Signed-off-by: Caio Marcelo de Oliveira Filho <cmarcelo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-parse: fix potential bus error with --parseopt... Jay Soffian Tue, 26 Feb 2008 04:07:39 +0000 (23:07 -0500)

rev-parse: fix potential bus error with --parseopt option spec handling

A non-empty line containing no spaces should be treated by --parseopt as
an option group header, but was causing a bus error. Also added a test
script for rev-parse --parseopt.

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

Improve collection of information for format-patch... Daniel Barkalow Mon, 25 Feb 2008 23:24:17 +0000 (18:24 -0500)

Improve collection of information for format-patch --cover-letter

Use the "boundary" feature to find the origin (or find that there are
multiple origins), and use the actual list of commits to pass to
shortlog.

This makes all cover letter include shortlogs, and all cover letters
for series with a single boundary commit include diffstats (if there
are multiple boundary commits it's unclear what would be meaningful as
a diffstat). Note that the single boundary test is empirical, not
theoretical; even a -2 limiting condition will give a diffstat if there's
only one boundary commit in this particular case.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>

Add API access to shortlogDaniel Barkalow Mon, 25 Feb 2008 23:24:14 +0000 (18:24 -0500)

Add API access to shortlog

Shortlog is gives a pretty simple API for cases where you're already
identifying all of the individual commits. Make this available to
other code instead of requiring them to use the revision API and
command line.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>

Add tests for filesystem challenges (case and unicode... Steffen Prohaska Sun, 24 Feb 2008 17:19:09 +0000 (18:19 +0100)

Add tests for filesystem challenges (case and unicode normalization)

Git has difficulties on file systems that do not properly
distinguish case or modify filenames in unexpected ways. The two
major examples are Windows and Mac OS X. Both systems preserve
case of file names but do not distinguish between filenames that
differ only by case. Simple operations such as "git mv" or
"git merge" can fail unexpectedly. In addition, Mac OS X normalizes
unicode, which make git's life even harder.

This commit adds tests that currently fail but should pass if
file system as decribed above are fully supported. The test need
to be run on Windows and Mac X as they already pass on Linux.

Mitch Tishmack is the original author of the tests for unicode
normalization.

[jc: fixed-up so that it will use test_expect_success to test
on sanely behaving filesystems.]

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use a single implementation and API for copy_file()Daniel Barkalow Mon, 25 Feb 2008 19:24:48 +0000 (14:24 -0500)

Use a single implementation and API for copy_file()

Originally by Kristian Hï¿œgsberg; I fixed the conversion of rerere, which
had a different API.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-filter-branch: add a new msg-filter... Miklos Vajna Mon, 25 Feb 2008 14:43:53 +0000 (15:43 +0100)

Documentation/git-filter-branch: add a new msg-filter example

There were no example on how to edit commit messages, so add an msg-filter
example.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

url rewriting: take longest and first matchJunio C Hamano Mon, 25 Feb 2008 06:25:04 +0000 (22:25 -0800)

url rewriting: take longest and first match

Earlier we had a cop-out in the documentation to make the
behaviour "undefined" if configuration had more than one
insteadOf that would match the target URL, like this:

[url "git://git.or.cz/"]
insteadOf = "git.or.cz:" ; (1)
insteadOf = "repo.or.cz:" ; (2)
[url "/local/mirror/"]
insteadOf = "git.or.cz:myrepo" ; (3)
insteadOf = "repo.or.cz:" ; (4)

It would be most natural to take the longest and first match, i.e.

- rewrite "git.or.cz:frotz" to "git://git.or.cz/frotz" by using
(1),

- rewrite "git.or.cz:myrepo/xyzzy" to "/local/mirror/xyzzy" by favoring
(3) over (1), and

- rewrite "repo.or.cz:frotz" to "git://git.or.cz/frotz" by
favoring (2) over (4).

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

Correct fast-export file mode strings to match fast... Shawn O. Pearce Mon, 25 Feb 2008 03:57:29 +0000 (22:57 -0500)

Correct fast-export file mode strings to match fast-import standard

The fast-import file format does not expect leading '0' in front
of a file mode; that is we want '100644' and '0100644'.

Thanks to Ian Clatworthy of the Bazaar project for noticing the
difference in output/input.

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

Add support for url aliases in config filesDaniel Barkalow Wed, 20 Feb 2008 18:43:53 +0000 (13:43 -0500)

Add support for url aliases in config files

This allows users with different preferences for access methods to the
same remote repositories to rewrite each other's URLs by pattern
matching across a large set of similiarly set up repositories to each
get the desired access.

For example, if you don't have a kernel.org account, you might want
settings like:

[url "git://git.kernel.org/pub/"]
insteadOf = master.kernel.org:/pub

Then, if you give git a URL like:

master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git

it will act like you gave it:

git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git

and you can cut-and-paste pull requests in email without fixing them
by hand, for example.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-bundle.txt: Add different strategies to create... Santi Béjar Sun, 24 Feb 2008 13:42:40 +0000 (14:42 +0100)

git-bundle.txt: Add different strategies to create the bundle

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-for-each-ref.c: fix typo in error messageMichele Ballabio Sun, 24 Feb 2008 23:16:04 +0000 (00:16 +0100)

builtin-for-each-ref.c: fix typo in error message

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

help: respect aliasesJeff King Sun, 24 Feb 2008 22:17:37 +0000 (17:17 -0500)

help: respect aliases

If we have an alias "foo" defined, then the help text for
"foo" (via "git help foo" or "git foo --help") now shows the
definition of the alias.

Before showing an alias definition, we make sure that there
is no git command which would override the alias (so that
even though you may have a "log" alias, even though it will
not work, we don't want to it supersede "git help log").

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

make alias lookup a public, procedural functionJeff King Sun, 24 Feb 2008 22:17:14 +0000 (17:17 -0500)

make alias lookup a public, procedural function

This converts git_config_alias to the public alias_lookup
function. Because of the nature of our config parser, we
still have to rely on setting static data. However, that
interface is wrapped so that you can just say

value = alias_lookup(key);

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

help: use parseoptJeff King Sun, 24 Feb 2008 22:16:55 +0000 (17:16 -0500)

help: use parseopt

This patch converts cmd_help to use parseopt, along with a
few style cleanups, including:

- enum constants are now ALL_CAPS

- parse_help_format returns an enum value rather than
setting a global as a side effect

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

send-email: test compose functionalityJeff King Sun, 24 Feb 2008 21:04:14 +0000 (16:04 -0500)

send-email: test compose functionality

This is just a basic sanity check that --compose works at
all.

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

t9001: enhance fake sendmail test harnessJeff King Sun, 24 Feb 2008 21:03:52 +0000 (16:03 -0500)

t9001: enhance fake sendmail test harness

Previously, the fake.sendmail test harness would write its
output to a hardcoded file, allowing only a single message
to be tested. Instead, let's have it save the messages for
all of its invocations so that we can see which messages
were sent, and in which order.

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

Merge branch 'lt/dirstat'Junio C Hamano Mon, 25 Feb 2008 02:14:53 +0000 (18:14 -0800)

Merge branch 'lt/dirstat'

* lt/dirstat:
diff --dirstat: saner handling of binary and unmerged files
Add "--dirstat" for some directory statistics

Eliminate confusing "won't bisect on seeked tree" failureCarl Worth Sun, 24 Feb 2008 01:14:17 +0000 (17:14 -0800)

Eliminate confusing "won't bisect on seeked tree" failure

This error message is very confusing---it doesn't tell the user
anything about how to fix the situation. And the actual fix
for the situation ("git bisect reset") does a checkout of a
potentially random branch, (compared to what the user wants to
be on for the bisect she is starting).

The simplest way to eliminate the confusion is to just make
"git bisect start" do the cleanup itself. There's no significant
loss of safety here since we already have a general safety in
the form of the reflog.

Note: We preserve the warning for any cogito users. We do this
by switching from .git/head-name to .git/BISECT_START for the
extra state, (which is a more descriptive name anyway).

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff --dirstat: saner handling of binary and unmerged... Junio C Hamano Mon, 25 Feb 2008 01:37:15 +0000 (17:37 -0800)

diff --dirstat: saner handling of binary and unmerged files

We do not account binary nor unmerged files when --shortstat is
asked for (or the summary stat at the end of --stat).

The new option --dirstat should work the same way as it is about
summarizing the changes of multiple files by adding them up.

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

Merge branch 'jc/apply-whitespace'Junio C Hamano Mon, 25 Feb 2008 01:23:17 +0000 (17:23 -0800)

Merge branch 'jc/apply-whitespace'

* jc/apply-whitespace:
ws_fix_copy(): move the whitespace fixing function to ws.c
apply: do not barf on patch with too large an offset
core.whitespace: cr-at-eol
git-apply --whitespace=fix: fix whitespace fuzz introduced by previous run
builtin-apply.c: pass ws_rule down to match_fragment()
builtin-apply.c: move copy_wsfix() function a bit higher.
builtin-apply.c: do not feed copy_wsfix() leading '+'
builtin-apply.c: simplify calling site to apply_line()
builtin-apply.c: clean-up apply_one_fragment()
builtin-apply.c: mark common context lines in lineinfo structure.
builtin-apply.c: optimize match_beginning/end processing a bit.
builtin-apply.c: make it more line oriented
builtin-apply.c: push match-beginning/end logic down
builtin-apply.c: restructure "offset" matching
builtin-apply.c: refactor small part that matches context

Use git-describe --exact-match in bash prompt on detach... Shawn O. Pearce Sun, 24 Feb 2008 08:07:33 +0000 (03:07 -0500)

Use git-describe --exact-match in bash prompt on detached HEAD

Most of the time when I am on a detached HEAD and I am not doing
a rebase or bisect operation the working directory is sitting on a
tagged release of the repository. Showing the tag name instead of
the commit SHA-1 is much more descriptive and a much better reminder
of the state of this working directory.

Now that git-describe --exact-match is available as a cheap means
of obtaining the exact annotated tag or nothing at all, we can
favor the annotated tag name over the abbreviated commit SHA-1.

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

Teach git-describe --exact-match to avoid expensive... Shawn O. Pearce Sun, 24 Feb 2008 08:07:31 +0000 (03:07 -0500)

Teach git-describe --exact-match to avoid expensive tag searches

Sometimes scripts want (or need) the annotated tag name that exactly
matches a specific commit, or no tag at all. In such cases it can be
difficult to determine if the output of `git describe $commit` is a
real tag name or a tag+abbreviated commit. A common idiom is to run
git-describe twice:

if test $(git describe $commit) = $(git describe --abbrev=0 $commit)
...

but this is a huge waste of time if the caller is just going to pick a
different method to describe $commit or abort because it is not exactly
an annotated tag.

Setting the maximum number of candidates to 0 allows the caller to ask
for only a tag that directly points at the supplied commit, or to have
git-describe abort if no such item exists.

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

Avoid accessing non-tag refs in git-describe unless... Shawn O. Pearce Sun, 24 Feb 2008 08:07:28 +0000 (03:07 -0500)

Avoid accessing non-tag refs in git-describe unless --all is requested

If we aren't going to use a ref there is no reason for us to open
its object from the object database. This avoids opening any of
the head commits reachable from refs/heads/ unless they are also
reachable through the commit we have been asked to describe and
we need to walk through it to find a tag.

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

Teach git-describe to use peeled ref information when... Shawn O. Pearce Sun, 24 Feb 2008 08:07:25 +0000 (03:07 -0500)

Teach git-describe to use peeled ref information when scanning tags

By using the peeled ref information inside of the packed-refs file we
can avoid opening tag objects to obtain the commits they reference.
This speeds up git-describe when there are a large number of tags
in the repository as we have less objects to parse before we can
start commit matching.

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

Optimize peel_ref for the current ref of a for_each_ref... Shawn O. Pearce Sun, 24 Feb 2008 08:07:22 +0000 (03:07 -0500)

Optimize peel_ref for the current ref of a for_each_ref callback

Currently the only caller of peel_ref is show-ref, which is using
this function to show the peeled tag information if it is available
from an existing packed-refs file. The call happens during the
for_each_ref callback function, so we have the proper struct ref_list
already on the call stack but it is not easily available to return
the peeled information to the caller.

We now save the current struct ref_list item before calling back
into the callback function so that future calls to peel_ref from
within the callback function can quickly access the current ref.
Doing so will save us an lstat() per ref processed as we no longer
have to check the filesystem to see if the ref exists as a loose
file or is packed. This current ref caching also saves a linear
scan of the cached packed refs list.

As a micro-optimization we test the address of the passed ref name
against the current_ref->name before we go into the much more costly
strcmp(). Nearly any caller of peel_ref will be passing us the same
string do_for_each_ref passed them, which is current_ref->name.

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