git
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 agoapply: use starts_with() in gitdiff_verify_name()
René Scharfe [Sat, 1 Jul 2017 09:10:07 +0000 (11:10 +0200)] 
apply: use starts_with() in gitdiff_verify_name()

Avoid running over the end of line -- a C string whose length is not
known to this function -- by using starts_with() instead of memcmp(3)
for checking if it starts with "/dev/null".  Also simply include the
newline in the string constant to compare against.  Drop a comment that
just states the obvious.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
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 agot9700: add tests for Git::unquote_path()
Phillip Wood [Fri, 30 Jun 2017 09:49:12 +0000 (10:49 +0100)] 
t9700: add tests for Git::unquote_path()

Check that unquote_path() handles spaces and escape sequences
properly.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit::unquote_path(): throw an exception on bad path
Phillip Wood [Fri, 30 Jun 2017 09:49:11 +0000 (10:49 +0100)] 
Git::unquote_path(): throw an exception on bad path

This is what the other routines in Git.pm do if there's an error.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit::unquote_path(): handle '\a'
Phillip Wood [Fri, 30 Jun 2017 09:49:10 +0000 (10:49 +0100)] 
Git::unquote_path(): handle '\a'

unquote_path() does not handle quoted paths containing '\a',
even though quote.c::unquote_c_style() does, and quote.c:sq_lookup[]
tells quote.c::sq_must_quote() that '\007' must be quoted as '\a'.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoadd -i: move unquote_path() to Git.pm
Phillip Wood [Fri, 30 Jun 2017 09:49:09 +0000 (10:49 +0100)] 
add -i: move unquote_path() to Git.pm

Move unquote_path() from git-add--interactive to Git.pm so it can be
used by other scripts. Note this is a straight copy, it does not
handle '\a'. That will be fixed in the next commit.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
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>
6 years agot3200: add test for single parameter passed to -m option
Sahil Dua [Tue, 13 Jun 2017 10:47:22 +0000 (10:47 +0000)] 
t3200: add test for single parameter passed to -m option

Add a test for the case when only one parameter is passed to '-m'
(move/rename) option.

For example - if 'git branch -m bbb' is run while checked out on aaa
branch, it should rename the currently checked out branch to bbb.
There was no test for this particular case with only one parameter
for -m option. However, there's one similar test case for -M option.

Add test for making sure HEAD points to the bbb (new branch name). Also
add a test for making sure the reflog that is moved to 'bbb' retains
entries created for the currently checked out branch. Note that since
the topmost entry on reflog for bbb will be about branch creation, we
compare bbb@{1} (instead of bbb@{0}) with aaa@{0} to make sure the
reflog for bbb retains entries from aaa.

Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorevision.c: use skip_prefix() in handle_revision_pseudo_opt()
SZEDER Gábor [Fri, 9 Jun 2017 18:17:33 +0000 (20:17 +0200)] 
revision.c: use skip_prefix() in handle_revision_pseudo_opt()

Instead of starts_with() and a bunch of magic numbers.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorevision.c: use skip_prefix() in handle_revision_opt()
SZEDER Gábor [Fri, 9 Jun 2017 18:17:32 +0000 (20:17 +0200)] 
revision.c: use skip_prefix() in handle_revision_opt()

Instead of starts_with() and a bunch of magic numbers.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorevision.c: stricter parsing of '--early-output'
SZEDER Gábor [Fri, 9 Jun 2017 18:17:31 +0000 (20:17 +0200)] 
revision.c: stricter parsing of '--early-output'

The parsing of '--early-output' with or without its optional integer
argument allowed bogus options like '--early-output-foobarbaz' to slip
through and be ignored.

Fix it by parsing '--early-output' in the same way as other options
with an optional argument are parsed.  Furthermore, use strtoul_ui()
to parse the optional integer argument and to refuse negative numbers.

While at it, use skip_prefix() instead of starts_with() and magic
numbers.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorevision.c: stricter parsing of '--no-{min,max}-parents'
SZEDER Gábor [Fri, 9 Jun 2017 18:17:30 +0000 (20:17 +0200)] 
revision.c: stricter parsing of '--no-{min,max}-parents'

These two options are parsed using starts_with(), allowing things like
'git log --no-min-parents-foobarbaz' to succeed.

Use strcmp() instead.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorevision.h: turn rev_info.early_output back into an unsigned int
SZEDER Gábor [Sat, 10 Jun 2017 11:41:01 +0000 (13:41 +0200)] 
revision.h: turn rev_info.early_output back into an unsigned int

rev_info.early_output started out as an unsigned int in cdcefbc97 (Add
"--early-output" log flag for interactive GUI use, 2007-11-03), but
later it was turned into a single bit in a bit field in cc243c3ce
(show: --ignore-missing, 2011-05-18) without explanation, though the
code using it still expects it to be a regular integer type and uses
it as a counter.  Consequently, any even number given via
'--early-output=<N>', or indeed a plain '--early-output' defaulting to
100 effectively disabled the feature.

Turn rev_info.early_output back into its origin unsigned int data
type, making '--early-output' work again.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5100: add some more mailinfo tests
Kyle J. McKay [Wed, 31 May 2017 10:26:10 +0000 (03:26 -0700)] 
t5100: add some more mailinfo tests

Add some more simple mailinfo tests including a few that
produce:

  fatal: `pos + len' is too far after the end of the buffer

Mark those as 'test_expect_failure'.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot4005: modernize style and drop hard coded sha1
Stefan Beller [Wed, 7 Jun 2017 02:18:05 +0000 (19:18 -0700)] 
t4005: modernize style and drop hard coded sha1

Use modern style in the test t4005. Remove hard coded sha1 values.
Combine test prep work and the actual test. Rename the first
test to contain the word "setup".

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ab/sha1dc-maint' into maint
Junio C Hamano [Wed, 7 Jun 2017 00:31:53 +0000 (09:31 +0900)] 
Merge branch 'ab/sha1dc-maint' into maint

* ab/sha1dc-maint:
  sha1dc: update from upstream
  sha1dc: ignore indent-with-non-tab whitespace violations

6 years agosha1dc: update from upstream
Ævar Arnfjörð Bjarmason [Tue, 6 Jun 2017 15:12:29 +0000 (15:12 +0000)] 
sha1dc: update from upstream

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

See commit a0103914c2 ("sha1dc: update from upstream", 2017-05-20) for
the latest update. That update was done sans some whitespace changes
by upstream, which is why the diff here isn't the same as the upstream
cc46554..e139984.

It also brings in a change[2] upstream made which should hopefully
address the breakage in 2.13.1 on Cygwin, see [3]. Cygwin defines both
_BIG_ENDIAN and _LITTLE_ENDIAN.

Adam Dinwoodie reports on the mailing list that that upstream commit
fixes the issue on Cygwin[4].

1. https://github.com/cr-marcstevens/sha1collisiondetection/commit/e1399840b501a68ac6c8d7ed9a5cb1455480200e
2. https://github.com/cr-marcstevens/sha1collisiondetection/commit/a24eef58c0684078405f8c7a89f9b78271432005
3. <20170606100355.GC25777@dinwoodie.org> (https://public-inbox.org/git/20170606100355.GC25777@dinwoodie.org/)
4. <20170606124323.GD25777@dinwoodie.org> (https://public-inbox.org/git/20170606124323.GD25777@dinwoodie.org/)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1dc: ignore indent-with-non-tab whitespace violations
Jeff King [Tue, 6 Jun 2017 19:01:11 +0000 (15:01 -0400)] 
sha1dc: ignore indent-with-non-tab whitespace violations

The upstream sha1dc code indents some lines with spaces.
While this doesn't match Git's coding guidelines, it's better
to leave this imported code untouched than to try to make it
match our style. However, we can use .gitattributes to tell
"diff --check" and "git am" not to bother us about it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5313: make extended-table test more deterministic
Jeff King [Mon, 5 Jun 2017 19:15:25 +0000 (15:15 -0400)] 
t5313: make extended-table test more deterministic

Commit a1283866b (t5313: test bounds-checks of
corrupted/malicious pack/idx files, 2016-02-25) added a test
that requires our corrupted pack index to have two objects.
The entry for the first one remains untouched, but we
corrupt the entry for second one. Since the index stores the
entries in sha1-sorted order, this means that the test must
make sure that the sha1 of the object we expect to be
corrupted ("$object") sorts after the other placeholder
object.

That commit used the HEAD commit as the placeholder, but the
script never calls test_tick. That means that the commit
object (and thus its sha1) depends on the timestamp when the
test script is run. This usually works in practice, because
the sha1 of $object starts with "fff". The commit object
will sort after that only 1 in 4096 times, but when it does
the test will fail.

One obvious solution is to add the test_tick call to get a
deterministic commit sha1. But since we're relying on the
sort order for the test to function, let's make that very
explicit by just generating a second blob with a known sha1.

Reported-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoGit 2.13.1 v2.13.1
Junio C Hamano [Mon, 5 Jun 2017 00:05:38 +0000 (09:05 +0900)] 
Git 2.13.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ah/doc-rev-parse-short-default' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:23 +0000 (09:03 +0900)] 
Merge branch 'ah/doc-rev-parse-short-default' into maint

Doc update.

* ah/doc-rev-parse-short-default:
  doc: rewrite description for rev-parse --short

6 years agoMerge branch 'ah/doc-filter-branch-export-env' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:22 +0000 (09:03 +0900)] 
Merge branch 'ah/doc-filter-branch-export-env' into maint

Docfix.

* ah/doc-filter-branch-export-env:
  doc: filter-branch does not require re-export of vars

6 years agoMerge branch 'sd/t3200-typofix' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:22 +0000 (09:03 +0900)] 
Merge branch 'sd/t3200-typofix' into maint

Test fix.

* sd/t3200-typofix:
  branch test: fix invalid config key access

6 years agoMerge branch 'sb/t5531-update-desc' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:21 +0000 (09:03 +0900)] 
Merge branch 'sb/t5531-update-desc' into maint

The description strings for a few tests have been updated.

* sb/t5531-update-desc:
  t5531: fix test description

6 years agoMerge branch 'ah/doc-pretty-format-fix' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:20 +0000 (09:03 +0900)] 
Merge branch 'ah/doc-pretty-format-fix' into maint

Documentation fix.

* ah/doc-pretty-format-fix:
  Documentation: fix formatting typo in pretty-formats.txt

6 years agoMerge branch 'ah/doc-interpret-trailers-ifexists' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:19 +0000 (09:03 +0900)] 
Merge branch 'ah/doc-interpret-trailers-ifexists' into maint

Documentation fix.

* ah/doc-interpret-trailers-ifexists:
  Documentation: fix reference to ifExists for interpret-trailers

6 years agoMerge branch 'ab/ref-filter-no-contains' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:18 +0000 (09:03 +0900)] 
Merge branch 'ab/ref-filter-no-contains' into maint

Doc update to a recent topic.

* ab/ref-filter-no-contains:
  tag: duplicate mention of --contains should mention --no-contains

6 years agoMerge branch 'sg/core-filemode-doc-typofix' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:17 +0000 (09:03 +0900)] 
Merge branch 'sg/core-filemode-doc-typofix' into maint

* sg/core-filemode-doc-typofix:
  docs/config.txt: fix indefinite article in core.fileMode description

6 years agoMerge branch 'tb/dedup-crlf-tests' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:16 +0000 (09:03 +0900)] 
Merge branch 'tb/dedup-crlf-tests' into maint

* tb/dedup-crlf-tests:
  t0027: tests are not expensive; remove t0025

6 years agoMerge branch 'jn/credential-doc-on-clear' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:16 +0000 (09:03 +0900)] 
Merge branch 'jn/credential-doc-on-clear' into maint

Doc update.

* jn/credential-doc-on-clear:
  credential doc: make multiple-helper behavior more prominent

6 years agoMerge branch 'jk/url-insteadof-config' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:15 +0000 (09:03 +0900)] 
Merge branch 'jk/url-insteadof-config' into maint

The interaction of "url.*.insteadOf" and custom URL scheme's
whitelisting is now documented better.

* jk/url-insteadof-config:
  docs/config: mention protocol implications of url.insteadOf

6 years agoMerge branch 'jk/unbreak-am-h' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:15 +0000 (09:03 +0900)] 
Merge branch 'jk/unbreak-am-h' into maint

"git am -h" triggered a BUG().

* jk/unbreak-am-h:
  am: handle "-h" argument earlier

6 years agoMerge branch 'ab/sha1dc-maint' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:15 +0000 (09:03 +0900)] 
Merge branch 'ab/sha1dc-maint' into maint

The "collision detecting" SHA-1 implementation shipped with 2.13
was quite broken on some big-endian platforms and/or platforms that
do not like unaligned fetches.  Update to the upstream code which
has already fixed these issues.

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

6 years agoMerge branch 'js/bs-is-a-dir-sep-on-windows' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:15 +0000 (09:03 +0900)] 
Merge branch 'js/bs-is-a-dir-sep-on-windows' into maint

"foo\bar\baz" in "git fetch foo\bar\baz", even though there is no
slashes in it, cannot be a nickname for a remote on Windows, as
that is likely to be a pathname on a local filesystem.

* js/bs-is-a-dir-sep-on-windows:
  Windows: do not treat a path with backslashes as a remote's nick name
  mingw.h: permit arguments with side effects for is_dir_sep

6 years agoMerge branch 'jk/alternate-ref-optim' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:14 +0000 (09:03 +0900)] 
Merge branch 'jk/alternate-ref-optim' into maint

A test allowed both "git push" and "git receive-pack" on the other
end write their traces into the same file.  This is OK on platforms
that allows atomically appending to a file opened with O_APPEND,
but on other platforms led to a mangled output, causing
intermittent test failures.  This has been fixed by disabling
traces from "receive-pack" in the test.

* jk/alternate-ref-optim:
  t5400: avoid concurrent writes into a trace file

6 years agoMerge branch 'bm/interpret-trailers-cut-line-is-eom' into maint
Junio C Hamano [Mon, 5 Jun 2017 00:03:13 +0000 (09:03 +0900)] 
Merge branch 'bm/interpret-trailers-cut-line-is-eom' into maint

"git interpret-trailers", when used as GIT_EDITOR for "git commit
-v", looked for and appended to a trailer block at the very end,
i.e. at the end of the "diff" output.  The command has been
corrected to pay attention to the cut-mark line "commit -v" adds to
the buffer---the real trailer block should appear just before it.

* bm/interpret-trailers-cut-line-is-eom:
  interpret-trailers: honor the cut line