gitweb.git
Merge branch 'fc/trivial'Junio C Hamano Wed, 6 Nov 2013 22:34:43 +0000 (14:34 -0800)

Merge branch 'fc/trivial'

A random collection of style fixes and minor doc updates.

* fc/trivial:
setup: trivial style fixes
run-command: trivial style fixes
diff: trivial style fix
revision: trivial style fixes
pretty: trivial style fix
describe: trivial style fixes
transport-helper: trivial style fix
sha1-name: trivial style cleanup
branch: trivial style fix
revision: add missing include
doc/pull: clarify the illustrations
t: replace pulls with merges
merge: simplify ff-only option

sha1_loose_object_info(): do not return success on... Junio C Hamano Wed, 6 Nov 2013 18:00:57 +0000 (10:00 -0800)

sha1_loose_object_info(): do not return success on missing object

Since 052fe5ea (sha1_loose_object_info: make type lookup optional,
2013-07-12), sha1_loose_object_info() returns happily without
checking if the object in question exists, which is not what the the
caller sha1_object_info_extended() expects; the caller does not even
bother checking the existence of the object itself.

Noticed-by: Sven Brauch <svenbrauch@googlemail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.5Junio C Hamano Mon, 4 Nov 2013 23:05:08 +0000 (15:05 -0800)

Update draft release notes to 1.8.5

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

Merge branch 'bw/solaris-sed-tr-test-portability'Junio C Hamano Mon, 4 Nov 2013 22:58:19 +0000 (14:58 -0800)

Merge branch 'bw/solaris-sed-tr-test-portability'

* bw/solaris-sed-tr-test-portability:
t4015: simplify sed command that is not even seen by sed
Avoid difference in tr semantics between System V and BSD
Change sed i\ usage to something Solaris' sed can handle

Merge branch 'vd/doc-unpack-objects'Junio C Hamano Mon, 4 Nov 2013 22:58:15 +0000 (14:58 -0800)

Merge branch 'vd/doc-unpack-objects'

* vd/doc-unpack-objects:
Documentation: "pack-file" is not literal in unpack-objects
Documentation: restore a space in unpack-objects usage

Merge branch 'jk/duplicate-objects-in-packs'Junio C Hamano Mon, 4 Nov 2013 22:58:10 +0000 (14:58 -0800)

Merge branch 'jk/duplicate-objects-in-packs'

Test fixup to a topic recently graduated.

* jk/duplicate-objects-in-packs:
Fix '\%o' for printf from coreutils

Merge branch 'jk/subtree-install-fix'Junio C Hamano Mon, 4 Nov 2013 22:58:08 +0000 (14:58 -0800)

Merge branch 'jk/subtree-install-fix'

* jk/subtree-install-fix:
subtree: add makefile target for html docs

Merge branch 'ak/cvsserver-stabilize-use-of-hash-keys'Junio C Hamano Mon, 4 Nov 2013 22:58:05 +0000 (14:58 -0800)

Merge branch 'ak/cvsserver-stabilize-use-of-hash-keys'

* ak/cvsserver-stabilize-use-of-hash-keys:
cvsserver: Determinize output to combat Perl 5.18 hash randomization

Merge branch 'jk/wrap-perl-used-in-tests'Junio C Hamano Mon, 4 Nov 2013 22:58:01 +0000 (14:58 -0800)

Merge branch 'jk/wrap-perl-used-in-tests'

* jk/wrap-perl-used-in-tests:
t: use perl instead of "$PERL_PATH" where applicable
t: provide a perl() function which uses $PERL_PATH

Merge branch 'sc/doc-howto-dumb-http'Junio C Hamano Mon, 4 Nov 2013 22:57:57 +0000 (14:57 -0800)

Merge branch 'sc/doc-howto-dumb-http'

* sc/doc-howto-dumb-http:
doc/howto: warn about (dumb)http server document being too old

Merge branch 'jn/test-prereq-perl-doc'Junio C Hamano Mon, 4 Nov 2013 22:57:53 +0000 (14:57 -0800)

Merge branch 'jn/test-prereq-perl-doc'

* jn/test-prereq-perl-doc:
t/README: tests can use perl even with NO_PERL

t1005: add test for "read-tree --reset -u A B"Junio C Hamano Fri, 1 Nov 2013 22:04:08 +0000 (15:04 -0700)

t1005: add test for "read-tree --reset -u A B"

With a conflicted index, this used to give us an error.

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

t1005: reindentJunio C Hamano Fri, 1 Nov 2013 21:55:17 +0000 (14:55 -0700)

t1005: reindent

Just to update the style of this ancient test script to match
our house style.

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

unpack-trees: fix "read-tree -u --reset A B" with confl... Jeff King Sat, 29 Dec 2012 20:51:54 +0000 (15:51 -0500)

unpack-trees: fix "read-tree -u --reset A B" with conflicted index

When we call "read-tree --reset -u HEAD ORIG_HEAD", the first thing we
do with the index is to call read_cache_unmerged. Originally that
would read the index, leaving aside any unmerged entries. However, as
of d1a43f2 (reset --hard/read-tree --reset -u: remove unmerged new
paths, 2008-10-15), it actually creates a new cache entry to serve as
a placeholder, so that we later know to update the working tree.

However, we later noticed that the sha1 of that unmerged entry was
just copied from some higher stage, leaving you with random content in
the index. That was fixed by e11d7b5 ("reset --merge": fix unmerged
case, 2009-12-31), which instead puts the null sha1 into the newly
created entry, and sets a CE_CONFLICTED flag. At the same time, it
teaches the unpack-trees machinery to pay attention to this flag, so
that oneway_merge throws away the current value.

However, it did not update the code paths for twoway_merge, which is
where we end up in the two-way read-tree with --reset. We notice that
the HEAD and ORIG_HEAD versions are the same, and say "oh, we can just
reuse the current version". But that's not true. The current version
is bogus.

Notice this case and make sure we do not keep the bogus entry; either
we do not have that path in the tree we are moving to (i.e. remove
it), or we want to have the cache entry we created for the tree we are
moving to (i.e. resolve by explicitly saying the "newtree" version is
what we want).

[jc: this is from the almost year-old $gmane/212316]

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

t4015: simplify sed command that is not even seen by sedJunio C Hamano Mon, 4 Nov 2013 18:11:15 +0000 (10:11 -0800)

t4015: simplify sed command that is not even seen by sed

Noticed by Andreas Schwab; \<LF> inside a double quotes pair is
eaten by the shell to become an empty string and is not doing
anything.

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

l10n: zh_CN.po: translate 68 messages (2194t0f0u)Jiang Xin Tue, 17 Sep 2013 15:37:05 +0000 (23:37 +0800)

l10n: zh_CN.po: translate 68 messages (2194t0f0u)

Translate 68 new messages came from git.pot update in 727b957
(l10n: git.pot: v1.8.5 round 1 (68 new, 9 removed)).

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

l10n: vi.po (2194t): Update and minor fixTran Ngoc Quan Sat, 2 Nov 2013 06:21:55 +0000 (13:21 +0700)

l10n: vi.po (2194t): Update and minor fix

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>

l10n: git.pot: v1.8.5 round 1 (68 new, 9 removed)Jiang Xin Sat, 2 Nov 2013 00:08:26 +0000 (08:08 +0800)

l10n: git.pot: v1.8.5 round 1 (68 new, 9 removed)

Generate po/git.pot from v1.8.5-rc0-23-gaa27064 for git v1.8.5
l10n round 1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

Documentation: "pack-file" is not literal in unpack... Vivien Didelot Fri, 1 Nov 2013 15:42:43 +0000 (11:42 -0400)

Documentation: "pack-file" is not literal in unpack-objects

Make it clear that "pack-file" is not to be spelled as is in the
unpack-objects usage.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.5Junio C Hamano Fri, 1 Nov 2013 15:14:52 +0000 (08:14 -0700)

Update draft release notes to 1.8.5

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

Merge branch 'sb/refs-code-cleanup'Junio C Hamano Fri, 1 Nov 2013 14:38:58 +0000 (07:38 -0700)

Merge branch 'sb/refs-code-cleanup'

* sb/refs-code-cleanup:
cache: remove unused function 'have_git_dir'
refs: remove unused function invalidate_ref_cache

Merge branch 'rs/web-browse-xdg-open'Junio C Hamano Fri, 1 Nov 2013 14:38:56 +0000 (07:38 -0700)

Merge branch 'rs/web-browse-xdg-open'

* rs/web-browse-xdg-open:
web--browse: Add support for xdg-open

Merge branch 'js/tests-windows-port-fix'Junio C Hamano Fri, 1 Nov 2013 14:38:54 +0000 (07:38 -0700)

Merge branch 'js/tests-windows-port-fix'

* js/tests-windows-port-fix:
tests: undo special treatment of CRLF for Windows
Windows: a test_cmp that is agnostic to random LF <> CRLF conversions
t5300-pack-object: do not compare binary data using test_cmp

Merge branch 'js/test-help-format-windows-port-fix'Junio C Hamano Fri, 1 Nov 2013 14:38:51 +0000 (07:38 -0700)

Merge branch 'js/test-help-format-windows-port-fix'

* js/test-help-format-windows-port-fix:
t3200: do not open a HTML manual page when DEFAULT_MAN_FORMAT is html

Merge branch 'jk/reset-p-current-head-fix'Junio C Hamano Fri, 1 Nov 2013 14:38:49 +0000 (07:38 -0700)

Merge branch 'jk/reset-p-current-head-fix'

"git reset -p HEAD" has codepath to special case it from resetting
to contents of other commits, but recent change broke it.

* jk/reset-p-current-head-fix:
reset: pass real rev name to add--interactive
add-interactive: handle unborn branch in patch mode

Merge branch 'jk/pack-corruption-post-mortem'Junio C Hamano Fri, 1 Nov 2013 14:38:46 +0000 (07:38 -0700)

Merge branch 'jk/pack-corruption-post-mortem'

* jk/pack-corruption-post-mortem:
howto: add article on recovering a corrupted object

Merge branch 'jk/for-each-ref-skip-parsing'Junio C Hamano Fri, 1 Nov 2013 14:38:41 +0000 (07:38 -0700)

Merge branch 'jk/for-each-ref-skip-parsing'

* jk/for-each-ref-skip-parsing:
for-each-ref: avoid loading objects to print %(objectname)

Merge branch 'ap/remote-hg-unquote-cquote'Junio C Hamano Fri, 1 Nov 2013 14:38:35 +0000 (07:38 -0700)

Merge branch 'ap/remote-hg-unquote-cquote'

A fast-import stream expresses a pathname with funny characters by
quoting them in C style; remote-hg remote helper forgot to unquote
such a path.

* ap/remote-hg-unquote-cquote:
remote-hg: unquote C-style paths when exporting

Merge branch 'jl/submodule-mv'Junio C Hamano Fri, 1 Nov 2013 14:38:26 +0000 (07:38 -0700)

Merge branch 'jl/submodule-mv'

Moving a regular file in a repository with a .gitmodules file was
producing a warning 'Could not find section in .gitmodules where
path=<filename>'.

* jl/submodule-mv:
mv: Fix spurious warning when moving a file in presence of submodules

Documentation: restore a space in unpack-objects usageVivien Didelot Thu, 31 Oct 2013 21:41:11 +0000 (17:41 -0400)

Documentation: restore a space in unpack-objects usage

The commit 87b7b84 removed a space in the unpack-objects usage, which
makes the synopsis a bit confusing. This patch simply restores it.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup: trivial style fixesFelipe Contreras Thu, 31 Oct 2013 09:25:46 +0000 (03:25 -0600)

setup: trivial style fixes

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command: trivial style fixesFelipe Contreras Thu, 31 Oct 2013 09:25:45 +0000 (03:25 -0600)

run-command: trivial style fixes

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: trivial style fixFelipe Contreras Thu, 31 Oct 2013 09:25:44 +0000 (03:25 -0600)

diff: trivial style fix

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revision: trivial style fixesFelipe Contreras Thu, 31 Oct 2013 09:25:43 +0000 (03:25 -0600)

revision: trivial style fixes

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pretty: trivial style fixFelipe Contreras Thu, 31 Oct 2013 09:25:42 +0000 (03:25 -0600)

pretty: trivial style fix

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

describe: trivial style fixesFelipe Contreras Thu, 31 Oct 2013 09:25:41 +0000 (03:25 -0600)

describe: trivial style fixes

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport-helper: trivial style fixFelipe Contreras Thu, 31 Oct 2013 09:25:40 +0000 (03:25 -0600)

transport-helper: trivial style fix

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1-name: trivial style cleanupFelipe Contreras Thu, 31 Oct 2013 09:25:39 +0000 (03:25 -0600)

sha1-name: trivial style cleanup

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: trivial style fixFelipe Contreras Thu, 31 Oct 2013 09:25:38 +0000 (03:25 -0600)

branch: trivial style fix

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revision: add missing includeFelipe Contreras Thu, 31 Oct 2013 09:25:36 +0000 (03:25 -0600)

revision: add missing include

Otherwise we might not have 'struct diff_options'.

[jc: needs a matching follow-up patch to remove inclusion of diff.h
from *.c files that do not themselves use anything from diff.h]

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc/pull: clarify the illustrationsJunio C Hamano Thu, 31 Oct 2013 20:43:35 +0000 (13:43 -0700)

doc/pull: clarify the illustrations

The second illustration that shows the history after "git pull"
spelled the remote-tracking branch with "remotes/" prefix, which
is not necessary. Drop it.

To match the assumption that a remote-tracking branch is used to
keep track of the advancement of the master at the origin, update
the first illustration that shows the history before "git pull"
to show the distinction between the master currently at origin and
the stale origin/master remote-tracking branch.

Noticed-by: Felipe Contreras <felipe.contreras@gmail.com>
Helped-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: replace pulls with mergesFelipe Contreras Thu, 31 Oct 2013 09:25:33 +0000 (03:25 -0600)

t: replace pulls with merges

This is what the code intended.

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: simplify ff-only optionFelipe Contreras Thu, 31 Oct 2013 09:25:32 +0000 (03:25 -0600)

merge: simplify ff-only option

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix '\%o' for printf from coreutilsKacper Kornet Thu, 31 Oct 2013 11:51:32 +0000 (12:51 +0100)

Fix '\%o' for printf from coreutils

The printf utility provided by coreutils when interpreting '\%o' format
does not recognize %o as formatting directive. For example
printf '\%o 0 returns \%o and warning: ignoring excess arguments,
starting with ‘0’, which results in failed tests in
t5309-pack-delta-cycles.sh. In most shells the test ends with success as
the printf is a builtin utility.

Fix it by using '\\%o' which is interpreted consistently in all versions
of printf.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

web--browse: Add support for xdg-openRüdiger Sonderfeld Sat, 26 Oct 2013 17:43:54 +0000 (19:43 +0200)

web--browse: Add support for xdg-open

xdg-open is a tool similar to git-web--browse. It opens a file or URL in the
user's preferred application. It could probably be made default at least on
Linux with a graphical environment.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3200: do not open a HTML manual page when DEFAULT_MAN_... Johannes Sixt Sat, 26 Oct 2013 18:48:46 +0000 (20:48 +0200)

t3200: do not open a HTML manual page when DEFAULT_MAN_FORMAT is html

We have the build configuration option DEFAULT_MAN_FORMAT to choose a
format different from man pages to be used by 'git help' when no format
is requested explicitly. Since 65db0443 (Set the default help format to
html for msys builds, 2013-06-04) we use html on Windows by default.

There is one test in t3200-branch.sh that invokes a help page. The
intent of the redirections applied to the command invocation is to avoid
that the man page viewer interferes with the automated test. But when
the default format is not "man", this does not have the intended effect,
and the HTML manual page is opened during the test run. Request "man"
format explicitly to keep the test silent.

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

Git 1.8.5-rc0 v1.8.5-rc0Junio C Hamano Wed, 30 Oct 2013 19:17:47 +0000 (12:17 -0700)

Git 1.8.5-rc0

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

Merge branch 'maint'Junio C Hamano Wed, 30 Oct 2013 19:11:22 +0000 (12:11 -0700)

Merge branch 'maint'

* maint:
t5570: Update for clone-progress-to-stderr branch

Merge branch 'jk/refs-c-squelch-gcc'Junio C Hamano Wed, 30 Oct 2013 19:11:03 +0000 (12:11 -0700)

Merge branch 'jk/refs-c-squelch-gcc'

* jk/refs-c-squelch-gcc:
silence gcc array-bounds warning

Merge branch 'jk/date-c-double-semicolon'Junio C Hamano Wed, 30 Oct 2013 19:11:01 +0000 (12:11 -0700)

Merge branch 'jk/date-c-double-semicolon'

* jk/date-c-double-semicolon:
drop redundant semicolon in empty while

Merge branch 'nd/lift-path-max'Junio C Hamano Wed, 30 Oct 2013 19:10:56 +0000 (12:10 -0700)

Merge branch 'nd/lift-path-max'

* nd/lift-path-max:
checkout_entry(): clarify the use of topath[] parameter
entry.c: convert checkout_entry to use strbuf

Merge branch 'tr/valgrind-test-fix'Junio C Hamano Wed, 30 Oct 2013 19:10:52 +0000 (12:10 -0700)

Merge branch 'tr/valgrind-test-fix'

* tr/valgrind-test-fix:
Revert "test-lib: allow prefixing a custom string before "ok N" etc."
Revert "test-lib: support running tests under valgrind in parallel"

Merge branch 'tr/gitk-doc-update'Junio C Hamano Wed, 30 Oct 2013 19:10:50 +0000 (12:10 -0700)

Merge branch 'tr/gitk-doc-update'

* tr/gitk-doc-update:
Documentation: revamp gitk(1)

Merge branch 'jl/pack-transfer-avoid-double-close'Junio C Hamano Wed, 30 Oct 2013 19:10:45 +0000 (12:10 -0700)

Merge branch 'jl/pack-transfer-avoid-double-close'

The codepath that send_pack() calls pack_objects() mistakenly
closed the same file descriptor twice, leading to potentially
closing a wrong file descriptor that was opened in the meantime.

* jl/pack-transfer-avoid-double-close:
Clear fd after closing to avoid double-close error

Merge branch 'sb/git-svn-docs-indent-with-ht'Junio C Hamano Wed, 30 Oct 2013 19:10:34 +0000 (12:10 -0700)

Merge branch 'sb/git-svn-docs-indent-with-ht'

* sb/git-svn-docs-indent-with-ht:
git-svn docs: Use tabs consistently within the ascii doc

Merge branch 'nd/magic-pathspec'Junio C Hamano Wed, 30 Oct 2013 19:10:29 +0000 (12:10 -0700)

Merge branch 'nd/magic-pathspec'

All callers to parse_pathspec() must choose between getting no
pathspec or one path that is limited to the current directory
when there is no paths given on the command line, but there were
two callers that violated this rule, triggering a BUG().

* nd/magic-pathspec:
Fix calling parse_pathspec with no paths nor PATHSPEC_PREFER_* flags

Merge branch 'nd/gc-lock-against-each-other'Junio C Hamano Wed, 30 Oct 2013 19:10:27 +0000 (12:10 -0700)

Merge branch 'nd/gc-lock-against-each-other'

* nd/gc-lock-against-each-other:
gc: remove gc.pid file at end of execution

Merge branch 'hn/log-graph-color-octopus'Junio C Hamano Wed, 30 Oct 2013 19:10:21 +0000 (12:10 -0700)

Merge branch 'hn/log-graph-color-octopus'

* hn/log-graph-color-octopus:
graph: fix coloring around octopus merges

Merge branch 'mm/checkout-auto-track-fix'Junio C Hamano Wed, 30 Oct 2013 19:10:16 +0000 (12:10 -0700)

Merge branch 'mm/checkout-auto-track-fix'

"git checkout topic", when there is not yet a local "topic" branch
but there is a unique remote-tracking branch for a remote "topic"
branch, pretended as if "git checkout -t -b topic remote/$r/topic"
(for that unique remote $r) was run. This hack however was not
implemented for "git checkout topic --".

* mm/checkout-auto-track-fix:
checkout: proper error message on 'git checkout foo bar --'
checkout: allow dwim for branch creation for "git checkout $branch --"

Merge branch 'sg/t3600-nul-sha1-fix'Junio C Hamano Wed, 30 Oct 2013 19:10:09 +0000 (12:10 -0700)

Merge branch 'sg/t3600-nul-sha1-fix'

* sg/t3600-nul-sha1-fix:
t3600: fix broken "choking git rm" test

Merge branch 'fc/styles'Junio C Hamano Wed, 30 Oct 2013 19:10:06 +0000 (12:10 -0700)

Merge branch 'fc/styles'

C coding style fixes.

* fc/styles:
block-sha1/sha1.c: have SP around arithmetic operators
base85.c: have SP around arithmetic operators
archive.c: have SP around arithmetic operators
alloc.c: have SP around arithmetic operators
abspath.c: have SP around arithmetic operators
alias: have SP around arithmetic operators
C: have space around && and || operators

Merge branch 'jc/upload-pack-send-symref'Junio C Hamano Wed, 30 Oct 2013 19:10:00 +0000 (12:10 -0700)

Merge branch 'jc/upload-pack-send-symref'

One long-standing flaw in the pack transfer protocol used by "git
clone" was that there was no way to tell the other end which branch
"HEAD" points at, and the receiving end needed to guess. A new
capability has been defined in the pack protocol to convey this
information so that cloning from a repository with more than one
branches pointing at the same commit where the HEAD is at now
reliably sets the initial branch in the resulting repository.

* jc/upload-pack-send-symref:
t5570: Update for clone-progress-to-stderr branch
t5570: Update for symref capability
clone: test the new HEAD detection logic
connect: annotate refs with their symref information in get_remote_head()
connect.c: make parse_feature_value() static
upload-pack: send non-HEAD symbolic refs
upload-pack: send symbolic ref information as capability
upload-pack.c: do not pass confusing cb_data to mark_our_ref()
t5505: fix "set-head --auto with ambiguous HEAD" test

Merge branch 'jk/http-auth-redirects'Junio C Hamano Wed, 30 Oct 2013 19:09:53 +0000 (12:09 -0700)

Merge branch 'jk/http-auth-redirects'

Handle the case where http transport gets redirected during the
authorization request better.

* jk/http-auth-redirects:
http.c: Spell the null pointer as NULL
remote-curl: rewrite base url from info/refs redirects
remote-curl: store url as a strbuf
remote-curl: make refs_url a strbuf
http: update base URLs when we see redirects
http: provide effective url to callers
http: hoist credential request out of handle_curl_result
http: refactor options to http_get_*
http_request: factor out curlinfo_strbuf
http_get_file: style fixes

subtree: add makefile target for html docsJeff King Tue, 29 Oct 2013 16:30:37 +0000 (12:30 -0400)

subtree: add makefile target for html docs

The Makefile currently builds the roff manpage, but not the
html form. As some people may prefer the latter, let's make
it an option to build that, too. We also wire it into "make
doc" so that it is built by default.

This patch does not build or install it as part of
"install-doc"; that would require extra infrastructure to
handle installing the html as we do in git's regular
Documentation/ tree. That can come later if somebody is
interested.

Tested-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5570: Update for clone-progress-to-stderr branchBrian Gernhardt Mon, 21 Oct 2013 17:54:12 +0000 (13:54 -0400)

t5570: Update for clone-progress-to-stderr branch

git clone now reports its progress to standard error, which throws off
t5570. Using test_i18ngrep instead of test_cmp allows the test to be
more flexible by only looking for the expected error and ignoring any
other output from the program.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Avoid difference in tr semantics between System V and BSDBen Walton Mon, 28 Oct 2013 21:43:00 +0000 (21:43 +0000)

Avoid difference in tr semantics between System V and BSD

Solaris' tr (both /usr/bin/ and /usr/xpg4/bin) uses the System V
semantics for tr whereby string1's length is truncated to the length
of string2 if string2 is shorter. The BSD semantics, as used by GNU tr
see string2 padded to the length of string1 using the final character
in string2. POSIX explicitly doesn't specify the correct behavior
here, making both equally valid.

This difference means that Solaris' native tr implementations produce
different results for tr ":\t\n" "\0" than GNU tr. This breaks a few
tests in t0008-ignores.sh.

Possible fixes for this are to make string2 be "\0\0\0" or "[\0*]".

Instead, use perl to perform these transliterations which means we
don't need to worry about the difference at all. Since we're replacing
tr with perl, we also use perl to replace the sed invocations used to
transform the files.

Replace four identical transforms with a function named
broken_c_unquote. Replace the other two identical transforms with a
fuction named broken_c_unquote_verbose.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

for-each-ref: avoid loading objects to print %(objectname)Jeff King Wed, 30 Oct 2013 06:50:16 +0000 (02:50 -0400)

for-each-ref: avoid loading objects to print %(objectname)

If you ask for-each-ref to print each ref and its object,
like:

git for-each-ref --format='%(objectname) %(refname)'

this should involve little more work than looking at the ref
files (and packed-refs) themselves. However, for-each-ref
will actually load each object from disk just to print its
sha1. For most repositories, this isn't a big deal, but it
can be noticeable if you have a large number of refs to
print. Here are best-of-five timings for the command above
on a repo with ~10K refs:

[before]
real 0m0.112s
user 0m0.092s
sys 0m0.016s

[after]
real 0m0.014s
user 0m0.012s
sys 0m0.000s

This patch checks for %(objectname) and %(objectname:short)
before we actually parse the object (and the rest of the
code is smart enough to avoid parsing if we have filled all
of our placeholders).

Note that we can't simply move the objectname parsing code
into the early loop. If the "deref" form %(*objectname) is
used, then we do need to parse the object in order to peel
the tag. So instead of moving the code, we factor it out
into a separate function that can be called for both cases.

While we're at it, we add some basic tests for the
dereferenced placeholders, which were not tested at all
before. This helps ensure we didn't regress that case.

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

cvsserver: Determinize output to combat Perl 5.18 hash... Anders Kaseorg Wed, 30 Oct 2013 08:44:43 +0000 (04:44 -0400)

cvsserver: Determinize output to combat Perl 5.18 hash randomization

Perl 5.18 randomizes the seed used by its hash function, so iterating
through hashes results in different orders from run to run:
http://perldoc.perl.org/perl5180delta.html#Hash-overhaul

This usually broke t9400 (gitcvs.dbname, gitcvs.ext.dbname, when
running cmp on two .sqlite files) and t9402 (check [cvswork3] diff,
when running test_cmp on two diffs).

To fix this, hide the internal order of hashes with sort when sending
output or running database queries.

(An alternative workaround is PERL_HASH_SEED=0, but this seems nicer.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: use perl instead of "$PERL_PATH" where applicableJeff King Tue, 29 Oct 2013 01:23:03 +0000 (21:23 -0400)

t: use perl instead of "$PERL_PATH" where applicable

As of the last commit, we can use "perl" instead of
"$PERL_PATH" when running tests, as the former is now a
function which uses the latter. As the shorter "perl" is
easier on the eyes, let's switch to using it everywhere.

This is not quite a mechanical s/$PERL_PATH/perl/
replacement, though. There are some places where we invoke
perl from a script we generate on the fly, and those scripts
do not have access to our internal shell functions. The
result can be double-checked by running:

ln -s /bin/false bin-wrappers/perl
make test

which continues to pass even after this patch.

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

t: provide a perl() function which uses $PERL_PATHJeff King Tue, 29 Oct 2013 01:22:07 +0000 (21:22 -0400)

t: provide a perl() function which uses $PERL_PATH

Once upon a time, we assumed that calling a bare "perl" in
the test scripts was OK, because we would find the perl from
the user's PATH, and we were only asking that perl to do
basic operations that work even on old versions of perl.

Later, we found that some systems really prefer to use
$PERL_PATH even for these basic cases, because the system
perl misbehaves in some way (e.g., by handling line endings
differently). We then switched "perl" invocations to
"$PERL_PATH" to respect the user's choice.

Having to use "$PERL_PATH" is ugly and cumbersome, though.
Instead, let's provide a perl() shell function that tests
can use, which will transparently do the right thing.

Unfortunately, test writers still have to use $PERL_PATH in
certain situations, so we still need to keep the advice in
the README.

Note that this may fix test failures in t5004, t5503, t6002,
t6003, t6300, t8001, and t8002, depending on your system's
perl setup. All of these can be detected by running:

ln -s /bin/false bin-wrappers/perl
make test

which fails before this patch, and passes after.

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

doc/howto: warn about (dumb)http server document being... Sitaram Chamarty Sat, 21 Sep 2013 02:23:06 +0000 (07:53 +0530)

doc/howto: warn about (dumb)http server document being too old

Describe when it is still applicable, and tell people where to go
for most normal cases.

Signed-off-by: Sitaram Chamarty <sitaram@atc.tcs.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/README: tests can use perl even with NO_PERLJonathan Nieder Mon, 28 Oct 2013 19:22:16 +0000 (12:22 -0700)

t/README: tests can use perl even with NO_PERL

The git build system supports a NO_PERL switch to avoid installing
perl bindings or other features (like "git add --patch") that rely on
perl on runtime, but even with NO_PERL it has not been possible for a
long time to run tests without perl. Helpers such as

nul_to_q () {
"$PERL_PATH" -pe 'y/\000/Q/'
}

use perl as a better tr or sed and are regularly used in tests without
worrying to add a PERL prerequisite.

Perl is portable enough that it seems fine to keep relying on it for
this kind of thing in tests (and more readable than the alternative of
trying to find POSIXy equivalents). Update the test documentation to
clarify this.

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

Almost -rc0 for 1.8.5Junio C Hamano Mon, 28 Oct 2013 17:52:07 +0000 (10:52 -0700)

Almost -rc0 for 1.8.5

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

Sync with v1.8.4.2Junio C Hamano Mon, 28 Oct 2013 17:51:53 +0000 (10:51 -0700)

Sync with v1.8.4.2

Merge branch 'sb/repack-in-c'Junio C Hamano Mon, 28 Oct 2013 17:43:41 +0000 (10:43 -0700)

Merge branch 'sb/repack-in-c'

Finishing touches to update documentation.

* sb/repack-in-c:
Reword repack documentation to no longer state it's a script

Merge branch 'sg/prompt-svn-remote-fix'Junio C Hamano Mon, 28 Oct 2013 17:43:38 +0000 (10:43 -0700)

Merge branch 'sg/prompt-svn-remote-fix'

Bash portability fix.

* sg/prompt-svn-remote-fix:
bash prompt: don't use '+=' operator in show upstream code path

Merge branch 'jk/split-broken-ident'Junio C Hamano Mon, 28 Oct 2013 17:43:32 +0000 (10:43 -0700)

Merge branch 'jk/split-broken-ident'

Make the fall-back parsing of commit objects with broken author or
committer lines more robust to pick up the timestamps.

* jk/split-broken-ident:
split_ident: parse timestamp from end of line

Merge branch 'jk/remote-literal-string-leakfix'Junio C Hamano Mon, 28 Oct 2013 17:43:28 +0000 (10:43 -0700)

Merge branch 'jk/remote-literal-string-leakfix'

* jk/remote-literal-string-leakfix:
remote: do not copy "origin" string literal

Merge branch 'ew/keepalive'Junio C Hamano Mon, 28 Oct 2013 17:43:24 +0000 (10:43 -0700)

Merge branch 'ew/keepalive'

* ew/keepalive:
http: use curl's tcp keepalive if available
http: enable keepalive on TCP sockets

Merge branch 'jc/revision-range-unpeel'Junio C Hamano Mon, 28 Oct 2013 17:43:16 +0000 (10:43 -0700)

Merge branch 'jc/revision-range-unpeel'

"git rev-list --objects ^v1.0^ v1.0" gave v1.0 tag itself in the
output, but "git rev-list --objects v1.0^..v1.0" did not.

* jc/revision-range-unpeel:
revision: do not peel tags used in range notation

Merge branch 'jx/relative-path-regression-fix'Junio C Hamano Mon, 28 Oct 2013 17:42:29 +0000 (10:42 -0700)

Merge branch 'jx/relative-path-regression-fix'

* jx/relative-path-regression-fix:
Use simpler relative_path when set_git_dir
relative_path should honor dos-drive-prefix
test: use unambigous leading path (/foo) for MSYS

Git 1.8.4.2 v1.8.4.2Junio C Hamano Mon, 28 Oct 2013 17:21:29 +0000 (10:21 -0700)

Git 1.8.4.2

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

Merge branch 'jk/clone-progress-to-stderr' into maintJunio C Hamano Mon, 28 Oct 2013 17:19:24 +0000 (10:19 -0700)

Merge branch 'jk/clone-progress-to-stderr' into maint

"git clone" gave some progress messages to the standard output, not to
the standard error, and did not allow suppressing them with the
"--no-progress" option.

* jk/clone-progress-to-stderr:
clone: always set transport options
clone: treat "checking connectivity" like other progress
clone: send diagnostic messages to stderr

Merge branch 'jk/format-patch-from' into maintJunio C Hamano Mon, 28 Oct 2013 17:18:43 +0000 (10:18 -0700)

Merge branch 'jk/format-patch-from' into maint

"format-patch --from=<whom>" forgot to omit unnecessary in-body from
line, i.e. when <whom> is the same as the real author.

* jk/format-patch-from:
format-patch: print in-body "From" only when needed

Merge branch 'jk/shortlog-tolerate-broken-commit' into... Junio C Hamano Mon, 28 Oct 2013 17:17:31 +0000 (10:17 -0700)

Merge branch 'jk/shortlog-tolerate-broken-commit' into maint

"git shortlog" used to choke and die when there is a malformed commit
(e.g. missing authors); it now simply ignore such a commit and keeps
going.

* jk/shortlog-tolerate-broken-commit:
shortlog: ignore commits with missing authors

Merge branch 'jk/diff-algo' into maintJunio C Hamano Mon, 28 Oct 2013 17:16:11 +0000 (10:16 -0700)

Merge branch 'jk/diff-algo' into maint

"git merge-recursive" did not parse its "--diff-algorithm=" command
line option correctly.

* jk/diff-algo:
merge-recursive: fix parsing of "diff-algorithm" option

pathspec: stop --*-pathspecs impact on internal parse_p... Nguyễn Thái Ngọc Duy Sat, 26 Oct 2013 02:09:20 +0000 (09:09 +0700)

pathspec: stop --*-pathspecs impact on internal parse_pathspec() uses

Normally parse_pathspec() is used on command line arguments where it
can do fancy thing like parsing magic on each argument or adding magic
for all pathspecs based on --*-pathspecs options.

There's another use of parse_pathspec(), where pathspec is needed, but
the input is known to be pure paths. In this case we usually don't
want --*-pathspecs to interfere. And we definitely do not want to
parse magic in these paths, regardless of --literal-pathspecs.

Add new flag PATHSPEC_LITERAL_PATH for this purpose. When it's set,
--*-pathspecs are ignored, no magic is parsed. And if the caller
allows PATHSPEC_LITERAL (i.e. the next calls can take literal magic),
then PATHSPEC_LITERAL will be set.

This fixes cases where git chokes when GIT_*_PATHSPECS are set because
parse_pathspec() indicates it won't take any magic. But
GIT_*_PATHSPECS add them anyway. These are

export GIT_LITERAL_PATHSPECS=1
git blame -- something
git log --follow something
git log --merge

"git ls-files --with-tree=path" (aka parse_pathspec() in
overlay_tree_on_cache()) is safe because the input is empty, and
producing one pathspec due to PATHSPEC_PREFER_CWD does not take any
magic into account.

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

sha1_file.c:create_tmpfile(): Fix race when creating... Johan Herland Sun, 27 Oct 2013 11:35:43 +0000 (12:35 +0100)

sha1_file.c:create_tmpfile(): Fix race when creating loose object dirs

There are cases (e.g. when running concurrent fetches in a repo) where
multiple Git processes concurrently attempt to create loose objects
within the same objects/XX/ dir. The creation of the loose object files
is (AFAICS) safe from races, but the creation of the objects/XX/ dir in
which the loose objects reside is unsafe, for example:

Two concurrent fetches - A and B. As part of its fetch, A needs to store
12aaaaa as a loose object. B, on the other hand, needs to store 12bbbbb
as a loose object. The objects/12 directory does not already exist.
Concurrently, both A and B determine that they need to create the
objects/12 directory (because their first call to git_mkstemp_mode()
within create_tmpfile() fails witn ENOENT). One of them - let's say A -
executes the following mkdir() call before the other. This first call
returns success, and A moves on. When B gets around to calling mkdir(),
it fails with EEXIST, because A won the race. The mkdir() error causes B
to return -1 from create_tmpfile(), which propagates all the way,
resulting in the fetch failing with:

error: unable to create temporary file: File exists
fatal: failed to write object
fatal: unpack-objects failed

Although it's hard to add a testcase reproducing this issue, it's easy
to provoke if we insert a sleep after the

if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
return -1;

block, and then run two concurrent "git fetch"es against the same repo.

The fix is to simply handle mkdir() failing with EEXIST as a success.
If EEXIST is somehow returned for the wrong reasons (because the relevant
objects/XX is not a directory, or is otherwise unsuitable for object
storage), the following call to adjust_shared_perm(), or ultimately the
retried call to git_mkstemp_mode() will fail, and we end up returning
error from create_tmpfile() in any case.

Note that there are still cases where two users with unsuitable umasks
in a shared repo can end up in two races where one user first wins the
mkdir() race to create an objects/XX/ directory, and then the other user
wins the adjust_shared_perms() race to chmod() that directory, but fails
because it is (transiently, until the first users completes its chmod())
unwriteable to the other user. However, (an equivalent of) this race also
exists before this patch, and is made no worse by this patch.

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

Change sed i\ usage to something Solaris' sed can handleBen Walton Sun, 27 Oct 2013 21:26:48 +0000 (21:26 +0000)

Change sed i\ usage to something Solaris' sed can handle

Solaris' sed was choking on the i\ commands used in
t4015-diff-whitespace as it couldn't parse the program properly.
Modify two uses of sed that worked in GNU sed but not Solaris'
(/usr/bin or /usr/xpg4/bin) to an equivalent form that is handled
properly by both.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: fix typo in commentTorstein Hegge Sun, 27 Oct 2013 09:56:33 +0000 (10:56 +0100)

test-lib: fix typo in comment

Point test writers to the test_expect_* functions properly.

Signed-off-by: Torstein Hegge <hegge@resisty.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: move comment about return value where it... Christian Couder Sat, 26 Oct 2013 22:34:30 +0000 (00:34 +0200)

sha1_file: move comment about return value where it belongs

Commit 5b0864070 (sha1_object_info_extended: make type calculation
optional, Jul 12 2013) changed the return value of the
sha1_object_info_extended function to 0/-1 for success/error.

Previously this function returned the object type for success or
-1 for error. But unfortunately the above commit forgot to change
or move the comment above this function that says "returns enum
object_type or negative".

To fix this inconsistency, let's move the comment above the
sha1_object_info function where it is still true.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: undo special treatment of CRLF for WindowsJohannes Sixt Sat, 26 Oct 2013 19:17:16 +0000 (21:17 +0200)

tests: undo special treatment of CRLF for Windows

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

Windows: a test_cmp that is agnostic to random LF ... Johannes Sixt Sat, 26 Oct 2013 19:17:15 +0000 (21:17 +0200)

Windows: a test_cmp that is agnostic to random LF <> CRLF conversions

In a number of tests, output that was produced by a shell script is
compared to expected output using test_cmp. Unfortunately, the MSYS bash--
when invoked via git, such as in hooks--converts LF to CRLF on output
(as produced by echo and printf), which leads to many false positives.

Implements a diff tool that undoes the converted CRLF. To avoid that
sub-processes are spawned (which is very slow on Windows), the tool is
implemented as a shell function. Diff is invoked as usual only when a
difference is detected by the shell code.

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

t5300-pack-object: do not compare binary data using... Johannes Sixt Sat, 26 Oct 2013 19:17:14 +0000 (21:17 +0200)

t5300-pack-object: do not compare binary data using test_cmp

Users may set test_cmp to a comparison tool of their liking. The intent is
that the tool performs comparison of line-oriented texts. However, t5300
uses it also to compare binary data. Change those tests to use 'cmp'.

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

cache: remove unused function 'have_git_dir'Stefan Beller Sat, 26 Oct 2013 17:03:02 +0000 (19:03 +0200)

cache: remove unused function 'have_git_dir'

This function was added in d2b0708 (2008-09-27, add have_git_dir()
function) as a preparation for adbc0b6 (2008-09-30, cygwin: Use native
Win32 API for stat).

However the second referenced commit was reverted in f66450a (2013-06-22,
cygwin: Remove the Win32 l/stat() implementation), so we don't need to
expose this wrapper function any more as a public API.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: remove unused function invalidate_ref_cacheStefan Beller Sat, 26 Oct 2013 17:03:01 +0000 (19:03 +0200)

refs: remove unused function invalidate_ref_cache

The function 'invalidate_ref_cache' was introduced in 79c7ca5 (2011-10-17,
invalidate_ref_cache(): rename function from invalidate_cached_refs())
by a rename and elevated to be publicly usable in 8be8bde (2011-10-17,
invalidate_ref_cache(): expose this function in the refs API)

However it is not used anymore, as 8bf90dc (2011-10-17, write_ref_sha1():
only invalidate the loose ref cache) and (much) later 506a760 (2013-04-22,
refs: change how packed refs are deleted) removed any calls to this
function. So it seems as if we don't need that function any more,
good bye!

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

howto: add article on recovering a corrupted objectJeff King Fri, 25 Oct 2013 07:55:02 +0000 (03:55 -0400)

howto: add article on recovering a corrupted object

This is an asciidoc-ified version of a corruption post-mortem sent to
the git list. It complements the existing howto article, since it covers
a case where the object couldn't be easily recreated or copied from
elsewhere.

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

reset: pass real rev name to add--interactiveJeff King Fri, 25 Oct 2013 06:54:06 +0000 (02:54 -0400)

reset: pass real rev name to add--interactive

The add--interactive --patch mode adjusts the UI based on
whether we are pulling changes from HEAD or elsewhere (in
the former case it asks to unstage the reverse hunk, rather
than apply the forward hunk).

Commit 166ec2e taught reset to work on an unborn branch, but
in doing so, switched to always providing add--interactive
with the sha1 rather than the symbolic name. This meant we
always used the "apply" interface, even for "git reset -p
HEAD".

We can fix this by passing the symbolic name to
add--interactive. Since it understands unborn branches
these days, we do not even have to cover this special case
ourselves; we can simply pass HEAD.

The tests in t7105 now check that the right interface is
used in each circumstance (and notice the regression from
166ec2e we are fixing). The test in t7106 checks that we
get this right for the unborn case, too (not a regression,
since it didn't work at all before, but a nice improvement).

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

add-interactive: handle unborn branch in patch modeJeff King Fri, 25 Oct 2013 06:52:30 +0000 (02:52 -0400)

add-interactive: handle unborn branch in patch mode

The list_modified function already knows how to handle an
unborn branch by diffing against the empty tree. However,
the diff we perform to get the actual hunks does not. Let's
use the same logic for both diffs.

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

silence gcc array-bounds warningJeff King Thu, 24 Oct 2013 08:45:13 +0000 (04:45 -0400)

silence gcc array-bounds warning

In shorten_unambiguous_ref, we build and cache a reverse-map of the
rev-parse rules like this:

static char **scanf_fmts;
static int nr_rules;
if (!nr_rules) {
for (; ref_rev_parse_rules[nr_rules]; nr_rules++)
... generate scanf_fmts ...
}

where ref_rev_parse_rules is terminated with a NULL pointer.
Compiling with "gcc -O2 -Wall" does not cause any problems, but
compiling with "-O3 -Wall" generates:

$ make CFLAGS='-O3 -Wall' refs.o
refs.c: In function ‘shorten_unambiguous_ref’:
refs.c:3379:29: warning: array subscript is above array bounds [-Warray-bounds]
for (; ref_rev_parse_rules[nr_rules]; nr_rules++)

Curiously, we can silence this by explicitly nr_rules to 0
in the beginning of the loop, even though the compiler
should be able to tell that we follow this code path only
when nr_rules is already 0.

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