git
11 years agoMerge branch 'jc/detached-head-doc' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:57 +0000 (11:26 -0700)] 
Merge branch 'jc/detached-head-doc' into maint

* jc/detached-head-doc:
  glossary: extend "detached HEAD" description

Conflicts:
Documentation/glossary-content.txt

11 years agoMerge branch 'jk/show-branch-strbuf' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:57 +0000 (11:26 -0700)] 
Merge branch 'jk/show-branch-strbuf' into maint

* jk/show-branch-strbuf:
  show-branch: use strbuf instead of static buffer

11 years agoMerge branch 'js/rerere-forget-protect-against-NUL' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:56 +0000 (11:26 -0700)] 
Merge branch 'js/rerere-forget-protect-against-NUL' into maint

* js/rerere-forget-protect-against-NUL:
  rerere forget: do not segfault if not all stages are present
  rerere forget: grok files containing NUL

11 years agoMerge branch 'jc/apply-ws-fix-tab-in-indent' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:56 +0000 (11:26 -0700)] 
Merge branch 'jc/apply-ws-fix-tab-in-indent' into maint

* jc/apply-ws-fix-tab-in-indent:
  test: resurrect q_to_tab
  apply --whitespace=fix: avoid running over the postimage buffer

11 years agoMerge branch 'ap/combine-diff-ignore-whitespace' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:56 +0000 (11:26 -0700)] 
Merge branch 'ap/combine-diff-ignore-whitespace' into maint

* ap/combine-diff-ignore-whitespace:
  Allow combined diff to ignore white-spaces

11 years agoMerge branch 'jk/suppress-clang-warning' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:55 +0000 (11:26 -0700)] 
Merge branch 'jk/suppress-clang-warning' into maint

* jk/suppress-clang-warning:
  fix clang -Wtautological-compare with unsigned enum

11 years agoMerge branch 'tr/perl-keep-stderr-open' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:55 +0000 (11:26 -0700)] 
Merge branch 'tr/perl-keep-stderr-open' into maint

* tr/perl-keep-stderr-open:
  t9700: do not close STDERR
  perl: redirect stderr to /dev/null instead of closing

11 years agoMerge branch 'lf/bundle-with-tip-wo-message' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:55 +0000 (11:26 -0700)] 
Merge branch 'lf/bundle-with-tip-wo-message' into maint

* lf/bundle-with-tip-wo-message:
  bundle: Accept prerequisites without commit messages

11 years agoMerge branch 'jk/filter-branch-come-back-to-original' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:55 +0000 (11:26 -0700)] 
Merge branch 'jk/filter-branch-come-back-to-original' into maint

* jk/filter-branch-come-back-to-original:
  filter-branch: return to original dir after filtering

11 years agoMerge branch 'rr/prompt-revert-head' into maint
Junio C Hamano [Mon, 22 Apr 2013 18:26:54 +0000 (11:26 -0700)] 
Merge branch 'rr/prompt-revert-head' into maint

* rr/prompt-revert-head:
  bash: teach __git_ps1 about REVERT_HEAD

11 years agoremote-hg: fix commit messages
Felipe Contreras [Thu, 18 Apr 2013 06:06:31 +0000 (01:06 -0500)] 
remote-hg: fix commit messages

git fast-import expects an extra newline after the commit message data,
but we are adding it only on hg-git compat mode, which is why the
bidirectionality tests pass.

We should add it unconditionally.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agohelp.c: add a compatibility comment to cmd_version()
David Aguilar [Tue, 16 Apr 2013 20:33:25 +0000 (13:33 -0700)] 
help.c: add a compatibility comment to cmd_version()

External projects have been known to parse the output of
"git version".  Help prevent future authors from changing
its format by adding a comment to its implementation.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'rr/test-3200-style' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:48 +0000 (13:41 -0700)] 
Merge branch 'rr/test-3200-style' into maint

* rr/test-3200-style:
  t3200 (branch): modernize style

Conflicts:
t/t3200-branch.sh

11 years agoMerge branch 'mg/texinfo-5' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:48 +0000 (13:41 -0700)] 
Merge branch 'mg/texinfo-5' into maint

* mg/texinfo-5:
  Documentation: Strip texinfo anchors to avoid duplicates

11 years agoMerge branch 'jk/diffcore-break-divzero' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:47 +0000 (13:41 -0700)] 
Merge branch 'jk/diffcore-break-divzero' into maint

* jk/diffcore-break-divzero:
  diffcore-break: don't divide by zero

11 years agoMerge branch 'cn/commit-amend-doc' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:47 +0000 (13:41 -0700)] 
Merge branch 'cn/commit-amend-doc' into maint

* cn/commit-amend-doc:
  Documentation/git-commit: reword the --amend explanation

11 years agoMerge branch 'jk/bisect-prn-unsigned' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:46 +0000 (13:41 -0700)] 
Merge branch 'jk/bisect-prn-unsigned' into maint

* jk/bisect-prn-unsigned:
  bisect: avoid signed integer overflow

11 years agoMerge branch 'jk/no-more-self-assignment' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:46 +0000 (13:41 -0700)] 
Merge branch 'jk/no-more-self-assignment' into maint

* jk/no-more-self-assignment:
  match-trees: simplify score_trees() using tree_entry()
  submodule: clarify logic in show_submodule_summary

11 years agoMerge branch 'rr/send-email-perl-critique' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:46 +0000 (13:41 -0700)] 
Merge branch 'rr/send-email-perl-critique' into maint

* rr/send-email-perl-critique:
  send-email: use the three-arg form of open in recipients_cmd
  send-email: drop misleading function prototype
  send-email: use "return;" not "return undef;" on error codepaths

11 years agoMerge branch 'jc/t5516-pushInsteadOf-vs-pushURL' into maint
Junio C Hamano [Fri, 12 Apr 2013 20:41:45 +0000 (13:41 -0700)] 
Merge branch 'jc/t5516-pushInsteadOf-vs-pushURL' into maint

* jc/t5516-pushInsteadOf-vs-pushURL:
  t5516: test interaction between pushURL and pushInsteadOf correctly

11 years agoCorrect common spelling mistakes in comments and tests
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
Correct common spelling mistakes in comments and tests

Most of these were found using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agokwset: fix spelling in comments
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
kwset: fix spelling in comments

Correct spelling mistakes noticed using Lucas De Marchi's codespell
tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoprecompose-utf8: fix spelling of "want" in error message
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
precompose-utf8: fix spelling of "want" in error message

Noticed using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocompat/nedmalloc: fix spelling in comments
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
compat/nedmalloc: fix spelling in comments

Correct some typos found using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocompat/regex: fix spelling and grammar in comments
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
compat/regex: fix spelling and grammar in comments

Some of these were found using Lucas De Marchi's codespell tool.
Others noticed by Eric Sunshine.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoobstack: fix spelling of similar
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
obstack: fix spelling of similar

Noticed using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocontrib/subtree: fix spelling of accidentally
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
contrib/subtree: fix spelling of accidentally

Noticed with Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: spelling fixes
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
git-remote-mediawiki: spelling fixes

Most of these were found using Lucas De Marchi's codespell tool.
Others were pointed out by Eric Sunshine.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodoc: various spelling fixes
Stefano Lattarini [Thu, 11 Apr 2013 22:36:10 +0000 (00:36 +0200)] 
doc: various spelling fixes

Most of these were found using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'maint-1.8.1' into maint
Junio C Hamano [Fri, 12 Apr 2013 18:48:38 +0000 (11:48 -0700)] 
Merge branch 'maint-1.8.1' into maint

* maint-1.8.1:
  fast-export: fix argument name in error messages
  Documentation: distinguish between ref and offset deltas in pack-format

11 years agofast-export: fix argument name in error messages
Paul Price [Fri, 12 Apr 2013 14:05:55 +0000 (10:05 -0400)] 
fast-export: fix argument name in error messages

The --signed-tags argument is plural, while error messages referred
to --signed-tag (singular).  Tweak error messages to correspond to the
argument.

Signed-off-by: Paul Price <price@astro.princeton.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: distinguish between ref and offset deltas in pack-format
Stefan Saasen [Fri, 12 Apr 2013 05:56:24 +0000 (15:56 +1000)] 
Documentation: distinguish between ref and offset deltas in pack-format

eb32d236 introduced the OBJ_OFS_DELTA object that uses a relative offset to
identify the base object instead of the 20-byte SHA1 reference. The pack file
documentation only mentions the SHA1 based reference in its description of the
deltified object entry.

Update the pack format documentation to clarify that the deltified object
representation refers to its base using either a relative negative offset or
the absolute SHA1 identifier.

Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'tb/document-status-u-tradeoff' into maint
Junio C Hamano [Fri, 12 Apr 2013 15:12:47 +0000 (08:12 -0700)] 
Merge branch 'tb/document-status-u-tradeoff' into maint

* tb/document-status-u-tradeoff:
  i18n: make the translation of -u advice in one go

11 years agoi18n: make the translation of -u advice in one go
Jiang Xin [Fri, 12 Apr 2013 03:53:01 +0000 (11:53 +0800)] 
i18n: make the translation of -u advice in one go

The advice (consider use of -u when read_directory takes too long) is
separated into 3 different status_printf_ln() calls, and which brings
trouble for translators.

Since status_vprintf() called by status_printf_ln() can handle eol in
buffer, we could simply join these lines into one paragraph.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoTypo fix: replacing it's -> its
Benoit Bourbie [Sat, 13 Apr 2013 16:47:21 +0000 (10:47 -0600)] 
Typo fix: replacing it's -> its

Signed-off-by: Benoit Bourbie <benoit.bourbie@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot: make PIPE a standard test prerequisite
Adam Spiers [Thu, 11 Apr 2013 02:07:04 +0000 (03:07 +0100)] 
t: make PIPE a standard test prerequisite

The 'PIPE' test prerequisite was already defined identically by t9010
and t9300, therefore it makes sense to make it a predefined
prerequisite.

Signed-off-by: Adam Spiers <git@adamspiers.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoarchive: clarify explanation of --worktree-attributes
René Scharfe [Wed, 10 Apr 2013 17:49:57 +0000 (19:49 +0200)] 
archive: clarify explanation of --worktree-attributes

Make it a bit clearer that --worktree-attributes is about files in the
working tree (checked out files, possibly changed) and not the current
working directory ($PWD).  Link to the ATTRIBUTES section, which has
more details.

Reported-by: Amit Bakshi <ambakshi@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot/README: --immediate skips cleanup commands for failed tests
Simon Ruderich [Tue, 9 Apr 2013 21:48:36 +0000 (23:48 +0200)] 
t/README: --immediate skips cleanup commands for failed tests

Signed-off-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.8.2.1 v1.8.2.1
Junio C Hamano [Sun, 7 Apr 2013 22:27:23 +0000 (15:27 -0700)] 
Git 1.8.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobundle: Accept prerequisites without commit messages
Lukas Fleischer [Sun, 7 Apr 2013 11:53:15 +0000 (13:53 +0200)] 
bundle: Accept prerequisites without commit messages

While explicitly stating that the commit message in a prerequisite
line is optional, we required all lines with 40 or more characters
to contain a space after the object name, bailing out if a line
consisted of an object name only. This was to allow bundling a
history to a commit without an message, but the code forgot that it
already called rtrim() to remove that whitespace.

As a workaround, only check for SP when the line has more than 40
characters.

Signed-off-by: Lukas Fleischer <git@cryptocrack.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoSync with 1.8.1.6
Junio C Hamano [Sun, 7 Apr 2013 16:10:11 +0000 (09:10 -0700)] 
Sync with 1.8.1.6

11 years agoGit 1.8.1.6 v1.8.1.6
Junio C Hamano [Sun, 7 Apr 2013 15:58:30 +0000 (08:58 -0700)] 
Git 1.8.1.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jc/directory-attrs-regression-fix' into maint-1.8.1
Junio C Hamano [Sun, 7 Apr 2013 15:45:03 +0000 (08:45 -0700)] 
Merge branch 'jc/directory-attrs-regression-fix' into maint-1.8.1

A pattern "dir" (without trailing slash) in the attributes file
stopped matching a directory "dir" by mistake with an earlier change
that wanted to allow pattern "dir/" to also match.

* jc/directory-attrs-regression-fix:
  t: check that a pattern without trailing slash matches a directory
  dir.c::match_pathname(): pay attention to the length of string parameters
  dir.c::match_pathname(): adjust patternlen when shifting pattern
  dir.c::match_basename(): pay attention to the length of string parameters
  attr.c::path_matches(): special case paths that end with a slash
  attr.c::path_matches(): the basename is part of the pathname

11 years agoremote-helpers/test-bzr.sh: do not use "grep '\s'"
Torsten Bögershausen [Sun, 7 Apr 2013 08:48:30 +0000 (10:48 +0200)] 
remote-helpers/test-bzr.sh: do not use "grep '\s'"

Using grep "devel\s\+3:" to find at least one whitspace is not
portable on all grep versions; not all grep versions understand "\s"
as a "whitespace".

Use a literal TAB followed by SPACE.

The + as a qualifier for "one or more" is not a basic regular
expression; use egrep instead of grep.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoshow-branch: use strbuf instead of static buffer
Jeff King [Fri, 5 Apr 2013 21:15:50 +0000 (17:15 -0400)] 
show-branch: use strbuf instead of static buffer

When we generate relative names (e.g., "master~20^2"), we
format the name into a static buffer, then xstrdup the
result to attach it to the commit. Since the first thing we
add into the static buffer is the already-computed name of
the child commit, the names may get longer and longer as
the traversal gets deeper, and we may eventually overflow
the fixed-size buffer.

Fix this by converting the fixed-size buffer into a dynamic
strbuf.  The performance implications should be minimal, as
we end up allocating a heap copy of the name anyway (and now
we can just detach the heap copy from the strbuf).

Reported-by: Eric Roman <eroman@chromium.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoglossary: extend "detached HEAD" description
Junio C Hamano [Fri, 5 Apr 2013 15:19:41 +0000 (08:19 -0700)] 
glossary: extend "detached HEAD" description

When we introduced the concept of "detached HEAD", we made sure that
commands that operate on the history of the current branch "just
work" in that state.  They update the HEAD to point at the new
history without affecting any branch when the HEAD is detached, just
like they update the tip of the "current branch" to point at the new
history when HEAD points at a specific branch.

As this is done as the natural extension for these commands, we did
not, we still do not, and we do not want to repeat "A detached HEAD
is updated without affecting any branch" when describing what each
and every one of these commands that operates "on the current branch"
does.

Add a blanket description to the glossary to cover them instead.
The general principle is that operations to update the branch work
on and affect the HEAD, while operations to update the information
about a branch do not.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation/git-commit: reword the --amend explanation
Carlos Martín Nieto [Wed, 3 Apr 2013 13:07:21 +0000 (15:07 +0200)] 
Documentation/git-commit: reword the --amend explanation

The explanation for 'git commit --amend' talks about preparing a tree
object, which shouldn't be how user-facing documentation talks about
commit.

Reword it to say it works as usual, but replaces the current commit.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot9700: do not close STDERR
Thomas Rast [Thu, 4 Apr 2013 20:41:42 +0000 (22:41 +0200)] 
t9700: do not close STDERR

Much like the previous patch, this triggered an unrelated bug.
Closing STDERR is not worth it anyway, as we risk writing die() and
such to random files that happen to be subsequently opened on FD 2.
Don't do it.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoperl: redirect stderr to /dev/null instead of closing
Thomas Rast [Thu, 4 Apr 2013 20:41:41 +0000 (22:41 +0200)] 
perl: redirect stderr to /dev/null instead of closing

On my system, t9100.1 triggers the following warning:

  ==352== Syscall param write(buf) points to uninitialised byte(s)
  ==352==    at 0x57119C0: __write_nocancel (in /lib64/libc-2.17.so)
  ==352==    by 0x56AC1D2: _IO_file_write@@GLIBC_2.2.5 (in /lib64/libc-2.17.so)
  ==352==    by 0x56AC0B1: new_do_write (in /lib64/libc-2.17.so)
  ==352==    by 0x56AD3B4: _IO_do_write@@GLIBC_2.2.5 (in /lib64/libc-2.17.so)
  ==352==    by 0x56AD6FE: _IO_file_overflow@@GLIBC_2.2.5 (in /lib64/libc-2.17.so)
  ==352==    by 0x56AE3D8: _IO_default_xsputn (in /lib64/libc-2.17.so)
  ==352==    by 0x56ACAA2: _IO_file_xsputn@@GLIBC_2.2.5 (in /lib64/libc-2.17.so)
  ==352==    by 0x5682133: buffered_vfprintf (in /lib64/libc-2.17.so)
  ==352==    by 0x567CE9D: vfprintf (in /lib64/libc-2.17.so)
  ==352==    by 0x5687096: fprintf (in /lib64/libc-2.17.so)
  ==352==    by 0x4E7AC5: vreportf (usage.c:15)
  ==352==    by 0x4E7B14: die_builtin (usage.c:38)

The actual complaint appears to be a bug in the underlying
implementation.  What's interesting here is that it is apparently
_triggered_ by closing stderr, which results in (from strace)

  write(2, "fatal: Needed a single revision\n", 32) = -1 EBADF (Bad file descriptor)
  write(2, "\0", 1) = -1 EBADF (Bad file descriptor)

Closing stderr is a bad idea anyway: there is a very real chance that
we print fatal error messages to some other file that just happens to
be opened on the now-free FD 2.  So let's not do that.

As pointed out by Eric Wong (thanks), the initial close needs to go:
die() would again write nowhere if we close STDERR beforehand.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomailmap: update Pasky's address
Junio C Hamano [Thu, 4 Apr 2013 20:03:34 +0000 (13:03 -0700)] 
mailmap: update Pasky's address

Eric Wong noticed that the address at suse.cz no longer works.
We may want to update in-code addresses as well, but let's do
this first in 'maint'.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'nd/index-pack-threaded-fixes' into maint
Junio C Hamano [Thu, 4 Apr 2013 20:00:41 +0000 (13:00 -0700)] 
Merge branch 'nd/index-pack-threaded-fixes' into maint

* nd/index-pack-threaded-fixes:
  index-pack: guard nr_resolved_deltas reads by lock
  index-pack: protect deepest_delta in multithread code

11 years agoMerge branch 'jk/index-pack-correct-depth-fix' into maint
Junio C Hamano [Thu, 4 Apr 2013 20:00:37 +0000 (13:00 -0700)] 
Merge branch 'jk/index-pack-correct-depth-fix' into maint

* jk/index-pack-correct-depth-fix:
  index-pack: always zero-initialize object_entry list

11 years agoMerge branch 'rs/submodule-summary-limit' into maint
Junio C Hamano [Thu, 4 Apr 2013 20:00:35 +0000 (13:00 -0700)] 
Merge branch 'rs/submodule-summary-limit' into maint

"submodule summary --summary-limit" option did not support
"--option=value" form.

* rs/submodule-summary-limit:
  submodule summary: support --summary-limit=<n>

11 years agoMerge branch 'jk/peel-ref' into maint
Junio C Hamano [Thu, 4 Apr 2013 19:59:55 +0000 (12:59 -0700)] 
Merge branch 'jk/peel-ref' into maint

* jk/peel-ref:
  upload-pack: load non-tip "want" objects from disk
  upload-pack: make sure "want" objects are parsed
  upload-pack: drop lookup-before-parse optimization

11 years agorerere forget: do not segfault if not all stages are present
Johannes Sixt [Thu, 4 Apr 2013 18:41:43 +0000 (20:41 +0200)] 
rerere forget: do not segfault if not all stages are present

The loop that fills in the buffers that are later passed to the merge
driver exits early when not all stages of a path are present in the index.
But since the buffer pointers are not initialized in advance, the
subsequent accesses are undefined.

Initialize buffer pointers in advance to avoid undefined behavior later.

That is not sufficient, though, to get correct operation of handle_cache().
The function replays a conflicted merge to extract the part inside the
conflict markers. As written, the loop exits early when a stage is missing.
Consequently, the buffers for later stages that would be present in the
index are not filled in and the merge is replayed with incomplete data.

Fix it by investigating all stages of the given path.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: new wiki URL in documentation
Matthieu Moy [Thu, 4 Apr 2013 07:56:03 +0000 (09:56 +0200)] 
git-remote-mediawiki: new wiki URL in documentation

The Bibzball wiki is not maintained anymore.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: Strip texinfo anchors to avoid duplicates
Martin von Gagern [Wed, 3 Apr 2013 19:54:33 +0000 (21:54 +0200)] 
Documentation: Strip texinfo anchors to avoid duplicates

This keeps texinfo 5.x happy. See https://bugs.gentoo.org/464210.

Signed-off-by: Martin von Gagern <Martin.vGagern@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobisect: avoid signed integer overflow
John Keeping [Wed, 3 Apr 2013 19:17:55 +0000 (20:17 +0100)] 
bisect: avoid signed integer overflow

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodiffcore-break: don't divide by zero
John Keeping [Wed, 3 Apr 2013 19:24:05 +0000 (20:24 +0100)] 
diffcore-break: don't divide by zero

When the source file is empty, the calculation of the merge score
results in a division by zero.  In the situation:

     == preimage ==             == postimage ==

     F (empty file)             F (a large file)
                                E (a new empty file)

it does not make sense to consider F->E as a rename, so it is better not
to break the pre- and post-image of F.

Bail out early in this case to avoid hitting the divide-by-zero.  This
causes the merge score to be left at zero.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.8.2.1
Junio C Hamano [Wed, 3 Apr 2013 16:29:14 +0000 (09:29 -0700)] 
Update draft release notes to 1.8.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'mg/gpg-interface-using-status' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:26:27 +0000 (09:26 -0700)] 
Merge branch 'mg/gpg-interface-using-status' into maint

Verification of signed tags were not done correctly when not in C
or en/US locale.

* mg/gpg-interface-using-status:
  pretty: make %GK output the signing key for signed commits
  pretty: parse the gpg status lines rather than the output
  gpg_interface: allow to request status return
  log-tree: rely upon the check in the gpg_interface
  gpg-interface: check good signature in a reliable way

11 years agoMerge branch 'bc/commit-complete-lines-given-via-m-option' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:26:07 +0000 (09:26 -0700)] 
Merge branch 'bc/commit-complete-lines-given-via-m-option' into maint

'git commit -m "$msg"' used to add an extra newline even when
$msg already ended with one.

* bc/commit-complete-lines-given-via-m-option:
  Documentation/git-commit.txt: rework the --cleanup section
  git-commit: only append a newline to -m mesg if necessary
  t7502: demonstrate breakage with a commit message with trailing newlines
  t/t7502: compare entire commit message with what was expected

11 years agoMerge branch 'jc/describe' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:25:52 +0000 (09:25 -0700)] 
Merge branch 'jc/describe' into maint

The "--match=<pattern>" option of "git describe", when used with
"--all" to allow refs that are not annotated tags to be used as a
base of description, did not restrict the output from the command to
those that match the given pattern.

* jc/describe:
  describe: --match=<pattern> must limit the refs even when used with --all

11 years agoMerge branch 'jk/alias-in-bare' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:25:41 +0000 (09:25 -0700)] 
Merge branch 'jk/alias-in-bare' into maint

An aliased command spawned from a bare repository that does not say
it is bare with "core.bare = yes" is treated as non-bare by mistake.

* jk/alias-in-bare:
  setup: suppress implicit "." work-tree for bare repos
  environment: add GIT_PREFIX to local_repo_env
  cache.h: drop LOCAL_REPO_ENV_SIZE

11 years agoMerge branch 'ks/rfc2047-one-char-at-a-time' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:25:29 +0000 (09:25 -0700)] 
Merge branch 'ks/rfc2047-one-char-at-a-time' into maint

When "format-patch" quoted a non-ascii strings on the header files,
it incorrectly applied rfc2047 and chopped a single character in the
middle of it.

* ks/rfc2047-one-char-at-a-time:
  format-patch: RFC 2047 says multi-octet character may not be split

11 years agoMerge branch 'jk/empty-archive' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:25:15 +0000 (09:25 -0700)] 
Merge branch 'jk/empty-archive' into maint

"git archive" reports a failure when asked to create an archive out
of an empty tree.  It would be more intuitive to give an empty
archive back in such a case.

* jk/empty-archive:
  archive: handle commits with an empty tree
  test-lib: factor out $GIT_UNZIP setup

11 years agoMerge branch 'ph/tag-force-no-warn-on-creation' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:24:51 +0000 (09:24 -0700)] 
Merge branch 'ph/tag-force-no-warn-on-creation' into maint

"git tag -f <tag>" always said "Updated tag '<tag>'" even when
creating a new tag (i.e. not overwriting nor updating).

* ph/tag-force-no-warn-on-creation:
  tag: --force does not have to warn when creating tags

11 years agoMerge branch 'lf/setup-prefix-pathspec' into maint
Junio C Hamano [Wed, 3 Apr 2013 16:24:18 +0000 (09:24 -0700)] 
Merge branch 'lf/setup-prefix-pathspec' into maint

"git cmd -- ':(top'" was not diagnosed as an invalid syntax, and
instead the parser kept reading beyond the end of the string.

* lf/setup-prefix-pathspec:
  setup.c: check that the pathspec magic ends with ")"
  setup.c: stop prefix_pathspec() from looping past the end of string

11 years agoSync with 1.8.1 maintenance track
Junio C Hamano [Wed, 3 Apr 2013 16:18:01 +0000 (09:18 -0700)] 
Sync with 1.8.1 maintenance track

* maint-1.8.1:
  Start preparing for 1.8.1.6
  git-tag(1): we tag HEAD by default
  Fix revision walk for commits with the same dates
  t2003: work around path mangling issue on Windows
  pack-refs: add fully-peeled trait
  pack-refs: write peeled entry for non-tags
  use parse_object_or_die instead of die("bad object")
  avoid segfaults on parse_object failure
  entry: fix filter lookup
  t2003: modernize style
  name-hash.c: fix endless loop with core.ignorecase=true

11 years agoStart preparing for 1.8.1.6
Junio C Hamano [Wed, 3 Apr 2013 16:12:11 +0000 (09:12 -0700)] 
Start preparing for 1.8.1.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'kb/name-hash' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:44:54 +0000 (08:44 -0700)] 
Merge branch 'kb/name-hash' into maint-1.8.1

* kb/name-hash:
  name-hash.c: fix endless loop with core.ignorecase=true

11 years agoMerge branch 'kk/revwalk-slop-too-many-commit-within-a-second' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:44:02 +0000 (08:44 -0700)] 
Merge branch 'kk/revwalk-slop-too-many-commit-within-a-second' into maint-1.8.1

* kk/revwalk-slop-too-many-commit-within-a-second:
  Fix revision walk for commits with the same dates

11 years agoMerge branch 'jk/checkout-attribute-lookup' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:43:40 +0000 (08:43 -0700)] 
Merge branch 'jk/checkout-attribute-lookup' into maint-1.8.1

* jk/checkout-attribute-lookup:
  t2003: work around path mangling issue on Windows
  entry: fix filter lookup
  t2003: modernize style

11 years agoMerge branch 'jk/fully-peeled-packed-ref' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:43:03 +0000 (08:43 -0700)] 
Merge branch 'jk/fully-peeled-packed-ref' into maint-1.8.1

* jk/fully-peeled-packed-ref:
  pack-refs: add fully-peeled trait
  pack-refs: write peeled entry for non-tags
  use parse_object_or_die instead of die("bad object")
  avoid segfaults on parse_object failure

11 years agoMerge branch 'ap/maint-diff-rename-avoid-overlap' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:37:39 +0000 (08:37 -0700)] 
Merge branch 'ap/maint-diff-rename-avoid-overlap' into maint-1.8.1

* ap/maint-diff-rename-avoid-overlap:
  tests: make sure rename pretty print works
  diff: prevent pprint_rename from underrunning input
  diff: Fix rename pretty-print when suffix and prefix overlap

11 years agoMerge branch 'yd/doc-merge-annotated-tag' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:36:52 +0000 (08:36 -0700)] 
Merge branch 'yd/doc-merge-annotated-tag' into maint-1.8.1

* yd/doc-merge-annotated-tag:
  Documentation: merging a tag is a special case

11 years agoMerge branch 'ap/maint-update-index-h-is-for-help' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:36:10 +0000 (08:36 -0700)] 
Merge branch 'ap/maint-update-index-h-is-for-help' into maint-1.8.1

* ap/maint-update-index-h-is-for-help:
  update-index: allow "-h" to also display options

11 years agoMerge branch 'jc/perl-cat-blob' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:45 +0000 (08:35 -0700)] 
Merge branch 'jc/perl-cat-blob' into maint-1.8.1

* jc/perl-cat-blob:
  Git.pm: fix cat_blob crashes on large files

11 years agoMerge branch 'ob/imap-send-ssl-verify' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:33 +0000 (08:35 -0700)] 
Merge branch 'ob/imap-send-ssl-verify' into maint-1.8.1

* ob/imap-send-ssl-verify:
  imap-send: support Server Name Indication (RFC4366)

11 years agoMerge branch 'nd/index-pack-l10n-buf-overflow' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:06 +0000 (08:35 -0700)] 
Merge branch 'nd/index-pack-l10n-buf-overflow' into maint-1.8.1

* nd/index-pack-l10n-buf-overflow:
  index-pack: fix buffer overflow caused by translations

11 years agogit-tag(1): we tag HEAD by default
Thomas Rast [Wed, 3 Apr 2013 14:27:14 +0000 (16:27 +0200)] 
git-tag(1): we tag HEAD by default

The <commit>|<object> argument is actually not explained anywhere
(except implicitly in the description of an unannotated tag).  Write a
little explanation, in particular to cover the default.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofilter-branch: return to original dir after filtering
Jeff King [Tue, 2 Apr 2013 14:22:19 +0000 (10:22 -0400)] 
filter-branch: return to original dir after filtering

The first thing filter-branch does is to create a temporary
directory, either ".git-rewrite" in the current directory
(which may be the working tree or the repository if bare),
or in a directory specified by "-d". We then chdir to
$tempdir/t as our temporary working directory in which to run
tree filters.

After finishing the filter, we then attempt to go back to
the original directory with "cd ../..". This works in the
.git-rewrite case, but if "-d" is used, we end up in a
random directory. The only thing we do after this chdir is
to run git-read-tree, but that means that:

  1. The working directory is not updated to reflect the
     filtered history.

  2. We dump random files into "$tempdir/.." (e.g., if you
     use "-d /tmp/foo", we dump junk into /tmp).

Fix it by recording the full path to the original directory
and returning there explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorerere forget: grok files containing NUL
Johannes Sixt [Mon, 1 Apr 2013 21:36:36 +0000 (23:36 +0200)] 
rerere forget: grok files containing NUL

Using 'git rerere forget .' after a merge that involved binary files
runs into an infinite loop if the binary file contains a zero byte.
Replace a strchrnul by memchr because the former does not make progress
as soon as the NUL is encountered.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.8.2.1
Junio C Hamano [Mon, 1 Apr 2013 16:23:05 +0000 (09:23 -0700)] 
Update draft release notes to 1.8.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'ap/maint-diff-rename-avoid-overlap' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:46 +0000 (09:19 -0700)] 
Merge branch 'ap/maint-diff-rename-avoid-overlap' into maint

* ap/maint-diff-rename-avoid-overlap:
  tests: make sure rename pretty print works
  diff: prevent pprint_rename from underrunning input
  diff: Fix rename pretty-print when suffix and prefix overlap

11 years agoMerge branch 'rr/tests-dedup-test-config' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:41 +0000 (09:19 -0700)] 
Merge branch 'rr/tests-dedup-test-config' into maint

* rr/tests-dedup-test-config:
  t4018,7810,7811: remove test_config() redefinition

11 years agoMerge branch 'yd/doc-is-in-asciidoc' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:40 +0000 (09:19 -0700)] 
Merge branch 'yd/doc-is-in-asciidoc' into maint

* yd/doc-is-in-asciidoc:
  CodingGuidelines: our documents are in AsciiDoc

11 years agoMerge branch 'yd/doc-merge-annotated-tag' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:37 +0000 (09:19 -0700)] 
Merge branch 'yd/doc-merge-annotated-tag' into maint

* yd/doc-merge-annotated-tag:
  Documentation: merging a tag is a special case

11 years agoMerge branch 'tb/document-status-u-tradeoff' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:30 +0000 (09:19 -0700)] 
Merge branch 'tb/document-status-u-tradeoff' into maint

* tb/document-status-u-tradeoff:
  status: advise to consider use of -u when read_directory takes too long
  git status: document trade-offs in choosing parameters to the -u option

11 years agoMerge branch 'da/downcase-u-in-usage' into maint
Junio C Hamano [Mon, 1 Apr 2013 16:19:04 +0000 (09:19 -0700)] 
Merge branch 'da/downcase-u-in-usage' into maint

* da/downcase-u-in-usage:
  contrib/mw-to-git/t/install-wiki.sh: use a lowercase "usage:" string
  contrib/examples/git-remote.perl: use a lowercase "usage:" string
  tests: use a lowercase "usage:" string
  git-svn: use a lowercase "usage:" string
  Documentation/user-manual.txt: use a lowercase "usage:" string
  templates/hooks--update.sample: use a lowercase "usage:" string
  contrib/hooks/setgitperms.perl: use a lowercase "usage:" string
  contrib/examples: use a lowercase "usage:" string
  contrib/fast-import/import-zips.py: use spaces instead of tabs
  contrib/fast-import/import-zips.py: fix broken error message
  contrib/fast-import: use a lowercase "usage:" string
  contrib/credential: use a lowercase "usage:" string
  git-cvsimport: use a lowercase "usage:" string
  git-cvsimport: use a lowercase "usage:" string
  git-cvsexportcommit: use a lowercase "usage:" string
  git-archimport: use a lowercase "usage:" string
  git-merge-one-file: use a lowercase "usage:" string
  git-relink: use a lowercase "usage:" string
  git-svn: use a lowercase "usage:" string
  git-sh-setup: use a lowercase "usage:" string

11 years agosubmodule summary: support --summary-limit=<n>
René Scharfe [Mon, 1 Apr 2013 13:06:27 +0000 (15:06 +0200)] 
submodule summary: support --summary-limit=<n>

In addition to "--summary-limit <n>" support the form "--summary-limit=<n>",
for consistency with other parameters and commands.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: use the three-arg form of open in recipients_cmd
Ramkumar Ramachandra [Mon, 1 Apr 2013 01:40:42 +0000 (18:40 -0700)] 
send-email: use the three-arg form of open in recipients_cmd

Perlcritic does not want to see the trailing pipe in the two-args
form of open(), i.e.

open my $fh, "$cmd \Q$file\E |";

If $cmd were a single-token command name, it would make a lot more
sense to use four-or-more-args form "open FILEHANDLE,MODE,CMD,ARGS"
to avoid shell from expanding metacharacters in $file, but we do
expect multi-word string in $to_cmd and $cc_cmd to be expanded by
the shell, so we cannot rewrite it to

open my $fh, "-|", $cmd, $file;

for extra safety.  At least, by using this in the three-arg form:

open my $fh, "-|", "$cmd \Q$file\E";

we can silence Perlcritic, even though we do not gain much safety by
doing so.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: drop misleading function prototype
Ramkumar Ramachandra [Mon, 1 Apr 2013 01:40:41 +0000 (18:40 -0700)] 
send-email: drop misleading function prototype

The subroutine check_file_rev_conflict() is called from two places,
both of which expects to pass a single scalar variable and see if
that can be interpreted as a pathname or a revision name.  It is
defined with a function prototype ($) to force a scalar context
while evaluating the arguments at the calling site but it does not
help the current calling sites.  The only effect it has is to hurt
future calling sites that may want to build an argument list in an
array variable and call it as check_file_rev_confict(@args).

Drop the misleading prototype, as Perlcritic suggests.

While at it, rename the function to avoid new call sites unaware of
this change arising and add a comment clarifying what this function
is for.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: use "return;" not "return undef;" on error codepaths
Ramkumar Ramachandra [Mon, 1 Apr 2013 01:40:40 +0000 (18:40 -0700)] 
send-email: use "return;" not "return undef;" on error codepaths

All the callers of "ask", "extract_valid_address", and "validate_patch"
subroutines assign the return values from them to a single scalar:

$var = subr(...);

and "return undef;" in these subroutine can safely be turned into a
simpler "return;".  Doing so will also future-proof a new caller that
mistakenly does this:

    @foo = ask(...);
    if (@foo) { ... we got an answer ... } else { ... we did not ... }

Note that we leave "return undef;" in validate_address on purpose,
even though Perlcritic may complain.  The primary "return" site of
the function returns whatever is in the scalar variable $address, so
it is pointless to change only the other "return undef;" to "return".
The caller must be prepared to see an array with a single undef as
the return value from this subroutine anyway.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobash: teach __git_ps1 about REVERT_HEAD
Robin Rosenberg [Sun, 31 Mar 2013 00:30:48 +0000 (01:30 +0100)] 
bash: teach __git_ps1 about REVERT_HEAD

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocat-file: Fix an gcc -Wuninitialized warning
Ramsay Jones [Tue, 26 Mar 2013 19:20:11 +0000 (19:20 +0000)] 
cat-file: Fix an gcc -Wuninitialized warning

After commit cbfd5e1c ("drop some obsolete "x = x" compiler warning
hacks", 21-03-2013) removed a gcc specific hack, older versions of
gcc now issue an "'contents' might be used uninitialized" warning.
In order to suppress the warning, we simply initialize the variable
to NULL in it's declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofast-import: Fix an gcc -Wuninitialized warning
Ramsay Jones [Tue, 26 Mar 2013 19:09:44 +0000 (19:09 +0000)] 
fast-import: Fix an gcc -Wuninitialized warning

Commit cbfd5e1c ("drop some obsolete "x = x" compiler warning hacks",
21-03-2013) removed a gcc hack that suppressed an "might be used
uninitialized" warning issued by older versions of gcc.

However, commit 3aa99df8 ('fast-import: clarify "inline" logic in
file_change_m', 21-03-2013) addresses an (almost) identical issue
(with very similar code), but includes additional code in it's
resolution. The solution used by this commit, unlike that used by
commit cbfd5e1c, also suppresses the -Wuninitialized warning on
older versions of gcc.

In order to suppress the warning (against the 'oe' symbol) in the
note_change_n() function, we adopt the same solution used by commit
3aa99df8.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotest: resurrect q_to_tab
Junio C Hamano [Fri, 29 Mar 2013 20:38:28 +0000 (13:38 -0700)] 
test: resurrect q_to_tab

New test may want to use this helper; keep it for them that do not
need to protect literal SP.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot: check that a pattern without trailing slash matches a directory
Jeff King [Thu, 28 Mar 2013 21:50:04 +0000 (17:50 -0400)] 
t: check that a pattern without trailing slash matches a directory

Prior to v1.8.1.1, with:

  git init
  echo content >foo &&
  mkdir subdir &&
  echo content >subdir/bar &&
  echo "subdir export-ignore" >.gitattributes
  git add . &&
  git commit -m one &&
  git archive HEAD | tar tf -

the resulting archive would contain only "foo" and ".gitattributes",
not subdir.  This was broken with a recent change that intended to
allow "subdir/ export-ignore" to also exclude the directory, but
instead ended up _requiring_ the trailing slash by mistake.

A pattern "subdir" should match any path "subdir", whether it is a
directory or a non-directory.  A pattern "subdir/" insists that a
path "subdir" must be a directory for it to match.

This patch adds test not just for this simple case, but also for
deeper cross-directory cases, as well as cases with wildcards.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodir.c::match_pathname(): pay attention to the length of string parameters
Jeff King [Thu, 28 Mar 2013 21:48:21 +0000 (17:48 -0400)] 
dir.c::match_pathname(): pay attention to the length of string parameters

This function takes two counted strings: a <pattern, patternlen> pair
and a <pathname, pathlen> pair. But we end up feeding the result to
fnmatch, which expects NUL-terminated strings.

We can fix this by calling the fnmatch_icase_mem function, which
handles re-allocating into a NUL-terminated string if necessary.

While we're at it, we can avoid even calling fnmatch in some cases. In
addition to patternlen, we get "prefix", the size of the pattern that
contains no wildcard characters. We do a straight match of the prefix
part first, and then use fnmatch to cover the rest. But if there are
no wildcards in the pattern at all, we do not even need to call
fnmatch; we would simply be comparing two empty strings.

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