gitweb.git
t5400: avoid concurrent writes into a trace fileJeff King Thu, 18 May 2017 05:02:09 +0000 (01:02 -0400)

t5400: avoid concurrent writes into a trace file

One test in t5400 examines the packet exchange between git-push and
git-receive-pack. The latter inherits the GIT_TRACE_PACKET environment
variable, so that both processes dump trace data into the same file
concurrently. This should not be a problem because the trace file is
opened with O_APPEND.

On Windows, however, O_APPEND is not atomic as it should be: it is
emulated as lseek(SEEK_END) followed by write(). For this reason, the
test is unreliable: it can happen that one process overwrites a line
that was just written by the other process. As a consequence, the test
sometimes does not find one or another line that is expected (and it is
also successful occasionally).

The test case is actually only interested in the output of git-push.
To ensure that only git-push writes to the trace file, override the
receive-pack command such that it does not even open the trace file.

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

receive-pack: avoid duplicates between our refs and... Jeff King Wed, 8 Feb 2017 20:53:19 +0000 (15:53 -0500)

receive-pack: avoid duplicates between our refs and alternates

We de-duplicate ".have" refs among themselves, but never
check if they are duplicates of our local refs. It's not
unreasonable that they would be if we are a "--shared" or
"--reference" clone of a similar repository; we'd have all
the same tags.

We can handle this by inserting our local refs into the
oidset, but obviously not suppressing duplicates (since the
refnames are important).

Note that this also switches the order in which we advertise
refs, processing ours first and then any alternates. The
order shouldn't matter (and arguably showing our refs first
makes more sense).

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

receive-pack: treat namespace .have lines like alternatesJeff King Wed, 8 Feb 2017 20:53:16 +0000 (15:53 -0500)

receive-pack: treat namespace .have lines like alternates

Namely, de-duplicate them. We use the same set as the
alternates, since we call them both ".have" (i.e., there is
no value in showing one versus the other).

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

receive-pack: fix misleading namespace/.have commentJeff King Wed, 8 Feb 2017 20:53:13 +0000 (15:53 -0500)

receive-pack: fix misleading namespace/.have comment

The comment claims that we handle alternate ".have" lines
through this function, but that hasn't been the case since
85f251045 (write_head_info(): handle "extra refs" locally,
2012-01-06).

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

receive-pack: use oidset to de-duplicate .have linesJeff King Wed, 8 Feb 2017 20:53:10 +0000 (15:53 -0500)

receive-pack: use oidset to de-duplicate .have lines

If you have an alternate object store with a very large
number of refs, the peak memory usage of the sha1_array can
grow high, even if most of them are duplicates that end up
not being printed at all.

The similar for_each_alternate_ref() code-paths in
fetch-pack solve this by using flags in "struct object" to
de-duplicate (and so are relying on obj_hash at the core).

But we don't have a "struct object" at all in this case. We
could call lookup_unknown_object() to get one, but if our
goal is reducing memory footprint, it's not great:

- an unknown object is as large as the largest object type
(a commit), which is bigger than an oidset entry

- we can free the memory after our ref advertisement, but
"struct object" entries persist forever (and the
receive-pack may hang around for a long time, as the
bottleneck is often client upload bandwidth).

So let's use an oidset. Note that unlike a sha1-array it
doesn't sort the output as a side effect. However, our
output is at least stable, because for_each_alternate_ref()
will give us the sha1s in ref-sorted order.

In one particularly pathological case with an alternate that
has 60,000 unique refs out of 80 million total, this reduced
the peak heap usage of "git receive-pack . </dev/null" from
13GB to 14MB.

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

add oidset APIJeff King Wed, 8 Feb 2017 20:53:07 +0000 (15:53 -0500)

add oidset API

This is similar to many of our uses of sha1-array, but it
overcomes one limitation of a sha1-array: when you are
de-duplicating a large input with relatively few unique
entries, sha1-array uses 20 bytes per non-unique entry.
Whereas this set will use memory linear in the number of
unique entries (albeit a few more than 20 bytes due to
hashmap overhead).

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

fetch-pack: cache results of for_each_alternate_refJeff King Wed, 8 Feb 2017 20:53:03 +0000 (15:53 -0500)

fetch-pack: cache results of for_each_alternate_ref

We may run for_each_alternate_ref() twice, once in
find_common() and once in everything_local(). This operation
can be expensive, because it involves running a sub-process
which must freshly load all of the alternate's refs from
disk.

Let's cache and reuse the results between the two calls. We
can make some optimizations based on the particular use
pattern in fetch-pack to keep our memory usage down.

The first is that we only care about the sha1s, not the refs
themselves. So it's OK to store only the sha1s, and to
suppress duplicates. The natural fit would therefore be a
sha1_array.

However, sha1_array's de-duplication happens only after it
has read and sorted all entries. It still stores each
duplicate. For an alternate with a large number of refs
pointing to the same commits, this is a needless expense.

Instead, we'd prefer to eliminate duplicates before putting
them in the cache, which implies using a hash. We can
further note that fetch-pack will call parse_object() on
each alternate sha1. We can therefore keep our cache as a
set of pointers to "struct object". That gives us a place to
put our "already seen" bit with an optimized hash lookup.
And as a bonus, the object stores the sha1 for us, so
pointer-to-object is all we need.

There are two extra optimizations I didn't do here:

- we actually store an array of pointer-to-object.
Technically we could just walk the obj_hash table
looking for entries with the ALTERNATE flag set (because
our use case doesn't care about the order here).

But that hash table may be mostly composed of
non-ALTERNATE entries, so we'd waste time walking over
them. So it would be a slight win in memory use, but a
loss in CPU.

- the items we pull out of the cache are actual "struct
object"s, but then we feed "obj->sha1" to our
sub-functions, which promptly call parse_object().

This second parse is cheap, because it starts with
lookup_object() and will bail immediately when it sees
we've already parsed the object. We could save the extra
hash lookup, but it would involve refactoring the
functions we call. It may or may not be worth the
trouble.

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

for_each_alternate_ref: replace transport code with... Jeff King Wed, 8 Feb 2017 20:53:00 +0000 (15:53 -0500)

for_each_alternate_ref: replace transport code with for-each-ref

The current method for getting the refs from an alternate is
to run upload-pack in the alternate and parse its output
using the normal transport code. This works and is
reasonably short, but it has a very bad memory footprint
when there are a lot of refs in the alternate. There are two
problems:

1. It reads in all of the refs before passing any back to
us. Which means that our peak memory usage has to store
every ref (including duplicates for peeled variants),
even if our callback could determine that some are not
interesting (e.g., because they point to the same sha1
as another ref).

2. It allocates a "struct ref" for each one. Among other
things, this contains 3 separate 20-byte oids, along
with the name and various pointers. That can add up,
especially if the callback is only interested in the
sha1 (which it can store in a sha1_array as just 20
bytes).

On a particularly pathological case, where the alternate had
over 80 million refs pointing to only around 60,000 unique
objects, the peak heap usage of "git clone --reference" grew
to over 25GB.

This patch instead calls git-for-each-ref in the alternate
repository, and passes each line to the callback as we read
it. That drops the peak heap of the same command to 50MB.

I considered and rejected a few alternatives.

We could read all of the refs in the alternate using our own
ref code, just as we do with submodules. However, as memory
footprint is one of the concerns here, we want to avoid
loading those refs into our own memory as a whole.

It's possible that this will be a better technique in the
future when the ref code can more easily iterate without
loading all of packed-refs into memory.

Another option is to keep calling upload-pack, and just
parse its output ourselves in a streaming fashion. Besides
for-each-ref being simpler (we get to define the format
ourselves, and don't have to deal with speaking the git
protocol), it's more flexible for possible future changes.

For instance, it might be useful for the caller to be able
to limit the set of "interesting" alternate refs. The
motivating example is one where many "forks" of a particular
repository share object storage, and the shared storage has
refs for each fork (which is why so many of the refs are
duplicates; each fork has the same tags). A plausible
future optimization would be to ask for the alternate refs
for just _one_ fork (if you had some out-of-band way of
knowing which was the most interesting or important for the
current operation).

Similarly, no callbacks actually care about the symref value
of alternate refs, and as before, this patch ignores them
entirely. However, if we wanted to add them, for-each-ref's
"%(symref)" is going to be more flexible than upload-pack,
because the latter only handles the HEAD symref due to
historical constraints.

There is one potential downside, though: unlike upload-pack,
our for-each-ref command doesn't report the peeled value of
refs. The existing code calls the alternate_ref_fn callback
twice for tags: once for the tag, and once for the peeled
value with the refname set to "ref^{}".

For the callers in fetch-pack, this doesn't matter at all.
We immediately peel each tag down to a commit either way (so
there's a slight improvement, as do not bother passing the
redundant data over the pipe). For the caller in
receive-pack, it means we will not advertise the peeled
values of tags in our alternate. However, we also don't
advertise peeled values for our _own_ tags, so this is
actually making things more consistent.

It's unclear whether receive-pack advertising peeled values
is a win or not. On one hand, giving more information to the
other side may let it omit some objects from the push. On
the other hand, for tags which both sides have, they simply
bloat the advertisement. The upload-pack advertisement of
git.git is about 30% larger than the receive-pack
advertisement due to its peeled information.

This patch omits the peeled information from
for_each_alternate_ref entirely, and leaves it up to the
caller whether they want to dig up the information.

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

for_each_alternate_ref: pass name/oid instead of ref... Jeff King Wed, 8 Feb 2017 20:52:57 +0000 (15:52 -0500)

for_each_alternate_ref: pass name/oid instead of ref struct

Breaking down the fields in the interface makes it easier to
change the backend of for_each_alternate_ref to something
that doesn't use "struct ref" internally.

The only field that callers actually look at is the oid,
anyway. The refname is kept in the interface as a plausible
thing for future code to want.

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

for_each_alternate_ref: use strbuf for path allocationJeff King Wed, 8 Feb 2017 20:52:54 +0000 (15:52 -0500)

for_each_alternate_ref: use strbuf for path allocation

We have a string with ".../objects" pointing to the
alternate object store, and overwrite bits of it to look at
other paths in the (potential) git repository holding it.
This works because the only path we care about is "refs",
which is shorter than "objects".

Using a strbuf to hold the path lets us get rid of some
magic numbers, and makes it more obvious that the memory
operations are safe.

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

for_each_alternate_ref: stop trimming trailing slashesJeff King Wed, 8 Feb 2017 20:52:50 +0000 (15:52 -0500)

for_each_alternate_ref: stop trimming trailing slashes

The real_pathdup() function will have removed extra slashes
for us already (on top of the normalize_path() done when we
created the alternate_object_database struct in the first
place).

Incidentally, this also fixes the case where the path is
just "/", which would read off the start of the array.
That doesn't seem possible to trigger in practice, though,
as link_alt_odb_entry() blindly eats trailing slashes,
including a bare "/".

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

for_each_alternate_ref: handle failure from real_pathdup()Jeff King Wed, 8 Feb 2017 20:52:45 +0000 (15:52 -0500)

for_each_alternate_ref: handle failure from real_pathdup()

In older versions of git, if real_path() failed to resolve
the alternate object store path, we would die() with an
error. However, since 4ac9006f8 (real_path: have callers use
real_pathdup and strbuf_realpath, 2016-12-12) we use the
real_pathdup() function, which may return NULL. Since we
don't check the return value, we can segfault.

This is hard to trigger in practice, since we check that the
path is accessible before creating the alternate_object_database
struct. But it could be removed racily, or we could see a
transient filesystem error.

We could restore the original behavior by switching back to
xstrdup(real_path()). However, dying is probably not the
best option here. This whole function is best-effort
already; there might not even be a repository around the
shared objects at all. And if the alternate store has gone
away, there are no objects to show.

So let's just quietly return, as we would if we failed to
open "refs/", or if upload-pack failed to start, etc.

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

Git 2.12-rc0 v2.12.0-rc0Junio C Hamano Fri, 3 Feb 2017 19:29:52 +0000 (11:29 -0800)

Git 2.12-rc0

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

Merge branch 'cw/log-updates-for-all-refs-really'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'cw/log-updates-for-all-refs-really'

The "core.logAllRefUpdates" that used to be boolean has been
enhanced to take 'always' as well, to record ref updates to refs
other than the ones that are expected to be updated (i.e. branches,
remote-tracking branches and notes).

* cw/log-updates-for-all-refs-really:
doc: add note about ignoring '--no-create-reflog'
update-ref: add test cases for bare repository
refs: add option core.logAllRefUpdates = always
config: add markup to core.logAllRefUpdates doc

Merge branch 'pl/complete-diff-submodule-diff'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'pl/complete-diff-submodule-diff'

The command line completion (in contrib/) learned that
"git diff --submodule=" can take "diff" as a recently added option.

* pl/complete-diff-submodule-diff:
Completion: Add support for --submodule=diff

Merge branch 'rs/object-id'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'rs/object-id'

"uchar [40]" to "struct object_id" conversion continues.

* rs/object-id:
checkout: convert post_checkout_hook() to struct object_id
use oidcpy() for copying hashes between instances of struct object_id
use oid_to_hex_r() for converting struct object_id hashes to hex strings

Merge branch 'js/re-running-failed-tests'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'js/re-running-failed-tests'

"make -C t failed" will now run only the tests that failed in the
previous run. This is usable only when prove is not use, and gives
a useless error message when run after "make clean", but otherwise
is serviceable.

* js/re-running-failed-tests:
t/Makefile: add a rule to re-run previously-failed tests

Merge branch 'sb/submodule-update-initial-runs-custom... Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'sb/submodule-update-initial-runs-custom-script'

The user can specify a custom update method that is run when
"submodule update" updates an already checked out submodule. This
was ignored when checking the submodule out for the first time and
we instead always just checked out the commit that is bound to the
path in the superproject's index.

* sb/submodule-update-initial-runs-custom-script:
submodule update: run custom update script for initial populating as well

Merge branch 'sb/submodule-recursive-absorb'Junio C Hamano Fri, 3 Feb 2017 19:25:18 +0000 (11:25 -0800)

Merge branch 'sb/submodule-recursive-absorb'

When a submodule "A", which has another submodule "B" nested within
it, is "absorbed" into the top-level superproject, the inner
submodule "B" used to be left in a strange state. The logic to
adjust the .git pointers in these submodules has been corrected.

* sb/submodule-recursive-absorb:
submodule absorbing: fix worktree/gitdir pointers recursively for non-moves
cache.h: expose the dying procedure for reading gitlinks
setup: add gentle version of resolve_git_dir

Merge branch 'sb/unpack-trees-super-prefix'Junio C Hamano Fri, 3 Feb 2017 19:25:18 +0000 (11:25 -0800)

Merge branch 'sb/unpack-trees-super-prefix'

"git read-tree" and its underlying unpack_trees() machinery learned
to report problematic paths prefixed with the --super-prefix option.

* sb/unpack-trees-super-prefix:
unpack-trees: support super-prefix option
t1001: modernize style
t1000: modernize style
read-tree: use OPT_BOOL instead of OPT_SET_INT

Sync with v2.11.1Junio C Hamano Thu, 2 Feb 2017 21:43:19 +0000 (13:43 -0800)

Sync with v2.11.1

* maint:
Git 2.11.1

Ninth batch for 2.12; almost ready for -rc0Junio C Hamano Thu, 2 Feb 2017 21:43:10 +0000 (13:43 -0800)

Ninth batch for 2.12; almost ready for -rc0

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

Merge branch 'nd/log-graph-configurable-colors'Junio C Hamano Thu, 2 Feb 2017 21:36:58 +0000 (13:36 -0800)

Merge branch 'nd/log-graph-configurable-colors'

Some people feel the default set of colors used by "git log --graph"
rather limiting. A mechanism to customize the set of colors has
been introduced.

* nd/log-graph-configurable-colors:
document behavior of empty color name
color_parse_mem: allow empty color spec
log --graph: customize the graph lines with config log.graphColors
color.c: trim leading spaces in color_parse_mem()
color.c: fix color_parse_mem() with value_len == 0

Merge branch 'ep/commit-static-buf-cleanup'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'ep/commit-static-buf-cleanup'

Code clean-up.

* ep/commit-static-buf-cleanup:
builtin/commit.c: switch to strbuf, instead of snprintf()
builtin/commit.c: remove the PATH_MAX limitation via dynamic allocation

Merge branch 'bc/use-asciidoctor-opt'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'bc/use-asciidoctor-opt'

Asciidoctor, an alternative reimplementation of AsciiDoc, still
needs some changes to work with documents meant to be formatted
with AsciiDoc. "make USE_ASCIIDOCTOR=YesPlease" to use it out of
the box to document our pages is getting closer to reality.

* bc/use-asciidoctor-opt:
Documentation: implement linkgit macro for Asciidoctor
Makefile: add a knob to enable the use of Asciidoctor
Documentation: move dblatex arguments into variable
Documentation: add XSLT to fix DocBook for Texinfo
Documentation: sort sources for gitman.texi
Documentation: remove unneeded argument in cat-texi.perl
Documentation: modernize cat-texi.perl
Documentation: fix warning in cat-texi.perl

Merge branch 'sg/mailmap-self'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'sg/mailmap-self'

* sg/mailmap-self:
.mailmap: update Gábor Szeder's email address

Merge branch 'js/mingw-hooks-with-exe-suffix'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'js/mingw-hooks-with-exe-suffix'

Names of the various hook scripts must be spelled exactly, but on
Windows, an .exe binary must be named with .exe suffix; notice
$GIT_DIR/hooks/<hookname>.exe as a valid <hookname> hook.

* js/mingw-hooks-with-exe-suffix:
mingw: allow hooks to be .exe files

Merge branch 'rs/receive-pack-cleanup'Junio C Hamano Thu, 2 Feb 2017 21:36:56 +0000 (13:36 -0800)

Merge branch 'rs/receive-pack-cleanup'

Code clean-up.

* rs/receive-pack-cleanup:
receive-pack: call string_list_clear() unconditionally

Merge branch 'mm/reset-facl-before-umask-test'Junio C Hamano Thu, 2 Feb 2017 21:36:56 +0000 (13:36 -0800)

Merge branch 'mm/reset-facl-before-umask-test'

Test tweaks for those who have default ACL in their git source tree
that interfere with the umask test.

* mm/reset-facl-before-umask-test:
t0001: don't let a default ACL interfere with the umask test

Merge branch 'hv/mingw-help-is-executable'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'hv/mingw-help-is-executable'

"git help" enumerates executable files in $PATH; the implementation
of "is this file executable?" on Windows has been optimized.

* hv/mingw-help-is-executable:
help: improve is_executable() on Windows

Merge branch 'gv/mingw-p4-mapuser'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'gv/mingw-p4-mapuser'

"git p4" did not work well with multiple git-p4.mapUser entries on
Windows.

* gv/mingw-p4-mapuser:
git-p4: fix git-p4.mapUser on Windows

Merge branch 'rs/absolute-pathdup'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'rs/absolute-pathdup'

Code cleanup.

* rs/absolute-pathdup:
use absolute_pathdup()
abspath: add absolute_pathdup()

Merge branch 'js/unzip-in-usr-bin-workaround'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'js/unzip-in-usr-bin-workaround'

Test tweak for FreeBSD where /usr/bin/unzip is unsuitable to run
our tests but /usr/local/bin/unzip is usable.

* js/unzip-in-usr-bin-workaround:
test-lib: on FreeBSD, look for unzip(1) in /usr/local/bin/

Merge branch 'cw/doc-sign-off'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'cw/doc-sign-off'

Doc update.

* cw/doc-sign-off:
doc: clarify distinction between sign-off and pgp-signing

Merge branch 'js/status-pre-rebase-i'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'js/status-pre-rebase-i'

After starting "git rebase -i", which first opens the user's editor
to edit the series of patches to apply, but before saving the
contents of that file, "git status" failed to show the current
state (i.e. you are in an interactive rebase session, but you have
applied no steps yet) correctly.

* js/status-pre-rebase-i:
status: be prepared for not-yet-started interactive rebase

Merge branch 'js/retire-relink'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'js/retire-relink'

Cruft removal.

* js/retire-relink:
relink: really remove the command
relink: retire the command

Merge branch 'sb/submodule-add-force'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'sb/submodule-add-force'

"git submodule add" used to be confused and refused to add a
locally created repository; users can now use "--force" option
to add them.

* sb/submodule-add-force:
submodule add: extend force flag to add existing repos

Git 2.11.1 v2.11.1Junio C Hamano Thu, 2 Feb 2017 21:21:27 +0000 (13:21 -0800)

Git 2.11.1

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

Merge branch 'ws/request-pull-code-cleanup' into maintJunio C Hamano Thu, 2 Feb 2017 21:20:30 +0000 (13:20 -0800)

Merge branch 'ws/request-pull-code-cleanup' into maint

Code clean-up.

* ws/request-pull-code-cleanup:
request-pull: drop old USAGE stuff

Merge branch 'jk/execv-dashed-external' into maintJunio C Hamano Thu, 2 Feb 2017 21:20:29 +0000 (13:20 -0800)

Merge branch 'jk/execv-dashed-external' into maint

Typing ^C to pager, which usually does not kill it, killed Git and
took the pager down as a collateral damage in certain process-tree
structure. This has been fixed.

* jk/execv-dashed-external:
execv_dashed_external: wait for child on signal death
execv_dashed_external: stop exiting with negative code
execv_dashed_external: use child_process struct

document behavior of empty color nameJeff King Thu, 2 Feb 2017 12:42:44 +0000 (13:42 +0100)

document behavior of empty color name

Commit 55cccf4bb (color_parse_mem: allow empty color spec,
2017-02-01) clearly defined the behavior of an empty color
config variable. Let's document that, and give a hint about
why it might be useful.

It's important not to say that it makes the item uncolored,
because it doesn't. It just sets no attributes, which means
that any previous attributes continue to take effect.

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

doc: add note about ignoring '--no-create-reflog'Cornelius Weig Wed, 1 Feb 2017 22:07:27 +0000 (23:07 +0100)

doc: add note about ignoring '--no-create-reflog'

The commands git-branch and git-tag accept the '--create-reflog'
option, and create reflog even when core.logallrefupdates
configuration is explicitly set not to.

On the other hand, the negated form '--no-create-reflog' is accepted
as a valid option but has no effect (other than overriding an
earlier '--create-reflog' on the command line). This silent noop may
puzzle users. To communicate that this is a known limitation, add a
short note in the manuals for git-branch and git-tag.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color_parse_mem: allow empty color specJeff King Wed, 1 Feb 2017 00:21:29 +0000 (01:21 +0100)

color_parse_mem: allow empty color spec

Prior to c2f41bf52 (color.c: fix color_parse_mem() with
value_len == 0, 2017-01-19), the empty string was
interpreted as a color "reset". This was an accidental
outcome, and that commit turned it into an error.

However, scripts may pass the empty string as a default
value to "git config --get-color" to disable color when the
value is not defined. The git-add--interactive script does
this. As a result, the script is unusable since c2f41bf52
unless you have color.diff.plain defined (if it is defined,
then we don't parse the empty default at all).

Our test scripts didn't notice the recent breakage because
they run without a terminal, and thus without color. They
never hit this code path at all. And nobody noticed the
original buggy "reset" behavior, because it was effectively
a noop.

Let's fix the code to have an empty color name produce an
empty sequence of color codes. The tests need a few fixups:

- we'll add a new test in t4026 to cover this case. But
note that we need to tweak the color() helper. While
we're there, let's factor out the literal ANSI ESC
character. Otherwise it makes the diff quite hard to
read.

- we'll add a basic sanity-check in t4026 that "git add
-p" works at all when color is enabled. That would have
caught this bug, as well as any others that are specific
to the color code paths.

- 73c727d69 (log --graph: customize the graph lines with
config log.graphColors, 2017-01-19) added a test to
t4202 that checks some "invalid" graph color config.
Since ",, blue" before yielded only "blue" as valid, and
now yields "empty, empty, blue", we don't match the
expected output.

One way to fix this would be to change the expectation
to the empty color strings. But that makes the test much
less interesting, since we show only two graph lines,
both of which would be colorless.

Since the empty-string case is now covered by t4026,
let's remove them entirely here. They're just in the way
of the primary thing the test is supposed to be
checking.

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

.mailmap: update Gábor Szeder's email addressSZEDER Gábor Tue, 31 Jan 2017 18:42:12 +0000 (19:42 +0100)

.mailmap: update Gábor Szeder's email address

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Tue, 31 Jan 2017 21:34:59 +0000 (13:34 -0800)

Sync with maint

* maint:
Ready for 2.11.1

Ready for 2.11.1Junio C Hamano Tue, 31 Jan 2017 21:34:48 +0000 (13:34 -0800)

Ready for 2.11.1

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

Merge branch 'sb/in-core-index-doc' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:11 +0000 (13:32 -0800)

Merge branch 'sb/in-core-index-doc' into maint

Documentation and in-code comments updates.

* sb/in-core-index-doc:
documentation: retire unfinished documentation
cache.h: document add_[file_]to_index
cache.h: document remove_index_entry_at
cache.h: document index_name_pos

Merge branch 'js/mingw-isatty' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:11 +0000 (13:32 -0800)

Merge branch 'js/mingw-isatty' into maint

An update to a topic that is already in 'master'.

* js/mingw-isatty:
mingw: follow-up to "replace isatty() hack"

Merge branch 'jk/coding-guidelines-update' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:11 +0000 (13:32 -0800)

Merge branch 'jk/coding-guidelines-update' into maint

Developer doc update.

* jk/coding-guidelines-update:
CodingGuidelines: clarify multi-line brace style

Merge branch 'js/exec-path-coverity-workaround' into... Junio C Hamano Tue, 31 Jan 2017 21:32:10 +0000 (13:32 -0800)

Merge branch 'js/exec-path-coverity-workaround' into maint

Code cleanup.

* js/exec-path-coverity-workaround:
git_exec_path: do not return the result of getenv()
git_exec_path: avoid Coverity warning about unfree()d result

Merge branch 'ad/bisect-terms' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:10 +0000 (13:32 -0800)

Merge branch 'ad/bisect-terms' into maint

Documentation fix.

* ad/bisect-terms:
Documentation/bisect: improve on (bad|new) and (good|bad)

Merge branch 'jk/grep-e-could-be-extended-beyond-posix... Junio C Hamano Tue, 31 Jan 2017 21:32:09 +0000 (13:32 -0800)

Merge branch 'jk/grep-e-could-be-extended-beyond-posix' into maint

Tighten a test to avoid mistaking an extended ERE regexp engine as
a PRE regexp engine.

* jk/grep-e-could-be-extended-beyond-posix:
t7810: avoid assumption about invalid regex syntax

Merge branch 'km/branch-get-push-while-detached' into... Junio C Hamano Tue, 31 Jan 2017 21:32:08 +0000 (13:32 -0800)

Merge branch 'km/branch-get-push-while-detached' into maint

"git <cmd> @{push}" on a detached HEAD used to segfault; it has
been corrected to error out with a message.

* km/branch-get-push-while-detached:
branch_get_push: do not segfault when HEAD is detached

Merge branch 'jk/rebase-i-squash-count-fix' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:07 +0000 (13:32 -0800)

Merge branch 'jk/rebase-i-squash-count-fix' into maint

"git rebase -i" with a recent update started showing an incorrect
count when squashing more than 10 commits.

* jk/rebase-i-squash-count-fix:
rebase--interactive: count squash commits above 10 correctly

Merge branch 'jk/blame-fixes' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:07 +0000 (13:32 -0800)

Merge branch 'jk/blame-fixes' into maint

"git blame --porcelain" misidentified the "previous" <commit, path>
pair (aka "source") when contents came from two or more files.

* jk/blame-fixes:
blame: output porcelain "previous" header for each file
blame: handle --no-abbrev
blame: fix alignment with --abbrev=40

Merge branch 'jk/archive-zip-userdiff-config' into... Junio C Hamano Tue, 31 Jan 2017 21:32:07 +0000 (13:32 -0800)

Merge branch 'jk/archive-zip-userdiff-config' into maint

"git archive" did not read the standard configuration files, and
failed to notice a file that is marked as binary via the userdiff
driver configuration.

* jk/archive-zip-userdiff-config:
archive-zip: load userdiff config

Merge branch 'dt/disable-bitmap-in-auto-gc' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:06 +0000 (13:32 -0800)

Merge branch 'dt/disable-bitmap-in-auto-gc' into maint

It is natural that "git gc --auto" may not attempt to pack
everything into a single pack, and there is no point in warning
when the user has configured the system to use the pack bitmap,
leading to disabling further "gc".

* dt/disable-bitmap-in-auto-gc:
repack: die on incremental + write-bitmap-index
auto gc: don't write bitmaps for incremental repacks

Merge branch 'nd/config-misc-fixes' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:06 +0000 (13:32 -0800)

Merge branch 'nd/config-misc-fixes' into maint

Leakage of lockfiles in the config subsystem has been fixed.

* nd/config-misc-fixes:
config.c: handle lock file in error case in git_config_rename_...
config.c: rename label unlock_and_out
config.c: handle error case for fstat() calls

Merge branch 'jc/abbrev-autoscale-config' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:06 +0000 (13:32 -0800)

Merge branch 'jc/abbrev-autoscale-config' into maint

Recent update to the default abbreviation length that auto-scales
lacked documentation update, which has been corrected.

* jc/abbrev-autoscale-config:
config.abbrev: document the new default that auto-scales

Merge branch 'mh/fast-import-notes-fix-new' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:05 +0000 (13:32 -0800)

Merge branch 'mh/fast-import-notes-fix-new' into maint

"git fast-import" sometimes mishandled while rebalancing notes
tree, which has been fixed.

* mh/fast-import-notes-fix-new:
fast-import: properly fanout notes when tree is imported

Merge branch 'jc/compression-config' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:05 +0000 (13:32 -0800)

Merge branch 'jc/compression-config' into maint

Compression setting for producing packfiles were spread across
three codepaths, one of which did not honor any configuration.
Unify these so that all of them honor core.compression and
pack.compression variables the same way.

* jc/compression-config:
compression: unify pack.compression configuration parsing

Merge branch 'ew/svn-fixes' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:05 +0000 (13:32 -0800)

Merge branch 'ew/svn-fixes' into maint

Meant eventually for 'maint'.

* ew/svn-fixes:
git-svn: document useLogAuthor and addAuthorFrom config keys
git-svn: allow "0" in SVN path components

Merge branch 'ls/travis-p4-on-macos' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:04 +0000 (13:32 -0800)

Merge branch 'ls/travis-p4-on-macos' into maint

Update the definition of the MacOSX test environment used by
TravisCI.

* ls/travis-p4-on-macos:
travis-ci: fix Perforce install on macOS

Merge branch 'jk/make-tags-find-sources-tweak' into... Junio C Hamano Tue, 31 Jan 2017 21:32:04 +0000 (13:32 -0800)

Merge branch 'jk/make-tags-find-sources-tweak' into maint

Update the procedure to generate "tags" for developer support.

* jk/make-tags-find-sources-tweak:
Makefile: exclude contrib from FIND_SOURCE_FILES
Makefile: match shell scripts in FIND_SOURCE_FILES
Makefile: exclude test cruft from FIND_SOURCE_FILES
Makefile: reformat FIND_SOURCE_FILES

Merge branch 'jc/latin-1' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:04 +0000 (13:32 -0800)

Merge branch 'jc/latin-1' into maint

Some platforms no longer understand "latin-1" that is still seen in
the wild in e-mail headers; replace them with "iso-8859-1" that is
more widely known when conversion fails from/to it.

* jc/latin-1:
utf8: accept "latin-1" as ISO-8859-1
utf8: refactor code to decide fallback encoding

Eighth batch for 2.12Junio C Hamano Tue, 31 Jan 2017 21:20:46 +0000 (13:20 -0800)

Eighth batch for 2.12

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

Merge branch 'jk/fsck-connectivity-check-fix'Junio C Hamano Tue, 31 Jan 2017 21:15:01 +0000 (13:15 -0800)

Merge branch 'jk/fsck-connectivity-check-fix'

"git fsck --connectivity-check" was not working at all.

* jk/fsck-connectivity-check-fix:
fsck: lazily load types under --connectivity-only
fsck: move typename() printing to its own function
t1450: use "mv -f" within loose object directory
fsck: check HAS_OBJ more consistently
fsck: do not fallback "git fsck <bogus>" to "git fsck"
fsck: tighten error-checks of "git fsck <head>"
fsck: prepare dummy objects for --connectivity-check
fsck: report trees as dangling
t1450: clean up sub-objects in duplicate-entry test

Merge branch 'js/difftool-builtin'Junio C Hamano Tue, 31 Jan 2017 21:15:00 +0000 (13:15 -0800)

Merge branch 'js/difftool-builtin'

Rewrite a scripted porcelain "git difftool" in C.

* js/difftool-builtin:
difftool: hack around -Wzero-length-format warning
difftool: retire the scripted version
difftool: implement the functionality in the builtin
difftool: add a skeleton for the upcoming builtin

Merge branch 'rs/qsort-s'Junio C Hamano Tue, 31 Jan 2017 21:15:00 +0000 (13:15 -0800)

Merge branch 'rs/qsort-s'

A few codepaths had to rely on a global variable when sorting
elements of an array because sort(3) API does not allow extra data
to be passed to the comparison function. Use qsort_s() when
natively available, and a fallback implementation of it when not,
to eliminate the need, which is a prerequisite for making the
codepath reentrant.

* rs/qsort-s:
ref-filter: use QSORT_S in ref_array_sort()
string-list: use QSORT_S in string_list_sort()
perf: add basic sort performance test
add QSORT_S
compat: add qsort_s()

Merge branch 'ls/travis-p4-on-macos'Junio C Hamano Tue, 31 Jan 2017 21:15:00 +0000 (13:15 -0800)

Merge branch 'ls/travis-p4-on-macos'

Update the definition of the MacOSX test environment used by
TravisCI.

* ls/travis-p4-on-macos:
travis-ci: fix Perforce install on macOS

Merge branch 'vp/show-ref-verify-head'Junio C Hamano Tue, 31 Jan 2017 21:14:59 +0000 (13:14 -0800)

Merge branch 'vp/show-ref-verify-head'

"git show-ref HEAD" used with "--verify" because the user is not
interested in seeing refs/remotes/origin/HEAD, and used with
"--head" because the user does not want HEAD to be filtered out,
i.e. "git show-ref --head --verify HEAD", did not work as expected.

* vp/show-ref-verify-head:
show-ref: remove a stale comment
show-ref: remove dead `if (verify)' check
show-ref: detect dangling refs under --verify as well
show-ref: move --quiet handling into show_one()
show-ref: allow -d to work with --verify
show-ref: accept HEAD with --verify

Merge branch 'sb/retire-convert-objects-from-contrib'Junio C Hamano Tue, 31 Jan 2017 21:14:59 +0000 (13:14 -0800)

Merge branch 'sb/retire-convert-objects-from-contrib'

Remove an ancient tool left in contrib/.

* sb/retire-convert-objects-from-contrib:
contrib: remove git-convert-objects

Merge branch 'sb/in-core-index-doc'Junio C Hamano Tue, 31 Jan 2017 21:14:59 +0000 (13:14 -0800)

Merge branch 'sb/in-core-index-doc'

Documentation and in-code comments updates.

* sb/in-core-index-doc:
documentation: retire unfinished documentation
cache.h: document add_[file_]to_index
cache.h: document remove_index_entry_at
cache.h: document index_name_pos

Merge branch 'js/remote-rename-with-half-configured... Junio C Hamano Tue, 31 Jan 2017 21:14:59 +0000 (13:14 -0800)

Merge branch 'js/remote-rename-with-half-configured-remote'

With anticipatory tweaking for remotes defined in ~/.gitconfig
(e.g. "remote.origin.prune" set to true, even though there may or
may not actually be "origin" remote defined in a particular Git
repository), "git remote rename" and other commands misinterpreted
and behaved as if such a non-existing remote actually existed.

* js/remote-rename-with-half-configured-remote:
remote rename: more carefully determine whether a remote is configured
remote rename: demonstrate a bogus "remote exists" bug

Merge branch 'jk/clear-delta-base-cache-fix'Junio C Hamano Tue, 31 Jan 2017 21:14:58 +0000 (13:14 -0800)

Merge branch 'jk/clear-delta-base-cache-fix'

A crashing bug introduced in v2.11 timeframe has been found (it is
triggerable only in fast-import) and fixed.

* jk/clear-delta-base-cache-fix:
clear_delta_base_cache(): don't modify hashmap while iterating

Merge branch 'st/verify-tag'Junio C Hamano Tue, 31 Jan 2017 21:14:58 +0000 (13:14 -0800)

Merge branch 'st/verify-tag'

"git tag" and "git verify-tag" learned to put GPG verification
status in their "--format=<placeholders>" output format.

* st/verify-tag:
t/t7004-tag: Add --format specifier tests
t/t7030-verify-tag: Add --format specifier tests
builtin/tag: add --format argument for tag -v
builtin/verify-tag: add --format to verify-tag
ref-filter: add function to print single ref_array_item
gpg-interface, tag: add GPG_VERIFY_OMIT_STATUS flag

Merge branch 'js/mingw-isatty'Junio C Hamano Tue, 31 Jan 2017 21:14:58 +0000 (13:14 -0800)

Merge branch 'js/mingw-isatty'

An update to a topic that is already in 'master'.

* js/mingw-isatty:
mingw: follow-up to "replace isatty() hack"

Merge branch 'js/sequencer-i-countdown-3'Junio C Hamano Tue, 31 Jan 2017 21:14:58 +0000 (13:14 -0800)

Merge branch 'js/sequencer-i-countdown-3'

The sequencer machinery has been further enhanced so that a later
set of patches can start using it to reimplement "rebase -i".

* js/sequencer-i-countdown-3: (38 commits)
sequencer (rebase -i): write out the final message
sequencer (rebase -i): write the progress into files
sequencer (rebase -i): show the progress
sequencer (rebase -i): suggest --edit-todo upon unknown command
sequencer (rebase -i): show only failed cherry-picks' output
sequencer (rebase -i): show only failed `git commit`'s output
sequencer: use run_command() directly
sequencer: update reading author-script
sequencer (rebase -i): differentiate between comments and 'noop'
sequencer (rebase -i): implement the 'drop' command
sequencer (rebase -i): allow rescheduling commands
sequencer (rebase -i): respect strategy/strategy_opts settings
sequencer (rebase -i): respect the rebase.autostash setting
sequencer (rebase -i): run the post-rewrite hook, if needed
sequencer (rebase -i): record interrupted commits in rewritten, too
sequencer (rebase -i): copy commit notes at end
sequencer (rebase -i): set the reflog message consistently
sequencer (rebase -i): refactor setting the reflog message
sequencer (rebase -i): allow fast-forwarding for edit/reword
sequencer (rebase -i): implement the 'reword' command
...

Merge branch 'jk/coding-guidelines-update'Junio C Hamano Tue, 31 Jan 2017 21:14:57 +0000 (13:14 -0800)

Merge branch 'jk/coding-guidelines-update'

Developer doc update.

* jk/coding-guidelines-update:
CodingGuidelines: clarify multi-line brace style

Merge branch 'jk/loose-object-fsck'Junio C Hamano Tue, 31 Jan 2017 21:14:57 +0000 (13:14 -0800)

Merge branch 'jk/loose-object-fsck'

"git fsck" inspects loose objects more carefully now.

* jk/loose-object-fsck:
fsck: detect trailing garbage in all object types
fsck: parse loose object paths directly
sha1_file: add read_loose_object() function
t1450: test fsck of packed objects
sha1_file: fix error message for alternate objects
t1450: refactor loose-object removal

Merge branch 'js/exec-path-coverity-workaround'Junio C Hamano Tue, 31 Jan 2017 21:14:57 +0000 (13:14 -0800)

Merge branch 'js/exec-path-coverity-workaround'

Code cleanup.

* js/exec-path-coverity-workaround:
git_exec_path: do not return the result of getenv()
git_exec_path: avoid Coverity warning about unfree()d result

Merge branch 'bw/push-submodule-only'Junio C Hamano Tue, 31 Jan 2017 21:14:56 +0000 (13:14 -0800)

Merge branch 'bw/push-submodule-only'

"git submodule push" learned "--recurse-submodules=only option to
push submodules out without pushing the top-level superproject.

* bw/push-submodule-only:
push: add option to push only submodules
submodules: add RECURSE_SUBMODULES_ONLY value
transport: reformat flag #defines to be more readable

Merge branch 'jk/vreport-sanitize'Junio C Hamano Tue, 31 Jan 2017 21:14:56 +0000 (13:14 -0800)

Merge branch 'jk/vreport-sanitize'

An error message with an ASCII control character like '\r' in it
can alter the message to hide its early part, which is problematic
when a remote side gives such an error message that the local side
will relay with a "remote: " prefix.

* jk/vreport-sanitize:
vreport: sanitize ASCII control chars
Revert "vreportf: avoid intermediate buffer"

Documentation: implement linkgit macro for Asciidoctorbrian m. carlson Thu, 26 Jan 2017 00:13:44 +0000 (00:13 +0000)

Documentation: implement linkgit macro for Asciidoctor

AsciiDoc uses a configuration file to implement macros like linkgit,
while Asciidoctor uses Ruby extensions. Implement a Ruby extension that
implements the linkgit macro for Asciidoctor in the same way that
asciidoc.conf does for AsciiDoc. Adjust the Makefile to use it by
default.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/commit.c: switch to strbuf, instead of snprintf()Elia Pinto Tue, 31 Jan 2017 13:45:35 +0000 (13:45 +0000)

builtin/commit.c: switch to strbuf, instead of snprintf()

Switch to dynamic allocation with strbuf, so we can avoid dealing
with magic numbers in the code and reduce the cognitive burden from
the programmers. The original code is correct, but programmers no
longer have to count bytes needed for static allocation to know that.

As a side effect of this change, we also reduce the snprintf()
calls, that may silently truncate results if the programmer is not
careful.

Helped-by: René Scharfe <l.s.r@web.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update-ref: add test cases for bare repositoryCornelius Weig Fri, 27 Jan 2017 10:09:48 +0000 (11:09 +0100)

update-ref: add test cases for bare repository

The default behavior of update-ref to create reflogs differs in
repositories with worktree and bare ones. The existing tests cover only
the behavior of repositories with worktree.

This commit adds tests that assert the correct behavior in bare
repositories for update-ref. Two cases are covered:

- If core.logAllRefUpdates is not set, no reflogs should be created
- If core.logAllRefUpdates is true, reflogs should be created

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: add option core.logAllRefUpdates = alwaysCornelius Weig Fri, 27 Jan 2017 10:09:47 +0000 (11:09 +0100)

refs: add option core.logAllRefUpdates = always

When core.logallrefupdates is true, we only create a new reflog for refs
that are under certain well-known hierarchies. The reason is that we
know that some hierarchies (like refs/tags) are not meant to change, and
that unknown hierarchies might not want reflogs at all (e.g., a
hypothetical refs/foo might be meant to change often and drop old
history immediately).

However, sometimes it is useful to override this decision and simply log
for all refs, because the safety and audit trail is more important than
the performance implications of keeping the log around.

This patch introduces a new "always" mode for the core.logallrefupdates
option which will log updates to everything under refs/, regardless
where in the hierarchy it is (we still will not log things like
ORIG_HEAD and FETCH_HEAD, which are known to be transient).

Based-on-patch-by: Jeff King <peff@peff.net>
Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

receive-pack: call string_list_clear() unconditionallyRené Scharfe Sun, 29 Jan 2017 13:09:46 +0000 (14:09 +0100)

receive-pack: call string_list_clear() unconditionally

string_list_clear() handles empty lists just fine, so remove the
redundant check.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Completion: Add support for --submodule=diffPeter Law Sun, 4 Dec 2016 14:41:27 +0000 (14:41 +0000)

Completion: Add support for --submodule=diff

Teach git-completion.bash about the 'diff' option to 'git diff
--submodule=', which was added in Git 2.11.

Signed-off-by: Peter Law <PeterJCLaw@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout: convert post_checkout_hook() to struct object_idRené Scharfe Sat, 28 Jan 2017 22:14:29 +0000 (23:14 +0100)

checkout: convert post_checkout_hook() to struct object_id

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use oidcpy() for copying hashes between instances of... René Scharfe Sat, 28 Jan 2017 22:03:06 +0000 (23:03 +0100)

use oidcpy() for copying hashes between instances of struct object_id

Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use oid_to_hex_r() for converting struct object_id... René Scharfe Sat, 28 Jan 2017 22:03:03 +0000 (23:03 +0100)

use oid_to_hex_r() for converting struct object_id hashes to hex strings

Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0001: don't let a default ACL interfere with the umask... Matt McCutchen Sat, 28 Jan 2017 20:25:48 +0000 (15:25 -0500)

t0001: don't let a default ACL interfere with the umask test

The "init creates a new deep directory (umask vs. shared)" test expects
the permissions of newly created files to be based on the umask, which
fails if a default ACL is inherited from the working tree for git. So
attempt to remove a default ACL if there is one. Same idea as
8ed0a740dd42bd0724aebed6e3b07c4ea2a2d5e8. (I guess I'm the only one who
ever runs the test suite with a default ACL set.)

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: add markup to core.logAllRefUpdates docCornelius Weig Fri, 27 Jan 2017 10:09:46 +0000 (11:09 +0100)

config: add markup to core.logAllRefUpdates doc

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: fix git-p4.mapUser on WindowsGeorge Vanburgh Wed, 25 Jan 2017 09:17:29 +0000 (09:17 +0000)

git-p4: fix git-p4.mapUser on Windows

When running git-p4 on Windows, with multiple git-p4.mapUser entries in
git config - no user mappings are applied to the generated repository.

Reproduction Steps:

1. Add multiple git-p4.mapUser entries to git config on a Windows
machine
2. Attempt to clone a p4 repository

None of the user mappings will be applied.

This issue is actually caused by gitConfigList, using split(os.linesep)
to convert the output of git config --get-all into a list. On Windows,
os.linesep is equal to '\r\n' - however git.exe returns configuration
with a line seperator of '\n'.

This leads to the list returned by gitConfigList containing only one
element - which contains the full output of git config --get-all in
string form, which causes problems for the code introduced to
getUserMapFromPerforceServer in 10d08a149d ("git-p4: map a P4 user to
Git author name and email address", 2016-03-01)

This issue should be caught by the test introduced in 10d08a1, however
would require running on Windows to reproduce.

Using splitlines solves this issue, by splitting config on all
typical delimiters ('\n', '\r\n' etc.)

Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

help: improve is_executable() on WindowsHeiko Voigt Mon, 30 Jan 2017 12:40:58 +0000 (13:40 +0100)

help: improve is_executable() on Windows

On Windows, executables need to have the file extension `.exe`, or they
are not executables. Hence, to support scripts, Git for Windows also
looks for a she-bang line by opening the file in question, and executing
it via the specified script interpreter.

To figure out whether files in the `PATH` are executable, `git help` has
code that imitates this behavior. With one exception: it *always* opens
the files and looks for a she-bang line *or* an `MZ` tell-tale
(nevermind that files with the magic `MZ` but without file extension
`.exe` would still not be executable).

Opening this many files leads to performance problems that are even more
serious when a virus scanner is running. Therefore, let's change the
code to look for the file extension `.exe` early, and avoid opening the
file altogether if we already know that it is executable.

See the following measurements (in seconds) as an example, where we
execute a simple program that simply lists the directory contents and
calls open() on every listed file:

With virus scanner running (coldcache):

$ ./a.exe /libexec/git-core/
before open (git-add.exe): 0.000000
after open (git-add.exe): 0.412873
before open (git-annotate.exe): 0.000175
after open (git-annotate.exe): 0.397925
before open (git-apply.exe): 0.000243
after open (git-apply.exe): 0.399996
before open (git-archive.exe): 0.000147
after open (git-archive.exe): 0.397783
before open (git-bisect--helper.exe): 0.000160
after open (git-bisect--helper.exe): 0.397700
before open (git-blame.exe): 0.000160
after open (git-blame.exe): 0.399136
...

With virus scanner running (hotcache):

$ ./a.exe /libexec/git-core/
before open (git-add.exe): 0.000000
after open (git-add.exe): 0.000325
before open (git-annotate.exe): 0.000229
after open (git-annotate.exe): 0.000177
before open (git-apply.exe): 0.000167
after open (git-apply.exe): 0.000150
before open (git-archive.exe): 0.000154
after open (git-archive.exe): 0.000156
before open (git-bisect--helper.exe): 0.000132
after open (git-bisect--helper.exe): 0.000180
before open (git-blame.exe): 0.000718
after open (git-blame.exe): 0.000724
...

With this patch I get:

$ time git help git
Launching default browser to display HTML ...

real 0m8.723s
user 0m0.000s
sys 0m0.000s

and without

$ time git help git
Launching default browser to display HTML ...

real 1m37.734s
user 0m0.000s
sys 0m0.031s

both tests with cold cache and giving the machine some time to settle
down after restart.

[jes: adjusted the commit message]

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

mingw: allow hooks to be .exe filesJohannes Schindelin Mon, 30 Jan 2017 12:28:28 +0000 (13:28 +0100)

mingw: allow hooks to be .exe files

Executable files in Windows need to have the extension '.exe', otherwise
they do not work. Extend the hooks to not just look at the hard coded
names, but also at the names extended by the custom STRIP_EXTENSION,
which is defined as '.exe' in Windows.

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

doc: clarify distinction between sign-off and pgp-signingCornelius Weig Fri, 27 Jan 2017 20:01:36 +0000 (21:01 +0100)

doc: clarify distinction between sign-off and pgp-signing

The documentation for submission discourages pgp-signing, but demands
a proper sign-off by contributors. However, when skimming the headings,
the wording of the section for sign-off could mistakenly be understood
as concerning pgp-signing. Thus, new contributors could oversee the
necessary sign-off.

This commit improves the wording such that the section about sign-off
cannot be misunderstood as pgp-signing. In addition, the paragraph about
pgp-signing is changed such that it avoids the impression that
pgp-signing could be relevant at later stages of the submission.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Helped-by: Philip Oakley <philipoakley@iee.org>
Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: on FreeBSD, look for unzip(1) in /usr/local... Johannes Schindelin Thu, 21 Jul 2016 16:02:54 +0000 (18:02 +0200)

test-lib: on FreeBSD, look for unzip(1) in /usr/local/bin/

Eric Wong reported that while FreeBSD has a /usr/bin/unzip, it uses
different semantics from those that are needed by Git's tests: When
passing the -a option to Info-Zip, it heeds the text attribute of the
.zip file's central directory, while FreeBSD's unzip ignores that
attribute.

The common work-around is to install Info-Zip on FreeBSD, into
/usr/local/bin/.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/Makefile: add a rule to re-run previously-failed... Johannes Schindelin Fri, 27 Jan 2017 17:21:30 +0000 (18:21 +0100)

t/Makefile: add a rule to re-run previously-failed tests

This patch automates the process of determining which tests failed
previously and re-running them.

While developing patch series, it is a good practice to run the test
suite from time to time, just to make sure that obvious bugs are caught
early. With complex patch series, it is common to run `make -j15 -k
test`, i.e. run the tests in parallel and *not* stop at the first
failing test but continue. This has the advantage of identifying
possibly multiple problems in one big test run.

It is particularly important to reduce the turn-around time thusly on
Windows, where the test suite spends 45 minutes on the computer on which
this patch was developed.

It is the most convenient way to determine which tests failed after
running the entire test suite, in parallel, to look for left-over "trash
directory.t*" subdirectories in the t/ subdirectory. However, those
directories might live outside t/ when overridden using the
--root=<directory> option, to which the Makefile has no access. The next
best method is to grep explicitly for failed tests in the test-results/
directory, which the Makefile *can* access.

Please note that the often-recommended `prove` tool requires Perl, and
that opens a whole new can of worms on Windows. As no native Windows Perl
comes with Subversion bindings, we have to use a Perl in Git for Windows
that uses the POSIX emulation layer named MSYS2 (which is a portable
version of Cygwin). When using this emulation layer under stress, e.g.
when running massively-parallel tests, unexplicable crashes occur quite
frequently, and instead of having a solution to the original problem, the
developer now has an additional, quite huge problem. For that reason, this
developer rejected `prove` as a solution and went with this patch instead.

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>