]> git.neil.brown.name Git - git.git/log
git.git
6 years agoGit 2.13.3 maint v2.13.3
Junio C Hamano [Wed, 12 Jul 2017 22:24:15 +0000 (15:24 -0700)]
Git 2.13.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'kn/ref-filter-branch-list' into maint
Junio C Hamano [Wed, 12 Jul 2017 22:23:09 +0000 (15:23 -0700)]
Merge branch 'kn/ref-filter-branch-list' into maint

The rewrite of "git branch --list" using for-each-ref's internals
that happened in v2.13 regressed its handling of color.branch.local;
this has been fixed.

* kn/ref-filter-branch-list:
  ref-filter.c: drop return from void function
  branch: set remote color in ref-filter branch immediately
  branch: use BRANCH_COLOR_LOCAL in ref-filter format
  branch: only perform HEAD check for local branches

6 years agoMerge branch 'ks/typofix-commit-c-comment' into maint
Junio C Hamano [Wed, 12 Jul 2017 22:20:48 +0000 (15:20 -0700)]
Merge branch 'ks/typofix-commit-c-comment' into maint

Typofix.

* ks/typofix-commit-c-comment:
  builtin/commit.c: fix a typo in the comment

6 years agoMerge branch 'jk/reflog-walk-maint' into maint
Junio C Hamano [Wed, 12 Jul 2017 22:20:35 +0000 (15:20 -0700)]
Merge branch 'jk/reflog-walk-maint' into maint

After "git branch --move" of the currently checked out branch, the
code to walk the reflog of HEAD via "log -g" and friends
incorrectly stopped at the reflog entry that records the renaming
of the branch.

* jk/reflog-walk-maint:
  reflog-walk: include all fields when freeing complete_reflogs
  reflog-walk: don't free reflogs added to cache
  reflog-walk: duplicate strings in complete_reflogs list
  reflog-walk: skip over double-null oid due to HEAD rename

6 years agoPrepare for 2.13.3
Junio C Hamano [Mon, 10 Jul 2017 21:02:07 +0000 (14:02 -0700)]
Prepare for 2.13.3

6 years agoMerge branch 'sb/merge-recursive-code-cleanup' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:09 +0000 (13:59 -0700)]
Merge branch 'sb/merge-recursive-code-cleanup' into maint

Code clean-up.

* sb/merge-recursive-code-cleanup:
  merge-recursive: use DIFF_XDL_SET macro

6 years agoMerge branch 'jc/utf8-fprintf' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:08 +0000 (13:59 -0700)]
Merge branch 'jc/utf8-fprintf' into maint

Code cleanup.

* jc/utf8-fprintf:
  submodule--helper: do not call utf8_fprintf() unnecessarily

6 years agoMerge branch 'js/fsck-name-object' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:08 +0000 (13:59 -0700)]
Merge branch 'js/fsck-name-object' into maint

Test fix.

* js/fsck-name-object:
  t1450: use egrep for regexp "alternation"

6 years agoMerge branch 'js/t5534-rev-parse-gives-multi-line-output-fix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:07 +0000 (13:59 -0700)]
Merge branch 'js/t5534-rev-parse-gives-multi-line-output-fix' into maint

A few tests that tried to verify the contents of push certificates
did not use 'git rev-parse' to formulate the line to look for in
the certificate correctly.

* js/t5534-rev-parse-gives-multi-line-output-fix:
  t5534: fix misleading grep invocation

6 years agoMerge branch 'ab/sha1dc-maint' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:06 +0000 (13:59 -0700)]
Merge branch 'ab/sha1dc-maint' into maint

Update the sha1dc again to fix portability glitches.

* ab/sha1dc-maint:
  sha1dc: update from upstream

6 years agoMerge branch 'aw/contrib-subtree-doc-asciidoctor' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:06 +0000 (13:59 -0700)]
Merge branch 'aw/contrib-subtree-doc-asciidoctor' into maint

The Makefile rule in contrib/subtree for building documentation
learned to honour USE_ASCIIDOCTOR just like the main documentation
set does.

* aw/contrib-subtree-doc-asciidoctor:
  subtree: honour USE_ASCIIDOCTOR when set

6 years agoMerge branch 'cc/shared-index-permfix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:05 +0000 (13:59 -0700)]
Merge branch 'cc/shared-index-permfix' into maint

The split index code did not honor core.sharedrepository setting
correctly.

* cc/shared-index-permfix:
  t1700: make sure split-index respects core.sharedrepository
  t1301: move modebits() to test-lib-functions.sh
  read-cache: use shared perms when writing shared index

6 years agoMerge branch 'ah/doc-pretty-color-auto-prefix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:05 +0000 (13:59 -0700)]
Merge branch 'ah/doc-pretty-color-auto-prefix' into maint

Doc update.

* ah/doc-pretty-color-auto-prefix:
  doc: clarify syntax for %C(auto,...) in pretty formats

6 years agoMerge branch 'mb/reword-autocomplete-message' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:04 +0000 (13:59 -0700)]
Merge branch 'mb/reword-autocomplete-message' into maint

Message update.

* mb/reword-autocomplete-message:
  auto-correct: tweak phrasing

6 years agoMerge branch 'ks/t7508-indent-fix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:03 +0000 (13:59 -0700)]
Merge branch 'ks/t7508-indent-fix' into maint

Cosmetic update to a test.

* ks/t7508-indent-fix:
  t7508: fix a broken indentation

6 years agoMerge branch 'sb/t4005-modernize' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:02 +0000 (13:59 -0700)]
Merge branch 'sb/t4005-modernize' into maint

Test clean-up.

* sb/t4005-modernize:
  t4005: modernize style and drop hard coded sha1

6 years agoMerge branch 'rs/apply-validate-input' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:01 +0000 (13:59 -0700)]
Merge branch 'rs/apply-validate-input' into maint

Tighten error checks for invalid "git apply" input.

* rs/apply-validate-input:
  apply: check git diffs for mutually exclusive header lines
  apply: check git diffs for invalid file modes
  apply: check git diffs for missing old filenames

6 years agoMerge branch 'jc/pack-bitmap-unaligned' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:59:00 +0000 (13:59 -0700)]
Merge branch 'jc/pack-bitmap-unaligned' into maint

An unaligned 32-bit access in pack-bitmap code ahs been corrected.

* jc/pack-bitmap-unaligned:
  pack-bitmap: don't perform unaligned memory access

6 years agoMerge branch 'pw/rebase-i-regression-fix-tests' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:59 +0000 (13:58 -0700)]
Merge branch 'pw/rebase-i-regression-fix-tests' into maint

Fix a recent regression to "git rebase -i" and add tests that would
have caught it and others.

* pw/rebase-i-regression-fix-tests:
  t3420: fix under GETTEXT_POISON build
  rebase: add more regression tests for console output
  rebase: add regression tests for console output
  rebase -i: add test for reflog message
  sequencer: print autostash messages to stderr

6 years agoMerge branch 'jk/add-p-commentchar-fix' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:58 +0000 (13:58 -0700)]
Merge branch 'jk/add-p-commentchar-fix' into maint

"git add -p" were updated in 2.12 timeframe to cope with custom
core.commentchar but the implementation was buggy and a
metacharacter like $ and * did not work.

* jk/add-p-commentchar-fix:
  add--interactive: quote commentChar regex
  add--interactive: handle EOF in prompt_yesno

6 years agoMerge branch 'js/alias-early-config' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:57 +0000 (13:58 -0700)]
Merge branch 'js/alias-early-config' into maint

The code to pick up and execute command alias definition from the
configuration used to switch to the top of the working tree and
then come back when the expanded alias was executed, which was
unnecessarilyl complex.  Attempt to simplify the logic by using the
early-config mechanism that does not chdir around.

* js/alias-early-config:
  alias: use the early config machinery to expand aliases
  t7006: demonstrate a problem with aliases in subdirectories
  t1308: relax the test verifying that empty alias values are disallowed
  help: use early config when autocorrecting aliases
  config: report correct line number upon error
  discover_git_directory(): avoid setting invalid git_dir

6 years agoMerge branch 'rs/pretty-add-again' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:57 +0000 (13:58 -0700)]
Merge branch 'rs/pretty-add-again' into maint

The pretty-format specifiers like '%h', '%t', etc. had an
optimization that no longer works correctly.  In preparation/hope
of getting it correctly implemented, first discard the optimization
that is broken.

* rs/pretty-add-again:
  pretty: recalculate duplicate short hashes

6 years agoMerge branch 'ah/doc-gitattributes-empty-index' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:56 +0000 (13:58 -0700)]
Merge branch 'ah/doc-gitattributes-empty-index' into maint

An example in documentation that does not work in multi worktree
configuration has been corrected.

* ah/doc-gitattributes-empty-index:
  doc: do not use `rm .git/index` when normalizing line endings

6 years agoMerge branch 'da/mergetools-meld-output-opt-on-macos' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:56 +0000 (13:58 -0700)]
Merge branch 'da/mergetools-meld-output-opt-on-macos' into maint

"git mergetool" learned to work around a wrapper MacOS X adds
around underlying meld.

* da/mergetools-meld-output-opt-on-macos:
  mergetools/meld: improve compatibiilty with Meld on macOS X

6 years agoMerge branch 'jk/diff-highlight-module' into maint
Junio C Hamano [Mon, 10 Jul 2017 20:58:56 +0000 (13:58 -0700)]
Merge branch 'jk/diff-highlight-module' into maint

The 'diff-highlight' program (in contrib/) has been restructured
for easier reuse by an external project 'diff-so-fancy'.

* jk/diff-highlight-module:
  diff-highlight: split code into module

6 years agoref-filter.c: drop return from void function
Alejandro R. Sedeño [Mon, 10 Jul 2017 19:03:03 +0000 (15:03 -0400)]
ref-filter.c: drop return from void function

Sun's C compiler errors out on this pattern:

void foo() { ... }
void bar() { return foo(); }

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agol10n: de.po: fix typo
Ralf Thielow [Mon, 10 Jul 2017 16:23:08 +0000 (18:23 +0200)]
l10n: de.po: fix typo

Reported-by: Andre Hinrichs <andre.hinrichs@gmx.de>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobranch: set remote color in ref-filter branch immediately
Jeff King [Sun, 9 Jul 2017 10:00:45 +0000 (06:00 -0400)]
branch: set remote color in ref-filter branch immediately

We set the current and local branch colors at the top of the
build_format() function. Let's do the same for the remote
color. This saves a little bit of repetition, but more
importantly it puts all of the color-setting in the same
place. That makes it easier to see that we are coloring all
possibilities.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobranch: use BRANCH_COLOR_LOCAL in ref-filter format
Jeff King [Sun, 9 Jul 2017 09:59:33 +0000 (05:59 -0400)]
branch: use BRANCH_COLOR_LOCAL in ref-filter format

Since 949af0684 (branch: use ref-filter printing APIs,
2017-01-10), git-branch's output is generated by passing a
custom format to the ref-filter code. This format forgot to
pass BRANCH_COLOR_LOCAL, meaning that local branches
(besides the current one) were never colored at all.

We can add it in the %(if) block where we decide whether the
branch is "current" or merely "local".  Note that this means
the current/local coloring is either/or. You can't set:

  [color "branch"]
  local = blue
  current = bold

and expect the current branch to be "bold blue". This
matches the pre-949af0684 behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobranch: only perform HEAD check for local branches
Jeff King [Sun, 9 Jul 2017 09:58:10 +0000 (05:58 -0400)]
branch: only perform HEAD check for local branches

When assembling the ref-filter format to show "git branch"
output, we put the "%(if)%(HEAD)" conditional at the start
of the overall format. But there's no point in checking
whether a remote branch matches HEAD, as it never will.
The check should go inside the local conditional; we
assemble that format inside the "local" strbuf.

By itself, this is just a minor optimization. But in a
future patch, we'll need this refactoring to fix
local-branch coloring.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreflog-walk: include all fields when freeing complete_reflogs
Jeff King [Fri, 7 Jul 2017 08:43:16 +0000 (04:43 -0400)]
reflog-walk: include all fields when freeing complete_reflogs

When we encounter an error adding reflogs for a walk, we try
to free any logs we have read. But we didn't free all
fields, meaning that we could in theory leak all of the
"items" array (which would consitute the bulk of the
allocated memory).

This patch adds a helper which frees all of the entries and
uses it as appropriate.

As it turns out, the leak seems impossible to trigger with
the current code. Of the three error paths that free the
complete_reflogs struct, two only kick in when the items
array is empty, and the third was removed entirely in the
previous commit.

So this patch should be a noop in terms of behavior, but it
fixes a potential maintenance headache should anybody add a
new error path and copy the partial-free code. Which is
what happened in 5026b47175 (add_reflog_for_walk: avoid
memory leak, 2017-05-04), though its leaky call was the
third one that was recently removed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreflog-walk: don't free reflogs added to cache
Jeff King [Fri, 7 Jul 2017 08:41:49 +0000 (04:41 -0400)]
reflog-walk: don't free reflogs added to cache

The add_reflog_for_walk() function keeps a cache mapping
refnames to their reflog contents. We use a cached reflog
entry if available, and otherwise allocate and store a new
one.

Since 5026b47175 (add_reflog_for_walk: avoid memory leak,
2017-05-04), when we hit an error parsing a date-based
reflog spec, we free the reflog memory but leave the cache
entry pointing to the now-freed memory.

We can fix this by just leaving the memory intact once it
has made it into the cache. This may leave an unused entry
in the cache, but that's OK. And it means we also catch a
similar situation: we may not have allocated at all in this
invocation, but simply be pointing to a cached entry from a
previous invocation (which is relying on that entry being
present).

The new test in t1411 exercises this case and fails when run
with --valgrind or ASan.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreflog-walk: duplicate strings in complete_reflogs list
Jeff King [Fri, 7 Jul 2017 08:39:50 +0000 (04:39 -0400)]
reflog-walk: duplicate strings in complete_reflogs list

As part of the add_reflog_to_walk() function, we keep a
string_list mapping refnames to their reflog contents. This
serves as a cache so that accessing the same reflog twice
requires only a single copy of the log in memory.

The string_list is initialized via xcalloc, meaning its
strdup_strings field is set to 0. But after inserting a
string into the list, we unconditionally call free() on the
string, leaving the list pointing to freed memory. If
another reflog is added (e.g., "git log -g HEAD HEAD"), then
the second one may have unpredictable results.

The extra free was added by 5026b47175 (add_reflog_for_walk:
avoid memory leak, 2017-05-04). Though if you look
carefully, you can see that the code was buggy even before
then. If we tried to read the reflogs by time but came up
with no entries, we exited with an error, freeing the string
in that code path. So the bug was harder to trigger, but
still there.

We can fix it by just asking the string list to make a copy
of the string. Technically we could fix the problem by not
calling free() on our string (and just handing over
ownership to the string list), but there are enough
conditionals that it's quite hard to figure out which code
paths need the free and which do not. Simpler is better
here.

The new test reliably shows the problem when run with
--valgrind or ASAN.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/commit.c: fix a typo in the comment
Kaartic Sivaraam [Thu, 6 Jul 2017 03:19:57 +0000 (08:49 +0530)]
builtin/commit.c: fix a typo in the comment

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreflog-walk: skip over double-null oid due to HEAD rename
Jeff King [Wed, 5 Jul 2017 07:57:37 +0000 (03:57 -0400)]
reflog-walk: skip over double-null oid due to HEAD rename

Since 39ee4c6c2f (branch: record creation of renamed branch
in HEAD's log, 2017-02-20), a rename on the currently
checked out branch will create two entries in the HEAD
reflog: one where the branch goes away (switching to the
null oid), and one where it comes back (switching away from
the null oid).

This confuses the reflog-walk code. When walking backwards,
it first sees the null oid in the "old" field of the second
entry. Thanks to the "root commit" logic added by 71abeb753f
(reflog: continue walking the reflog past root commits,
2016-06-03), we keep looking for the next entry by scanning
the "new" field from the previous entry. But that field is
also null! We need to go just a tiny bit further, and look
at its "old" field. But with the current code, we decide the
reflog has nothing else to show and just give up. To the
user this looks like the reflog was truncated by the rename
operation, when in fact those entries are still there.

This patch does the absolute minimal fix, which is to look
back that one extra level and keep traversing.

The resulting behavior may not be the _best_ thing to do in
the long run (for example, we show both reflog entries each
with the same commit id), but it's a simple way to fix the
problem without risking further regressions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5534: fix misleading grep invocation
Johannes Schindelin [Wed, 5 Jul 2017 11:37:49 +0000 (13:37 +0200)]
t5534: fix misleading grep invocation

It seems to be a little-known feature of `grep` (and it certainly came
as a surprise to this here developer who believed to know the Unix tools
pretty well) that multiple patterns can be passed in the same
command-line argument simply by separating them by newlines. Watch, and
learn:

$ printf '1\n2\n3\n' | grep "$(printf '1\n3\n')"
1
3

That behavior also extends to patterns passed via `-e`, and it is not
modified by passing the option `-E` (but trying this with -P issues the
error "grep: the -P option only supports a single pattern").

It seems that there are more old Unix hands who are surprised by this
behavior, as grep invocations of the form

grep "$(git rev-parse A B) C" file

were introduced in a85b377d041 (push: the beginning of "git push
--signed", 2014-09-12), and later faithfully copy-edited in b9459019bbb
(push: heed user.signingkey for signed pushes, 2014-10-22).

Please note that the output of `git rev-parse A B` separates the object
IDs via *newlines*, not via spaces, and those newlines are preserved
because the interpolation is enclosed in double quotes.

As a consequence, these tests try to validate that the file contains
either A's object ID, or B's object ID followed by C, or both. Clearly,
however, what the test wanted to see is that there is a line that
contains all of them.

This is clearly unintended, and the grep invocations in question really
match too many lines.

Fix the test by avoiding the newlines in the patterns.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1dc: update from upstream
Ævar Arnfjörð Bjarmason [Sat, 1 Jul 2017 22:05:45 +0000 (22:05 +0000)]
sha1dc: update from upstream

Update sha1dc from the latest version by the upstream maintainer[1].

See commit 6b851e536b ("sha1dc: update from upstream", 2017-06-06) for
the last update.

This solves the Big Endian detection on Solaris reported against
v2.13.2[2], hopefully without any regressions. A version of this has
been tested on two Solaris SPARC installations, Cygwin (by jturney on
cygwin@Freenode), and on numerous more boring systems (mainly
linux/x86_64). See [3] for a discussion of the implementation and
platform-specific issues.

See commit a0103914c2 ("sha1dc: update from upstream", 2017-05-20) and
6b851e536b ("sha1dc: update from upstream", 2017-06-06) for previous
attempts in the 2.13 series to address various compile-time feature
detection in this library.

1. https://github.com/cr-marcstevens/sha1collisiondetection/commit/19d97bf5af05312267c2e874ee6bcf584d9e9681
2. <CAKKM46tHq13XiW5C8sux3=PZ1VHSu_npG8ExfWwcPD7rkZkyRQ@mail.gmail.com>
   (https://public-inbox.org/git/CAKKM46tHq13XiW5C8sux3=PZ1VHSu_npG8ExfWwcPD7rkZkyRQ@mail.gmail.com/)
3. https://github.com/cr-marcstevens/sha1collisiondetection/pull/34

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: use DIFF_XDL_SET macro
Stefan Beller [Thu, 29 Jun 2017 22:19:32 +0000 (15:19 -0700)]
merge-recursive: use DIFF_XDL_SET macro

Instead of implementing this on our own, just use a convenience macro.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubmodule--helper: do not call utf8_fprintf() unnecessarily
Junio C Hamano [Wed, 28 Jun 2017 20:38:48 +0000 (13:38 -0700)]
submodule--helper: do not call utf8_fprintf() unnecessarily

The helper function utf8_fprintf(fp, ...) has exactly the same
effect to the output stream fp as fprintf(fp, ...) does, and the
only difference is that its return value counts in display columns
consumed (assuming that the payload is encoded in UTF-8), as opposed
to number of bytes.

There is no reason to call it unless the caller cares about its
return value.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1450: use egrep for regexp "alternation"
Junio C Hamano [Wed, 28 Jun 2017 17:17:04 +0000 (10:17 -0700)]
t1450: use egrep for regexp "alternation"

GNU grep allows "\(A\|B\)" as alternation in BRE, but this is an
extension not understood by some other implementations of grep
(Michael Kebe reported an breakage on Solaris).

Rewrite the offending test to ERE and use egrep instead.

Noticed-by: Michael Kebe <michael.kebe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubtree: honour USE_ASCIIDOCTOR when set
A. Wilcox [Wed, 28 Jun 2017 02:49:16 +0000 (21:49 -0500)]
subtree: honour USE_ASCIIDOCTOR when set

Defining USE_ASCIIDOCTOR=1 when building Git uses asciidoctor over
asciidoc when generating DocBook and man page documentation.  However,
the contrib/subtree module does not presently honour that flag.

This causes a build failure when asciidoc is not present on the build
system.  Instead, adapt the main Documentation/Makefile logic to use
asciidoctor when requested.

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoapply: check git diffs for mutually exclusive header lines
René Scharfe [Tue, 27 Jun 2017 17:03:39 +0000 (19:03 +0200)]
apply: check git diffs for mutually exclusive header lines

A file can either be added, removed, copied, or renamed, but no two of
these actions can be done by the same patch.  Some of these combinations
provoke error messages due to missing file names, and some are only
caught by an assertion.  Check git patches already as they are parsed
and report conflicting lines on sight.

Found by Vegard Nossum using AFL.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoapply: check git diffs for invalid file modes
René Scharfe [Tue, 27 Jun 2017 17:03:47 +0000 (19:03 +0200)]
apply: check git diffs for invalid file modes

An empty string as mode specification is accepted silently by git apply,
as Vegard Nossum found out using AFL.  It's interpreted as zero.  Reject
such bogus file modes, and only accept ones consisting exclusively of
octal digits.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoapply: check git diffs for missing old filenames
René Scharfe [Tue, 27 Jun 2017 17:03:30 +0000 (19:03 +0200)]
apply: check git diffs for missing old filenames

2c93286a (fix "git apply --index ..." not to deref NULL) added a check
for git patches missing a +++ line, preventing a segfault.  Check for
missing --- lines as well, and add a test for each case.

Found by Vegard Nossum using AFL.

Original-patch-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopack-bitmap: don't perform unaligned memory access
James Clarke [Mon, 26 Jun 2017 15:16:12 +0000 (16:16 +0100)]
pack-bitmap: don't perform unaligned memory access

The preceding bitmap entries have a 1-byte XOR-offset and 1-byte flags,
so their size is not a multiple of 4. Thus the name-hash cache is only
guaranteed to be 2-byte aligned and so we must use get_be32 rather than
indexing the array directly.

Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1700: make sure split-index respects core.sharedrepository
Christian Couder [Sun, 25 Jun 2017 04:34:29 +0000 (06:34 +0200)]
t1700: make sure split-index respects core.sharedrepository

Add a few tests to check that both the split-index file and the
shared-index file are created using the right permissions when
core.sharedrepository is set.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1301: move modebits() to test-lib-functions.sh
Christian Couder [Sun, 25 Jun 2017 04:34:28 +0000 (06:34 +0200)]
t1301: move modebits() to test-lib-functions.sh

As the modebits() function can be useful outside t1301,
let's move it into test-lib-functions.sh, and while at
it let's rename it test_modebits().

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoread-cache: use shared perms when writing shared index
Christian Couder [Sun, 25 Jun 2017 04:34:27 +0000 (06:34 +0200)]
read-cache: use shared perms when writing shared index

Since f6ecc62dbf (write_shared_index(): use tempfile module, 2015-08-10)
write_shared_index() has been using mks_tempfile() to create the
temporary file that will become the shared index.

But even before that, it looks like the functions used to create this
file didn't call adjust_shared_perm(), which means that the shared
index file has always been created with 600 permissions regardless
of the shared permission settings.

Because of that, on repositories created with `git init --shared=all`
and using the split index feature, one gets an error like:

fatal: .git/sharedindex.a52f910b489bc462f187ab572ba0086f7b5157de: index file open failed: Permission denied

when another user performs any operation that reads the shared index.

Call adjust_shared_perm() on the temporary file created by
mks_tempfile() ourselves to adjust the permission bits.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.13.2 v2.13.2
Junio C Hamano [Sat, 24 Jun 2017 22:31:36 +0000 (15:31 -0700)]
Git 2.13.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'sn/reset-doc-typofix' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:35 +0000 (15:29 -0700)]
Merge branch 'sn/reset-doc-typofix' into maint

Doc update.

* sn/reset-doc-typofix:
  doc: git-reset: fix a trivial typo

6 years agoMerge branch 'sg/doc-pretty-formats' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:35 +0000 (15:29 -0700)]
Merge branch 'sg/doc-pretty-formats' into maint

Doc update.

* sg/doc-pretty-formats:
  docs/pretty-formats: stress that %- removes all preceding line-feeds

6 years agoMerge branch 'sd/t3200-branch-m-test' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:34 +0000 (15:29 -0700)]
Merge branch 'sd/t3200-branch-m-test' into maint

New test.

* sd/t3200-branch-m-test:
  t3200: add test for single parameter passed to -m option

6 years agoMerge branch 'sg/revision-parser-skip-prefix' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:34 +0000 (15:29 -0700)]
Merge branch 'sg/revision-parser-skip-prefix' into maint

Code clean-up.

* sg/revision-parser-skip-prefix:
  revision.c: use skip_prefix() in handle_revision_pseudo_opt()
  revision.c: use skip_prefix() in handle_revision_opt()
  revision.c: stricter parsing of '--early-output'
  revision.c: stricter parsing of '--no-{min,max}-parents'
  revision.h: turn rev_info.early_output back into an unsigned int

6 years agoMerge branch 'km/test-mailinfo-b-failure' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:33 +0000 (15:29 -0700)]
Merge branch 'km/test-mailinfo-b-failure' into maint

New tests.

* km/test-mailinfo-b-failure:
  t5100: add some more mailinfo tests

6 years agoMerge branch 'sb/submodule-rm-absorb' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:32 +0000 (15:29 -0700)]
Merge branch 'sb/submodule-rm-absorb' into maint

Doc update to a recently graduated topic.

* sb/submodule-rm-absorb:
  Documentation/git-rm: correct submodule description

6 years agoMerge branch 'jc/diff-tree-stale-comment' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:31 +0000 (15:29 -0700)]
Merge branch 'jc/diff-tree-stale-comment' into maint

Comment fix.

* jc/diff-tree-stale-comment:
  diff-tree: update stale in-code comments

6 years agoMerge branch 'ps/stash-push-pathspec-fix' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:30 +0000 (15:29 -0700)]
Merge branch 'ps/stash-push-pathspec-fix' into maint

"git stash push <pathspec>" did not work from a subdirectory at all.
Bugfix for a topic in v2.13

* ps/stash-push-pathspec-fix:
  git-stash: fix pushing stash with pathspec from subdir

6 years agoMerge branch 'ls/github' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:29 +0000 (15:29 -0700)]
Merge branch 'ls/github' into maint

Help contributors that visit us at GitHub.

* ls/github:
  Configure Git contribution guidelines for github.com

6 years agoMerge branch 'jk/pack-idx-corruption-safety' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:29 +0000 (15:29 -0700)]
Merge branch 'jk/pack-idx-corruption-safety' into maint

A flaky test has been corrected.

* jk/pack-idx-corruption-safety:
  t5313: make extended-table test more deterministic

6 years agoMerge branch 'jk/diff-blob' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:28 +0000 (15:29 -0700)]
Merge branch 'jk/diff-blob' into maint

The result from "git diff" that compares two blobs, e.g. "git diff
$commit1:$path $commit2:$path", used to be shown with the full
object name as given on the command line, but it is more natural to
use the $path in the output and use it to look up .gitattributes.

* jk/diff-blob:
  diff: use blob path for blob/file diffs
  diff: use pending "path" if it is available
  diff: use the word "path" instead of "name" for blobs
  diff: pass whole pending entry in blobinfo
  handle_revision_arg: record paths for pending objects
  handle_revision_arg: record modes for "a..b" endpoints
  t4063: add tests of direct blob diffs
  get_sha1_with_context: dynamically allocate oc->path
  get_sha1_with_context: always initialize oc->symlink_path
  sha1_name: consistently refer to object_context as "oc"
  handle_revision_arg: add handle_dotdot() helper
  handle_revision_arg: hoist ".." check out of range parsing
  handle_revision_arg: stop using "dotdot" as a generic pointer
  handle_revision_arg: simplify commit reference lookups
  handle_revision_arg: reset "dotdot" consistently

6 years agoMerge branch 'jc/name-rev-lw-tag' into maint
Junio C Hamano [Sat, 24 Jun 2017 22:29:27 +0000 (15:29 -0700)]
Merge branch 'jc/name-rev-lw-tag' into maint

"git describe --contains" penalized light-weight tags so much that
they were almost never considered.  Instead, give them about the
same chance to be considered as an annotated tag that is the same
age as the underlying commit would.

* jc/name-rev-lw-tag:
  name-rev: favor describing with tags and use committer date to tiebreak
  name-rev: refactor logic to see if a new candidate is a better name

6 years agodoc: clarify syntax for %C(auto,...) in pretty formats
Andreas Heiduk [Sat, 24 Jun 2017 07:22:58 +0000 (09:22 +0200)]
doc: clarify syntax for %C(auto,...) in pretty formats

The manual correctly describes the syntax with `auto,` but the
trailing `,` is hard to spot in a terminal.  The HTML format does not
have this problem.  Adding an example helps both worlds.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot3420: fix under GETTEXT_POISON build
Junio C Hamano [Fri, 23 Jun 2017 18:56:25 +0000 (11:56 -0700)]
t3420: fix under GETTEXT_POISON build

Newly added tests to t3420 in this series prepare expected
human-readable output from "git rebase -i" and then compare the
actual output with it.  As the output from the command is designed
to go through i18n/l10n, we need to use test_i18ncmp to tell
GETTEXT_POISON build that it is OK the output does not match.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoadd--interactive: quote commentChar regex
Jeff King [Wed, 21 Jun 2017 19:28:59 +0000 (15:28 -0400)]
add--interactive: quote commentChar regex

Since c9d961647 (i18n: add--interactive: mark
edit_hunk_manually message for translation, 2016-12-14),
when the user asks to edit a hunk manually, we respect
core.commentChar in generating the edit instructions.
However, when we then strip out comment lines, we use a
simple regex like:

  /^$commentChar/

If your chosen comment character is a regex metacharacter,
then that will behave in a confusing manner ("$", for
instance, would only eliminate blank lines, not actual
comment lines).

We can fix that by telling perl not to respect
metacharacters.

Reported-by: Christian Rösch <christian@croesch.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoadd--interactive: handle EOF in prompt_yesno
Jeff King [Wed, 21 Jun 2017 19:26:36 +0000 (15:26 -0400)]
add--interactive: handle EOF in prompt_yesno

The prompt_yesno function loops indefinitely waiting for a
"y" or "n" response. But it doesn't handle EOF, meaning
that we can end up in an infinite loop of reading EOF from
stdin. One way to simulate that is with:

  echo e | GIT_EDITOR='echo corrupt >' git add -p

Let's break out of the loop and propagate the undef to the
caller. Without modifying the callers that effectively turns
it into a "no" response. This is reasonable for both of the
current callers, and it leaves room for any future caller to
check for undef explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoauto-correct: tweak phrasing
Marc Branchaud [Wed, 21 Jun 2017 13:57:38 +0000 (09:57 -0400)]
auto-correct: tweak phrasing

When help.autoCorrect is enabled, an invalid git command prints a
warning and a continuation message, which differs depending on
whether or not the value of help.autoCorrect is positive or
negative.

With help.autoCorrect = 15:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'
   in 1.5 seconds automatically...

With help.autoCorrect < 0:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'

The continuation message's phrasing is awkward.  This commit cleans it up.
As a bonus, we now use full-sentence strings which make translation easier.

With help.autoCorrect = 15:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing in 1.5 seconds, assuming that you meant 'log'.

With help.autoCorrect < 0:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7508: fix a broken indentation
Kaartic Sivaraam [Wed, 21 Jun 2017 12:31:45 +0000 (18:01 +0530)]
t7508: fix a broken indentation

Change the indentation from "\t " to "\t". This indenting issue was
introduced when the test was added in commit 1d2f393ac9
("status/commit: show staged submodules regardless of ignore
config", 2014-04-05).

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: add more regression tests for console output
Phillip Wood [Mon, 19 Jun 2017 17:56:05 +0000 (18:56 +0100)]
rebase: add more regression tests for console output

Check the console output when using --autostash and the stash does not
apply is what we expect. The test is quite strict but should catch any
changes to the console output from the various rebase flavors.

Thanks-to: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: add regression tests for console output
Phillip Wood [Mon, 19 Jun 2017 17:56:04 +0000 (18:56 +0100)]
rebase: add regression tests for console output

Check the console output when using --autostash and the stash applies
cleanly is what we expect. The test is quite strict but should catch
any changes to the console output from the various rebase flavors.

Thanks-to: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase -i: add test for reflog message
Phillip Wood [Mon, 19 Jun 2017 17:56:03 +0000 (18:56 +0100)]
rebase -i: add test for reflog message

Check that the reflog message written to the branch reflog when the
rebase is completed is correct

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosequencer: print autostash messages to stderr
Johannes Schindelin [Mon, 19 Jun 2017 17:56:02 +0000 (18:56 +0100)]
sequencer: print autostash messages to stderr

The rebase messages are printed to stderr traditionally. However due
to a bug introduced in 587947750bd (rebase: implement --[no-]autostash
and rebase.autostash, 2013-05-12) which was faithfully copied when
reimplementing parts of the interactive rebase in the sequencer the
autostash messages are printed to stdout instead.

It is time to fix that: let's print the autostash messages to stderr
instead of stdout.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomergetools/meld: improve compatibiilty with Meld on macOS X
David Aguilar [Mon, 19 Jun 2017 02:10:33 +0000 (19:10 -0700)]
mergetools/meld: improve compatibiilty with Meld on macOS X

The macOS X fork of Meld[1] requires a "=" in the "--output"
argument, as it uses a wrapper[2] script that munges the
"--output" argument before calling into the common "meld"
script.

The macOS X wrapper script[2] accepts "--output=<filename>"
only, despite the fact that the underlying meld code accepts
both "--output <filename" and "--output=<filename>"[3].

All versions of meld which accept "--output" accept it in
the "--output=<filename>" form, so use "--output=<file>" for
maximum compatibility.

[1] https://github.com/yousseb/meld
[2] https://github.com/yousseb/meld/blob/master/osx/Meld
[3] https://github.com/yousseb/meld/issues/42

Reported-by: Matthew Groth <mgroth49@gmail.com>
Helped-by: Samuel Lijin <sxlijin@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodocs/pretty-formats: stress that %- removes all preceding line-feeds
SZEDER Gábor [Thu, 15 Jun 2017 10:36:07 +0000 (12:36 +0200)]
docs/pretty-formats: stress that %- removes all preceding line-feeds

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: git-reset: fix a trivial typo
Štěpán Němec [Wed, 14 Jun 2017 09:36:58 +0000 (11:36 +0200)]
doc: git-reset: fix a trivial typo

Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoalias: use the early config machinery to expand aliases
Johannes Schindelin [Wed, 14 Jun 2017 11:36:00 +0000 (13:36 +0200)]
alias: use the early config machinery to expand aliases

Instead of discovering the .git/ directory, reading the config and then
trying to painstakingly reset all the global state if we did not find a
matching alias, let's use the early config machinery instead.

It may look like unnecessary work to discover the .git/ directory in the
early config machinery and then call setup_git_directory_gently() in the
case of a shell alias, repeating the very same discovery *again*.
However, we have to do this as the early config machinery takes pains
*not* to touch any global state, while shell aliases expect a possibly
changed working directory and at least the GIT_PREFIX and GIT_DIR
variables to be set.

This change also fixes a known issue where Git tried to read the pager
config from an incorrect path in a subdirectory of a Git worktree if an
alias expanded to a shell command.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7006: demonstrate a problem with aliases in subdirectories
Johannes Schindelin [Wed, 14 Jun 2017 11:35:56 +0000 (13:35 +0200)]
t7006: demonstrate a problem with aliases in subdirectories

When expanding aliases, the git_dir is set during the alias expansion
(by virtue of running setup_git_directory_gently()).

This git_dir may be relative to the current working directory, and
indeed often is simply ".git/".

When the alias expands to a shell command, we restore the original
working directory, though, yet we do not reset git_dir.

As a consequence, subsequent read_early_config() runs will mistake the
git_dir to be populated properly and not find the correct config.

Demonstrate this problem by adding a test case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1308: relax the test verifying that empty alias values are disallowed
Johannes Schindelin [Wed, 14 Jun 2017 11:35:53 +0000 (13:35 +0200)]
t1308: relax the test verifying that empty alias values are disallowed

We are about to change the way aliases are expanded, to use the early
config machinery.

This machinery reports errors in a slightly different manner than the
cached config machinery.

Let's not get hung up by the precise wording of the message mentioning
the line number. It is really sufficient to verify that all the relevant
information is given to the user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agohelp: use early config when autocorrecting aliases
Johannes Schindelin [Wed, 14 Jun 2017 11:35:50 +0000 (13:35 +0200)]
help: use early config when autocorrecting aliases

Git has this feature which suggests similar commands (including aliases)
in case the user specified an unknown command.

This feature currently relies on a side effect of the way we expand
aliases right now: when a command is not a builtin, we use the regular
config machinery (meaning: discovering the .git/ directory and
initializing global state such as the config cache) to see whether the
command refers to an alias.

However, we will change the way aliases are expanded in the next
commits, to use the early config instead. That means that the
autocorrect feature can no longer discover the available aliases by
looking at the config cache (because it has not yet been initialized).

So let's just use the early config machinery instead.

This is slightly less performant than the previous way, as the early
config is used *twice*: once to see whether the command refers to an
alias, and then to see what aliases are most similar. However, this is
hardly a performance-critical code path, so performance is less important
here.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoconfig: report correct line number upon error
Johannes Schindelin [Wed, 14 Jun 2017 11:35:46 +0000 (13:35 +0200)]
config: report correct line number upon error

When get_value() parses a key/value pair, it is possible that the line
number is decreased (because the \n has been consumed already) before the
key/value pair is passed to the callback function, to allow for the
correct line to be attributed in case of an error.

However, when git_parse_source() asks get_value() to parse the key/value
pair, the error reporting is performed *after* get_value() returns.

Which means that we have to be careful not to increase the line number
in get_value() after the callback function returned an error.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodiscover_git_directory(): avoid setting invalid git_dir
Johannes Schindelin [Wed, 14 Jun 2017 11:35:26 +0000 (13:35 +0200)]
discover_git_directory(): avoid setting invalid git_dir

When discovering a .git/ directory, we take pains to ensure that its
repository format version matches Git's expectations, and we return NULL
otherwise.

However, we still appended the invalid path to the strbuf passed as
argument.

Let's just reset the strbuf to the state before we appended the .git/
directory that was eventually rejected.

There is another early return path in that function, when
setup_git_directory_gently_1() returns GIT_DIR_NONE or an error. In that
case, the gitdir parameter has not been touched, therefore there is no
need for an equivalent change in that code path.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodiff-highlight: split code into module
Jeff King [Thu, 15 Jun 2017 16:30:55 +0000 (12:30 -0400)]
diff-highlight: split code into module

The diff-so-fancy project is also written in perl, and most
of its users pipe diffs through both diff-highlight and
diff-so-fancy. It would be nice if this could be done in a
single script. So let's pull most of diff-highlight's code
into its own module which can be used by diff-so-fancy.

In addition, we'll abstract a few basic items like reading
from stdio so that a script using the module can do more
processing before or after diff-highlight handles the lines.
See the README update for more details.

One small downside is that the diff-highlight script must
now be built using the Makefile. There are ways around this,
but it quickly gets into perl arcana. Let's go with the
simple solution. As a bonus, our Makefile now respects the
PERL_PATH variable if it is set.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopretty: recalculate duplicate short hashes
René Scharfe [Wed, 14 Jun 2017 18:24:25 +0000 (20:24 +0200)]
pretty: recalculate duplicate short hashes

b9c6232138 (--format=pretty: avoid calculating expensive expansions
twice) optimized adding short hashes multiple times by using the
fact that the output strbuf was only ever simply appended to and
copying the added string from the previous run.  That prerequisite
is no longer given; we now have modfiers like %< and %+ that can
cause the cache to lose track of the correct offsets.  Remove it.

Reported-by: Michael Giuffrida <michaelpg@chromium.org>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: do not use `rm .git/index` when normalizing line endings
Andreas Heiduk [Wed, 14 Jun 2017 06:51:39 +0000 (08:51 +0200)]
doc: do not use `rm .git/index` when normalizing line endings

When illustrating how to normalize the line endings, the
documentation in gitattributes tells the user to `rm .git/index`.

This is incorrect for two reasons:

 - Users shouldn't be instructed to mess around with the internal
   implementation of Git using raw file system tools like `rm`.

 - Within a submodule or an additional working tree `.git` is just a
   file containing a `gitdir: <path>` pointer into the real `.git`
   directory.  Therefore `rm .git/index` does not work.

The purpose of the `rm .git/index` instruction is to remove all entries
from the index without touching the working tree.  The way to do this
with Git is to use `read-tree --empty`.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoPrepare for 2.13.2
Junio C Hamano [Tue, 13 Jun 2017 20:30:16 +0000 (13:30 -0700)]
Prepare for 2.13.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ad/pull-remote-doc' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:06 +0000 (13:27 -0700)]
Merge branch 'ad/pull-remote-doc' into maint

Docfix.

* ad/pull-remote-doc:
  docs: fix formatting and grammar

6 years agoMerge branch 'jk/drop-free-refspecs' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:06 +0000 (13:27 -0700)]
Merge branch 'jk/drop-free-refspecs' into maint

Code clean-up.

* jk/drop-free-refspecs:
  remote: drop free_refspecs() function

6 years agoMerge branch 'jk/connect-symref-info-leak-fix' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:05 +0000 (13:27 -0700)]
Merge branch 'jk/connect-symref-info-leak-fix' into maint

Leakfix.

* jk/connect-symref-info-leak-fix:
  connect.c: fix leak in parse_one_symref_info()

6 years agoMerge branch 'rf/completion-config-commit' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:05 +0000 (13:27 -0700)]
Merge branch 'rf/completion-config-commit' into maint

Completion update.

* rf/completion-config-commit:
  completion: add completions for git config commit

6 years agoMerge branch 'ab/t3070-test-dedup' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:04 +0000 (13:27 -0700)]
Merge branch 'ab/t3070-test-dedup' into maint

Test cleanup.

* ab/t3070-test-dedup:
  wildmatch test: remove redundant duplicate test

6 years agoMerge branch 'jh/memihash-opt' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:03 +0000 (13:27 -0700)]
Merge branch 'jh/memihash-opt' into maint

perf-test update.

* jh/memihash-opt:
  p0004: don't error out if test repo is too small
  p0004: don't abort if multi-threaded is too slow
  p0004: use test_perf
  p0004: avoid using pipes
  p0004: simplify calls of test-lazy-init-name-hash

6 years agoMerge branch 'tb/pull-ff-rebase-autostash' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:03 +0000 (13:27 -0700)]
Merge branch 'tb/pull-ff-rebase-autostash' into maint

"git pull --rebase --autostash" didn't auto-stash when the local history
fast-forwards to the upstream.

* tb/pull-ff-rebase-autostash:
  pull: ff --rebase --autostash works in dirty repo

6 years agoMerge branch 'jh/close-index-before-stat' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:02 +0000 (13:27 -0700)]
Merge branch 'jh/close-index-before-stat' into maint

The timestamp of the index file is now taken after the file is
closed, to help Windows, on which a stale timestamp is reported by
fstat() on a file that is opened for writing and data was written
but not yet closed.

* jh/close-index-before-stat:
  read-cache: close index.lock in do_write_index

6 years agoMerge branch 'sl/clean-d-ignored-fix' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:01 +0000 (13:27 -0700)]
Merge branch 'sl/clean-d-ignored-fix' into maint

"git clean -d" used to clean directories that has ignored files,
even though the command should not lose ignored ones without "-x".
"git status --ignored"  did not list ignored and untracked files
without "-uall".  These have been corrected.

* sl/clean-d-ignored-fix:
  clean: teach clean -d to preserve ignored paths
  dir: expose cmp_name() and check_contains()
  dir: hide untracked contents of untracked dirs
  dir: recurse into untracked dirs for ignored files
  t7061: status --ignored should search untracked dirs
  t7300: clean -d should skip dirs with ignored files

6 years agoMerge branch 'dk/send-email-avoid-net-smtp-ssl-when-able' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:01 +0000 (13:27 -0700)]
Merge branch 'dk/send-email-avoid-net-smtp-ssl-when-able' into maint

A hotfix to a topic in 'master'.

* dk/send-email-avoid-net-smtp-ssl-when-able:
  send-email: Net::SMTP::starttls was introduced in v2.34
  send-email: Net::SMTP::SSL is obsolete, use only when necessary

6 years agoMerge branch 'jc/skip-test-in-the-middle' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:27:00 +0000 (13:27 -0700)]
Merge branch 'jc/skip-test-in-the-middle' into maint

A recent update to t5545-push-options.sh started skipping all the
tests in the script when a web server testing is disabled or
unavailable, not just the ones that require a web server.  Non HTTP
tests have been salvaged to always run in this script.

* jc/skip-test-in-the-middle:
  t5545: enhance test coverage when no http server is installed
  test: allow skipping the remainder

6 years agoMerge branch 'bw/forking-and-threading' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:26:59 +0000 (13:26 -0700)]
Merge branch 'bw/forking-and-threading' into maint

The "run-command" API implementation has been made more robust
against dead-locking in a threaded environment.

* bw/forking-and-threading:
  usage.c: drop set_error_handle()
  run-command: restrict PATH search to executable files
  run-command: expose is_executable function
  run-command: block signals between fork and execve
  run-command: add note about forking and threading
  run-command: handle dup2 and close errors in child
  run-command: eliminate calls to error handling functions in child
  run-command: don't die in child when duping /dev/null
  run-command: prepare child environment before forking
  string-list: add string_list_remove function
  run-command: use the async-signal-safe execv instead of execvp
  run-command: prepare command before forking
  t0061: run_command executes scripts without a #! line
  t5550: use write_script to generate post-update hook

6 years agoMerge branch 'jk/bug-to-abort' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:26:59 +0000 (13:26 -0700)]
Merge branch 'jk/bug-to-abort' into maint

Introduce the BUG() macro to improve die("BUG: ...").

* jk/bug-to-abort:
  usage: add NORETURN to BUG() function definitions
  config: complain about --local outside of a git repo
  setup_git_env: convert die("BUG") to BUG()
  usage.c: add BUG() function

6 years agoMerge branch 'sb/checkout-recurse-submodules' into maint
Junio C Hamano [Tue, 13 Jun 2017 20:26:59 +0000 (13:26 -0700)]
Merge branch 'sb/checkout-recurse-submodules' into maint

"git checkout --recurse-submodules" did not quite work with a
submodule that itself has submodules.

* sb/checkout-recurse-submodules:
  submodule: properly recurse for read-tree and checkout
  submodule: avoid auto-discovery in new working tree manipulator code
  submodule_move_head: reuse child_process structure for futher commands

6 years agoConfigure Git contribution guidelines for github.com
Lars Schneider [Tue, 13 Jun 2017 08:18:07 +0000 (10:18 +0200)]
Configure Git contribution guidelines for github.com

Many open source projects use github.com for their contribution process.
Although we mirror the Git core repository to github.com [1] we do not
use any other github.com service. This is unknown/unexpected to a
number of (potential) contributors and consequently they create Pull
Requests against our mirror with their contributions. These Pull
Requests become stale. This is frustrating to them as they think we
ignore them and it is also unsatisfactory for us as we miss potential
code improvements and/or new contributors.

GitHub contribution guidelines and a GitHub Pull Request template that
is visible to every Pull Request creator can be configured with special
files in a Git repository [2]. Let's make use of this!

[1] https://github.com/git/git
[2] https://help.github.com/articles/creating-a-pull-request-template-for-your-repository/

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-stash: fix pushing stash with pathspec from subdir
Patrick Steinhardt [Tue, 13 Jun 2017 11:38:34 +0000 (13:38 +0200)]
git-stash: fix pushing stash with pathspec from subdir

The `git stash push` command recently gained the ability to get a
pathspec as its argument to only stash matching files. Calling this
command from a subdirectory does not work, though, as one of the first
things we do is changing to the top level directory without keeping
track of the prefix from which the command is being run.

Fix the shortcoming by storing the prefix previous to the call to
`cd_to_toplevel` and then subsequently using `git rev-parse --prefix` to
correctly resolve the pathspec. Add a test to catch future breakage of
this usecase.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>