gitweb.git
tests: mark a couple more test cases as requiring ... Johannes Schindelin Tue, 28 May 2019 12:42:14 +0000 (05:42 -0700)

tests: mark a couple more test cases as requiring `rebase -p`

The `--preserve-merges` option has been deprecated, and as a consequence
we started to mark test cases that require that option to be supported,
in preparation for removing that support eventually.

Since we marked those test cases, a couple more crept into the test
suite, and with this patch, we mark them, too.

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

request-pull: warn if the remote object is not the... Paolo Bonzini Tue, 28 May 2019 10:15:43 +0000 (12:15 +0200)

request-pull: warn if the remote object is not the same as the local one

In some cases, git request-pull might be invoked with remote and
local objects that differ even though they point to the same commit.
For example, the remote object might be a lightweight tag
vs. an annotated tag on the local side; or the user might have
reworded the tag locally and forgotten to push it.

When this happens git-request-pull will not warn, because it only
checks that "git ls-remote" returns an SHA1 that matches the local
commit (known as $headrev in the script). This patch makes
git-request-pull retrieve the tag object SHA1 while processing
the "git ls-remote" output, so that it can be matched against the
local object.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

request-pull: quote regex metacharacters in local refPaolo Bonzini Tue, 28 May 2019 10:15:42 +0000 (12:15 +0200)

request-pull: quote regex metacharacters in local ref

The local part of the third argument of git-request-pull is used in
a regular expression without quoting it. Use qr{} and \Q\E to ensure
that e.g. a period in a tag name does not match any character on the
remote side.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bundle verify: error out if called without an object... Johannes Schindelin Mon, 27 May 2019 19:59:14 +0000 (12:59 -0700)

bundle verify: error out if called without an object database

The deal with bundles is: they really are thin packs, with very little
sugar on top. So we really need a repository (or more appropriately, an
object database) to work with, when asked to verify a bundle.

Let's error out with a useful error message if `git bundle verify` is
called without such an object database to work with.

Reported by Konstantin Ryabitsev.

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

mark_fsmonitor_valid(): mark the index as changed if... Johannes Schindelin Fri, 24 May 2019 12:23:48 +0000 (05:23 -0700)

mark_fsmonitor_valid(): mark the index as changed if needed

Without this bug fix, t7519's four "status doesn't detect unreported
modifications" test cases would fail occasionally (and, oddly enough,
*a lot* more frequently on Windows).

The reason is that these test cases intentionally use the side effect of
`git status` to re-write the index if any updates were detected: they
first clean the worktree, run `git status` to update the index as well
as show the output to the casual reader, then make the worktree dirty
again and expect no changes to reported if running with a mocked
fsmonitor hook.

The problem with this strategy was that the index was written during
said `git status` on the clean worktree for the *wrong* reason: not
because the index was marked as changed (it wasn't), but because the
recorded mtimes were racy with the index' own mtime.

As the mtime granularity on Windows is 100 nanoseconds (see e.g.
https://docs.microsoft.com/en-us/windows/desktop/SysInfo/file-times),
the mtimes of the files are often enough *not* racy with the index', so
that that `git status` call currently does not always update the index
(including the fsmonitor extension), causing the test case to fail.

The obvious fix: if we change *any* index entry's `CE_FSMONITOR_VALID`
flag, we should also mark the index as changed. That will cause the
index to be written upon `git status`, *including* an updated fsmonitor
extension.

Side note: Even though the reader might think that the t7519 issue
should be *much* more prevalent on Linux, given that the ext4 filesystem
(that seems to be used by every Linux distribution) stores mtimes in
nanosecond precision. However, ext4 uses `current_kernel_time()` (see
https://unix.stackexchange.com/questions/11599#comment762968_11599; it
is *amazingly* hard to find any proper source of information about such
ext4 questions) whose accuracy seems to depend on many factors but is
safely worse than the 100-nanosecond granularity of NTFS (again, it is
*horribly* hard to find anything remotely authoritative about this
question). So it seems that the racy index condition that hid the bug
fixed by this patch simply is a lot more likely on Linux than on
Windows. But not impossible ;-)

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

fill_stat_cache_info(): prepare for an fsmonitor fixJohannes Schindelin Fri, 24 May 2019 12:23:47 +0000 (05:23 -0700)

fill_stat_cache_info(): prepare for an fsmonitor fix

We will need to pass down the `struct index_state` to
`mark_fsmonitor_valid()` for an upcoming bug fix, and this here function
calls that there function, so we need to extend the signature of
`fill_stat_cache_info()` first.

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

merge: refuse --commit with --squashVishal Verma Fri, 24 May 2019 18:36:17 +0000 (12:36 -0600)

merge: refuse --commit with --squash

Convert option_commit to tristate, representing the states of
'default/untouched', 'enabled-by-cli', 'disabled-by-cli'. With this in
place, check whether option_commit was enabled by cli when squashing a
merge. If so, error out, as this is not supported.

Previously, when --squash was supplied, 'option_commit' was silently
dropped. This could have been surprising to a user who tried to override
the no-commit behavior of squash using --commit explicitly.

Add a note to the --squash option for git-merge to clarify the
incompatibility, and add a test case to t7600-merge.sh

Cc: Junio C Hamano <gitster@pobox.com>
Cc: Rafael Ascensão <rafa.almas@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Vishal Verma <vishal@stellar.sh>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

server-info: do not list unlinked packsEric Wong Thu, 23 May 2019 17:27:23 +0000 (17:27 +0000)

server-info: do not list unlinked packs

Having non-existent packs in objects/info/packs causes
dumb HTTP clients to abort.

v2: use single loop with ALLOC_GROW as suggested by Jeff King

Signed-off-by: Eric Wong <e@80x24.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch-pack: send server options after commandJonathan Tan Wed, 22 May 2019 20:08:22 +0000 (13:08 -0700)

fetch-pack: send server options after command

Currently, if any server options are specified during a protocol v2
fetch, server options will be sent before "command=fetch". Write server
options to the request buffer in send_fetch_request() so that the
components of the request are sent in the correct order.

The protocol documentation states that the command must come first. The
Git server implementation in serve.c (see process_request() in that
file) tolerates any order of command and capability, which is perhaps
why we haven't noticed this. This was noticed when testing against a
JGit server implementation, which follows the documentation in this
regard.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: fail if call could output and name is nullEmily Shaffer Thu, 23 May 2019 20:23:56 +0000 (13:23 -0700)

grep: fail if call could output and name is null

grep_source(), which performs much of the work for Git's grep library,
allows passing an arbitrary struct grep_source which represents the text
which grep_source() should search to match a pattern in the provided
struct grep_opt. In most callers, the grep_source::name field is set to
an appropriate prefix to print before a colon when a result matches:

README:Git is an Open Source project covered by the GNU General

One caller, grep_buffer(), leaves the grep_source::name field set to
NULL because there isn't enough context to determine an appropriate name
for this kind of output line. In practice, this has been fine: the only
caller of grep_buffer() is "git log --grep", and that caller sets
grep_opt::status_only, which disables output and only checks whether a
match exists. But this is brittle: a future caller can call
grep_buffer() without grep_opt::status_only set, and as soon as it hits
a match, grep_source() will try to print the match and segfault:

(null):Git is an Open Source project covered by the GNU General

For example, a future caller might want to print all matching lines from
commits which match a regex.

Futureproof by diagnosing early a use of the API that could trigger that
condition, before we know whether the pattern matches:

BUG: grep.c:1783: grep call which could print a name requires
grep_source.name be non-NULL
Aborted

This way, the caller's author gets an indication of how to fix the issue
- by providing grep_source::name or setting grep_opt::status_only - and
they are warned of the potential for a segfault unconditionally, rather
than only if there is a match.

Noticed while adding such a call to a tutorial on revision walks.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: allow unshelving of branched filesSimon Williams Wed, 22 May 2019 06:21:20 +0000 (07:21 +0100)

git-p4: allow unshelving of branched files

When unshelving a changelist, git-p4 tries to work out the appropriate
parent commit in a given branch (default: HEAD). To do this, it looks
at the state of any pre-existing files in the target Perforce branch,
omitting files added in the shelved changelist. Currently, only files
added (or move targets) are classed as new. However, files integrated
from other branches (i.e. a 'branch' action) also need to be considered
as added, for this purpose.

Signed-off-by: Simon Williams <simon@no-dns-yet.org.uk>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace2: fix tracing when NO_PTHREADS is definedJeff Hostetler Tue, 21 May 2019 19:33:59 +0000 (12:33 -0700)

trace2: fix tracing when NO_PTHREADS is defined

Teach trace2 TLS code to not rely on pthread_getspecific() when NO_PTHREADS
is defined. Instead, always assume the context data of the main thread.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect--helper: verify HEAD could be parsed before... Johannes Schindelin Tue, 21 May 2019 17:50:21 +0000 (10:50 -0700)

bisect--helper: verify HEAD could be parsed before continuing

In 06f5608c14e6 (bisect--helper: `bisect_start` shell function partially
in C, 2019-01-02), we introduced a call to `get_oid()` and did not check
whether it succeeded before using its output.

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

rebase: replace incorrect logical negation by correct... Johannes Schindelin Tue, 21 May 2019 17:50:20 +0000 (10:50 -0700)

rebase: replace incorrect logical negation by correct bitwise one

In bff014dac7d9 (builtin rebase: support the `verbose` and `diffstat`
options, 2018-09-04), we added a line that wanted to remove the
`REBASE_DIFFSTAT` bit from the flags, but it used an incorrect negation.

Found by Coverity.

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

hash-object doc: stop mentioning git-cvsimportÆvar Arnfjörð Bjarmason Mon, 20 May 2019 21:53:10 +0000 (23:53 +0200)

hash-object doc: stop mentioning git-cvsimport

Remove a reference to git-cvsimport in the intro. As can be seen from
the history of this command[1] it was originally intended for use with
git-cvsimport, but how it uses it (and that it uses it at all) is
irrelevant trivia at this point.

1. See 7672db20c2 ("[PATCH] Expose object ID computation functions.",
2005-07-08) and 8b8840e046 ("[PATCH] cvsgit fixes: spaces in
filenames and CVS server dialog woes", 2005-08-15).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: fix --interactive HEAD tree resolutionJeff King Fri, 24 May 2019 06:46:27 +0000 (02:46 -0400)

am: fix --interactive HEAD tree resolution

In --interactive mode, "git am --resolved" will try to generate a patch
based on what is in the index, so that it can prompt "apply this
patch?". To do so it needs the tree of HEAD, which it tries to get with
get_oid_tree(). However, this doesn't yield a tree object; the "tree"
part just means "if you must disambiguate short oids, then prefer trees"
(and we do not need to disambiguate at all, since we are feeding a ref).

Instead, we must parse the oid as a commit (which should always be true
in a non-corrupt repository), and access its tree pointer manually.

This has been broken since the conversion to C in 7ff2683253
(builtin-am: implement -i/--interactive, 2015-08-04), but there was no
test coverage because of interactive-mode's insistence on having a tty.
That was lifted in the previous commit, so we can now add a test for
this case.

Note that before this patch, the test would result in a BUG() which
comes from 3506dc9445 (has_uncommitted_changes(): fall back to empty
tree, 2018-07-11). But before that, we'd have simply segfaulted (and in
fact this is the exact type of case the BUG() added there was trying to
catch!).

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

am: drop tty requirement for --interactiveJeff King Mon, 20 May 2019 12:11:13 +0000 (08:11 -0400)

am: drop tty requirement for --interactive

We have required that the stdin of "am --interactive" be a tty since
a1451104ac (git-am: interactive should fail gracefully., 2005-10-12).
However, this isn't strictly necessary, and makes the tool harder to
test (and is unlike all of our other --interactive commands).

The goal of that commit was to make sure that somebody does not do:

git am --interactive <mbox

and cause us to read commands from the mbox. But we can simply check
up front for this case and complain before entering the interactive
loop.

Technically this disallows:

git am --interactive </dev/null

where our lack of patches means we would never prompt for anything, and
so the old code would not notice our lack of tty (and now we'd die
early). But since such a command is totally pointless, it's no loss.

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

am: read interactive input from stdinJeff King Mon, 20 May 2019 12:09:26 +0000 (08:09 -0400)

am: read interactive input from stdin

In the conversion of git-am from shell script to C, we switched to using
git_prompt(). Unlike the original shell command "read reply", this
doesn't read from stdin at all, but rather from /dev/tty.

In most cases this distinction wouldn't matter. We require (as the shell
script did) that stdin is a tty, so they would generally be the same
thing. But one important exception is our test suite: even with
test_terminal, we cannot test "am --interactive" because it insists on
reading from /dev/tty, not the pseudo-tty we've set up in the test
script.

Fixing this clears the way to adding tests in a future patch.

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

am: simplify prompt response handlingJeff King Mon, 20 May 2019 12:07:15 +0000 (08:07 -0400)

am: simplify prompt response handling

We'll never see a NULL returned from git_prompt(); if it can't produce
any input for us (e.g., because the terminal got EOF) then it will just
die().

So there's no need for us to handle NULL here. And even if there was, it
doesn't make sense to continue; on a true terminal hangup we'd just loop
infinitely trying to get input that will never come.

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

progress: avoid empty line when breaking the progress... SZEDER Gábor Sun, 19 May 2019 14:45:46 +0000 (16:45 +0200)

progress: avoid empty line when breaking the progress line

Since commit 545dc345eb (progress: break too long progress bar lines,
2019-04-12) when splitting a too long progress line, sometimes it
looks as if a superfluous empty line were added between the title
line and the counters.

To make sure that the previously displayed progress line is completely
covered up when writing the new, shorter title line, we calculate how
many characters need to be overwritten with spaces. Alas, this
calculation doesn't account for the newline character at the end of
the new title line, and resulted in printing one more space than
strictly necessary. This extra space character doesn't matter, if the
length of the previous progress line was shorter than the width of the
terminal. However, if the previous line matched the terminal width,
then this extra space made the new line longer, effectively adding
that empty line after the title line.

Fix this off-by-one to avoid that spurious empty line.

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

trace2: document the supported values of GIT_TRACE2... SZEDER Gábor Sun, 19 May 2019 14:43:09 +0000 (16:43 +0200)

trace2: document the supported values of GIT_TRACE2* env variables

The descriptions of the GIT_TRACE2* environment variables link to the
technical docs for further details on the supported values. However,
a link like this only really works if the docs are viewed in a browser
and the full documentation is available. OTOH, in 'man git' there are
no links to conveniently click on, and distro-shipped git packages
tend to include only the man pages, while the technical docs and the
docs in html format are in a separate 'git-doc' package.

So let's describe the supported values to make the manpage more
self-contained, but still keep the references to the technical docs
because the details of the SID, and the JSON and perf output formats
are definitely beyond the scope of 'man git'.

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

trace2: rename environment variables to GIT_TRACE2*SZEDER Gábor Sun, 19 May 2019 14:43:08 +0000 (16:43 +0200)

trace2: rename environment variables to GIT_TRACE2*

For an environment variable that is supposed to be set by users, the
GIT_TR2* env vars are just too unclear, inconsistent, and ugly.

Most of the established GIT_* environment variables don't use
abbreviations, and in case of the few that do (GIT_DIR,
GIT_COMMON_DIR, GIT_DIFF_OPTS) it's quite obvious what the
abbreviations (DIR and OPTS) stand for. But what does TR stand for?
Track, traditional, trailer, transaction, transfer, transformation,
transition, translation, transplant, transport, traversal, tree,
trigger, truncate, trust, or ...?!

The trace2 facility, as the '2' suffix in its name suggests, is
supposed to eventually supercede Git's original trace facility. It's
reasonable to expect that the corresponding environment variables
follow suit, and after the original GIT_TRACE variables they are
called GIT_TRACE2; there is no such thing is 'GIT_TR'.

All trace2-specific config variables are, very sensibly, in the
'trace2' section, not in 'tr2'.

OTOH, we don't gain anything at all by omitting the last three
characters of "trace" from the names of these environment variables.

So let's rename all GIT_TR2* environment variables to GIT_TRACE2*,
before they make their way into a stable release.

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

upload-pack: strip namespace from symref dataJeff King Thu, 23 May 2019 06:11:21 +0000 (02:11 -0400)

upload-pack: strip namespace from symref data

Since 7171d8c15f (upload-pack: send symbolic ref information as
capability, 2013-09-17), we've sent cloning and fetching clients special
information about which branch HEAD is pointing to, so that they don't
have to guess based on matching up commit ids.

However, this feature has never worked properly with the GIT_NAMESPACE
feature. Because upload-pack uses head_ref_namespaced(find_symref), we
do find and report on refs/namespaces/foo/HEAD instead of the actual
HEAD of the repo. This makes sense, since the branch pointed to by the
top-level HEAD may not be advertised at all. But we do two things wrong:

1. We report the full name refs/namespaces/foo/HEAD, instead of just
HEAD. Meaning no client is going to bother doing anything with that
symref, since we're not otherwise advertising it.

2. We report the symref destination using its full name (e.g.,
refs/namespaces/foo/refs/heads/master). That's similarly useless to
the client, who only saw "refs/heads/master" in the advertisement.

We should be stripping the namespace prefix off of both places (which
this patch fixes).

Likely nobody noticed because we tend to do the right thing anyway. Bug
(1) means that we said nothing about HEAD (just refs/namespace/foo/HEAD).
And so the client half of the code, from a45b5f0552 (connect: annotate
refs with their symref information in get_remote_head(), 2013-09-17),
does not annotate HEAD, and we use the fallback in guess_remote_head(),
matching refs by object id. Which is usually right. It only falls down
in ambiguous cases, like the one laid out in the included test.

This also means that we don't have to worry about breaking anybody who
was putting pre-stripped names into their namespace symrefs when we fix
bug (2). Because of bug (1), nobody would have been using the symref we
advertised in the first place (not to mention that those symrefs would
have appeared broken for any non-namespaced access).

Note that we have separate fixes here for the v0 and v2 protocols. The
symref advertisement moved in v2 to be a part of the ls-refs command.
This actually gets part (1) right, since the symref annotation
piggy-backs on the existing ref advertisement, which is properly
stripped. But it still needs a fix for part (2). The included tests
cover both protocols.

Reported-by: Bryan Turner <bturner@atlassian.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitsubmodules: align html and nroff listsEmily Shaffer Wed, 1 May 2019 20:32:17 +0000 (13:32 -0700)

gitsubmodules: align html and nroff lists

There appears to be a bug in the toolchain generating manpages from
lettered lists. When a list is enumerated with letters, the resulting
nroff shows numbers instead. Mostly this is harmless, but in the case of
gitsubmodules, the paragraph following the list refers back to each
bullet by letter. As a result, reading this documentation via `man
gitsubmodules` is hard to parse - readers must infer that a bug exists
and a refers to 1, b refers to 2, and c refers to 3 in the list above.

The problem specifically was introduced in ad47194; previously rather
than generating numerated lists the bulleted area was entirely
monospaced in HTML and shown in plaintext in nroff.

The bug seems to exist in docbook-xml - I've reported it on May 1 via
the docbook-apps mail list - but for now it may make more sense to just
work around the issue.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: es: 2.22.0 round 1Christopher Diaz Riveros Tue, 28 May 2019 16:33:00 +0000 (11:33 -0500)

l10n: es: 2.22.0 round 1

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>

Merge branch 'master' of https://github.com/vnwildman/gitJiang Xin Tue, 21 May 2019 00:55:54 +0000 (08:55 +0800)

Merge branch 'master' of https://github.com/vnwildman/git

* 'master' of https://github.com/vnwildman/git:
l10n: vi.po(4577t): Updated Vietnamese translation for v2.22.0 round 1

Git 2.22-rc1 v2.22.0-rc1Junio C Hamano Sun, 19 May 2019 07:46:42 +0000 (16:46 +0900)

Git 2.22-rc1

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

Merge branch 'js/difftool-no-index'Junio C Hamano Sun, 19 May 2019 07:45:35 +0000 (16:45 +0900)

Merge branch 'js/difftool-no-index'

The "--dir-diff" mode of "git difftool" is not useful in "--no-index"
mode; they are now explicitly marked as mutually incompatible.

* js/difftool-no-index:
difftool --no-index: error out on --dir-diff (and don't crash)

Merge branch 'jk/get-oid-indexed-object-name'Junio C Hamano Sun, 19 May 2019 07:45:35 +0000 (16:45 +0900)

Merge branch 'jk/get-oid-indexed-object-name'

The codepath to parse :<path> that obtains the object name for an
indexed object has been made more robust.

* jk/get-oid-indexed-object-name:
get_oid: handle NULL repo->index

Merge branch 'jc/set-packet-header-signature-fix'Junio C Hamano Sun, 19 May 2019 07:45:35 +0000 (16:45 +0900)

Merge branch 'jc/set-packet-header-signature-fix'

Code clean-up.

* jc/set-packet-header-signature-fix:
pkt-line: drop 'const'-ness of a param to set_packet_header()

Merge branch 'cb/http-push-null-in-message-fix'Junio C Hamano Sun, 19 May 2019 07:45:35 +0000 (16:45 +0900)

Merge branch 'cb/http-push-null-in-message-fix'

Code clean-up.

* cb/http-push-null-in-message-fix:
http-push: prevent format overflow warning with gcc >= 9

Merge branch 'js/stash-in-c-use-builtin-doc'Junio C Hamano Sun, 19 May 2019 07:45:34 +0000 (16:45 +0900)

Merge branch 'js/stash-in-c-use-builtin-doc'

Doc update.

* js/stash-in-c-use-builtin-doc:
stash: document stash.useBuiltin

Merge branch 'tz/test-lib-check-working-jgit'Junio C Hamano Sun, 19 May 2019 07:45:34 +0000 (16:45 +0900)

Merge branch 'tz/test-lib-check-working-jgit'

A prerequiste check in the test suite to see if a working jgit is
available was made more robust.

* tz/test-lib-check-working-jgit:
test-lib: try harder to ensure a working jgit

Merge branch 'js/parseopt-unknown-cb-returns-an-enum'Junio C Hamano Sun, 19 May 2019 07:45:34 +0000 (16:45 +0900)

Merge branch 'js/parseopt-unknown-cb-returns-an-enum'

Code clean-up.

* js/parseopt-unknown-cb-returns-an-enum:
parse-options: adjust `parse_opt_unknown_cb()`s declared return type

Merge branch 'ab/sha1dc'Junio C Hamano Sun, 19 May 2019 07:45:34 +0000 (16:45 +0900)

Merge branch 'ab/sha1dc'

Update collision-detecting SHA-1 code to build properly on HP-UX.

* ab/sha1dc:
sha1dc: update from upstream

Merge branch 'js/fsmonitor-refresh-after-discarding... Junio C Hamano Sun, 19 May 2019 07:45:33 +0000 (16:45 +0900)

Merge branch 'js/fsmonitor-refresh-after-discarding-index'

The fsmonitor interface got out of sync after the in-core index
file gets discarded, which has been corrected.

* js/fsmonitor-refresh-after-discarding-index:
fsmonitor: force a refresh after the index was discarded
fsmonitor: demonstrate that it is not refreshed after discard_index()

Merge branch 'js/rebase-i-label-shown-in-status-fix'Junio C Hamano Sun, 19 May 2019 07:45:33 +0000 (16:45 +0900)

Merge branch 'js/rebase-i-label-shown-in-status-fix'

"git status" did not know that the "label" instruction in the
todo-list "rebase -i -r" uses should not be shown as a hex object
name.

* js/rebase-i-label-shown-in-status-fix:
status: fix display of rebase -ir's `label` command

Merge branch 'es/check-non-portable-pre-5.10'Junio C Hamano Sun, 19 May 2019 07:45:33 +0000 (16:45 +0900)

Merge branch 'es/check-non-portable-pre-5.10'

Developer support update.

* es/check-non-portable-pre-5.10:
check-non-portable-shell: support Perl versions older than 5.10

Merge branch 'ds/trace2-document-env-vars'Junio C Hamano Sun, 19 May 2019 07:45:33 +0000 (16:45 +0900)

Merge branch 'ds/trace2-document-env-vars'

Doc update.

* ds/trace2-document-env-vars:
trace2: add variable description to git.txt

Merge branch 'cm/notes-comment-fix'Junio C Hamano Sun, 19 May 2019 07:45:32 +0000 (16:45 +0900)

Merge branch 'cm/notes-comment-fix'

A stale in-code comment has been updated.

* cm/notes-comment-fix:
notes: correct documentation of format_display_notes()

Merge branch 'tt/no-ipv6-fallback-for-winxp'Junio C Hamano Sun, 19 May 2019 07:45:32 +0000 (16:45 +0900)

Merge branch 'tt/no-ipv6-fallback-for-winxp'

Code cleanup.

* tt/no-ipv6-fallback-for-winxp:
mingw: remove obsolete IPv6-related code

Merge branch 'js/t5580-unc-alternate-test'Junio C Hamano Sun, 19 May 2019 07:45:32 +0000 (16:45 +0900)

Merge branch 'js/t5580-unc-alternate-test'

An additional test for MinGW

* js/t5580-unc-alternate-test:
t5580: verify that alternates can be UNC paths

Merge branch 'ds/cvsexportcommit-force-text'Junio C Hamano Sun, 19 May 2019 07:45:31 +0000 (16:45 +0900)

Merge branch 'ds/cvsexportcommit-force-text'

"git cvsexportcommit" running on msys did not expect cvsnt showed
"cvs status" output with CRLF line endings.

* ds/cvsexportcommit-force-text:
cvsexportcommit: force crlf translation

Merge branch 'sg/ci-libsvn-perl'Junio C Hamano Sun, 19 May 2019 07:45:31 +0000 (16:45 +0900)

Merge branch 'sg/ci-libsvn-perl'

To run tests for Git SVN, our scripts for CI used to install the
git-svn package (in the hope that it would bring in the right
dependencies). This has been updated to install the more direct
dependency, namely, libsvn-perl.

* sg/ci-libsvn-perl:
ci: install 'libsvn-perl' instead of 'git-svn'

Merge branch 'bl/t4253-exit-code-from-format-patch'Junio C Hamano Sun, 19 May 2019 07:45:31 +0000 (16:45 +0900)

Merge branch 'bl/t4253-exit-code-from-format-patch'

Avoid patterns to pipe output from a git command to feed another
command in tests.

* bl/t4253-exit-code-from-format-patch:
t4253-am-keep-cr-dos: avoid using pipes

Merge branch 'ds/midx-too-many-packs'Junio C Hamano Sun, 19 May 2019 07:45:30 +0000 (16:45 +0900)

Merge branch 'ds/midx-too-many-packs'

The code to generate the multi-pack idx file was not prepared to
see too many packfiles and ran out of open file descriptor, which
has been corrected.

* ds/midx-too-many-packs:
midx: add packs to packed_git linked list
midx: pass a repository pointer

Merge branch 'en/unicode-in-refnames'Junio C Hamano Sun, 19 May 2019 07:45:30 +0000 (16:45 +0900)

Merge branch 'en/unicode-in-refnames'

On a filesystem like HFS+, the names of the refs stored as filesystem
entities may become different from what the end-user expects, just
like files in the working tree get "renamed". Work around the
mismatch by paying attention to the core.precomposeUnicode
configuration.

* en/unicode-in-refnames:
Honor core.precomposeUnicode in more places

Merge branch 'dl/difftool-mergetool'Junio C Hamano Sun, 19 May 2019 07:45:30 +0000 (16:45 +0900)

Merge branch 'dl/difftool-mergetool'

Update "git difftool" and "git mergetool" so that the combinations
of {diff,merge}.{tool,guitool} configuration variables serve as
fallback settings of each other in a sensible order.

* dl/difftool-mergetool:
difftool: fallback on merge.guitool
difftool: make --gui, --tool and --extcmd mutually exclusive
mergetool: fallback to tool when guitool unavailable
mergetool--lib: create gui_mode function
mergetool: use get_merge_tool function
t7610: add mergetool --gui tests
t7610: unsuppress output

Merge branch 'mh/http-fread-api-fix'Junio C Hamano Sun, 19 May 2019 07:45:29 +0000 (16:45 +0900)

Merge branch 'mh/http-fread-api-fix'

A pair of private functions in http.c that had names similar to
fread/fwrite did not return the number of elements, which was found
to be confusing.

* mh/http-fread-api-fix:
Make fread/fwrite-like functions in http.c more like fread/fwrite.

Merge branch 'js/t6500-use-windows-pid-on-mingw'Junio C Hamano Sun, 19 May 2019 07:45:29 +0000 (16:45 +0900)

Merge branch 'js/t6500-use-windows-pid-on-mingw'

Future-proof a test against an update to MSYS2 runtime v3.x series.

* js/t6500-use-windows-pid-on-mingw:
t6500(mingw): use the Windows PID of the shell

Merge branch 'jk/apache-lsan'Junio C Hamano Sun, 19 May 2019 07:45:29 +0000 (16:45 +0900)

Merge branch 'jk/apache-lsan'

Allow tests that involve httpd to be run under leak sanitizer, just
like we can already do so under address sanitizer.

* jk/apache-lsan:
t/lib-httpd: pass LSAN_OPTIONS through apache

Merge branch 'nd/parse-options-aliases'Junio C Hamano Sun, 19 May 2019 07:45:28 +0000 (16:45 +0900)

Merge branch 'nd/parse-options-aliases'

Attempt to use an abbreviated option in "git clone --recurs" is
responded by a request to disambiguate between --recursive and
--recurse-submodules, which is bad because these two are synonyms.
The parse-options API has been extended to define such synonyms
more easily and not produce an unnecessary failure.

* nd/parse-options-aliases:
parse-options: don't emit "ambiguous option" for aliases

Merge branch 'dl/branch-from-3dot-merge-base'Junio C Hamano Sun, 19 May 2019 07:45:28 +0000 (16:45 +0900)

Merge branch 'dl/branch-from-3dot-merge-base'

"git branch new A...B" and "git checkout -b new A...B" have been
taught that in their contexts, the notation A...B means "the merge
base between these two commits", just like "git checkout A...B"
detaches HEAD at that commit.

* dl/branch-from-3dot-merge-base:
branch: make create_branch accept a merge base rev
t2018: cleanup in current test

Merge branch 'js/commit-graph-parse-leakfix'Junio C Hamano Sun, 19 May 2019 07:45:28 +0000 (16:45 +0900)

Merge branch 'js/commit-graph-parse-leakfix'

Leakfix.

* js/commit-graph-parse-leakfix:
commit-graph: fix memory leak

Merge branch 'jk/cocci-batch'Junio C Hamano Sun, 19 May 2019 07:45:28 +0000 (16:45 +0900)

Merge branch 'jk/cocci-batch'

Optionally "make coccicheck" can feed multiple source files to
spatch, gaining performance while spending more memory.

* jk/cocci-batch:
coccicheck: make batch size of 0 mean "unlimited"
coccicheck: optionally batch spatch invocations

Merge branch 'ab/perf-installed-fix'Junio C Hamano Sun, 19 May 2019 07:45:28 +0000 (16:45 +0900)

Merge branch 'ab/perf-installed-fix'

Performance test framework has been broken and measured the version
of Git that happens to be on $PATH, not the specified one to
measure, for a while, which has been corrected.

* ab/perf-installed-fix:
perf-lib.sh: forbid the use of GIT_TEST_INSTALLED
perf tests: add "bindir" prefix to git tree test results
perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh
perf-lib.sh: make "./run <revisions>" use the correct gits
perf aggregate: remove GIT_TEST_INSTALLED from --codespeed
perf README: correct docs for 3c8f12c96c regression

Merge branch 'id/windows-dep-aslr'Junio C Hamano Sun, 19 May 2019 07:45:27 +0000 (16:45 +0900)

Merge branch 'id/windows-dep-aslr'

Allow DEP and ASLR for Windows build to for security hardening.

* id/windows-dep-aslr:
mingw: enable DEP and ASLR
mingw: do not let ld strip relocations

Merge branch 'ab/trace2-typofix'Junio C Hamano Sun, 19 May 2019 07:45:27 +0000 (16:45 +0900)

Merge branch 'ab/trace2-typofix'

Typofix.

* ab/trace2-typofix:
trace2: fix up a missing "leave" entry point

Merge branch 'nd/submodule-helper-incomplete-line-fix'Junio C Hamano Sun, 19 May 2019 07:45:27 +0000 (16:45 +0900)

Merge branch 'nd/submodule-helper-incomplete-line-fix'

Typofix.

* nd/submodule-helper-incomplete-line-fix:
submodule--helper: add a missing \n

Merge branch 'cw/diff-highlight'Junio C Hamano Sun, 19 May 2019 07:45:26 +0000 (16:45 +0900)

Merge branch 'cw/diff-highlight'

Portability fix for a diff-highlight tool (in contrib/).

* cw/diff-highlight:
diff-highlight: use correct /dev/null for UNIX and Windows

Merge branch 'dl/warn-tagging-a-tag'Junio C Hamano Sun, 19 May 2019 07:45:26 +0000 (16:45 +0900)

Merge branch 'dl/warn-tagging-a-tag'

Typofix.

* dl/warn-tagging-a-tag:
tag: fix typo in nested tagging hint

diff: fix mistake in translatable stringsJean-Noël Avila Fri, 17 May 2019 19:26:19 +0000 (21:26 +0200)

diff: fix mistake in translatable strings

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: vi.po(4577t): Updated Vietnamese translation... Tran Ngoc Quan Sun, 19 May 2019 01:40:33 +0000 (08:40 +0700)

l10n: vi.po(4577t): Updated Vietnamese translation for v2.22.0 round 1

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

l10n: fr.po v2.22.0.rnd1Jean-Noël Avila Fri, 17 May 2019 17:55:39 +0000 (19:55 +0200)

l10n: fr.po v2.22.0.rnd1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>

Use xmmap_gently instead of xmmap in use_packMike Hommey Thu, 16 May 2019 00:37:36 +0000 (09:37 +0900)

Use xmmap_gently instead of xmmap in use_pack

use_pack has its own error message on mmap error, but it can't be
reached when using xmmap, which dies with its own error.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dup() the input fd for fast-import used for remote... Mike Hommey Thu, 16 May 2019 00:37:35 +0000 (09:37 +0900)

dup() the input fd for fast-import used for remote helpers

When a remote helper exposes the "import" capability, stdout of the
helper is sent to stdin of a new fast-import process. This is done by
setting the corresponding child_process's in field to the value of the
out field of the helper child_process.

The child_process API is defined to close the file descriptors it's
given when calling start_command. This means when start_command is
called for the fast-import process, its input fd (the output fd of the
helper), is closed.

But when the transport helper is later destroyed, in disconnect_helper,
its input and output are closed, which means close() is called with
an invalid fd (since it was already closed as per above). Or worse, with
a valid fd owned by something else (since fd numbers can be reused).

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pkt-line: drop 'const'-ness of a param to set_packet_he... Junio C Hamano Wed, 15 May 2019 01:42:35 +0000 (10:42 +0900)

pkt-line: drop 'const'-ness of a param to set_packet_header()

The function's definition has a paramter of type "int" qualified as
"const". The fact that the incoming parameter is used as read-only
in the fuction is an implementation detail that the callers should
not have to be told in the prototype declaring it (and "const" there
has no effect, as C passes parameters by value).

The prototype defined for the function in pkt-line.h lacked the
matching "const" for this reason, but apparently some compilers
(e.g. MS Visual C 2017) complain about the parameter type mismatch.

Let's squelch it by removing the "const" that is pointless in the
definition of a small and trivial function like this, which would
not help optimizing compilers nor reading humans that much.

Noticed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: try harder to ensure a working jgitTodd Zullinger Wed, 15 May 2019 01:36:33 +0000 (21:36 -0400)

test-lib: try harder to ensure a working jgit

The JGIT prereq uses `type jgit` to determine whether jgit is present.
While this is usually sufficient, it won't help if the jgit found is
badly broken. This wastes time running tests which fail due to no fault
of our own.

Use `jgit --version` instead, to guard against cases where jgit is
present on the system, but will fail to run, e.g. because of some JRE
issue, or missing Java dependencies. Checking that it gets far enough
to process the '--version' argument isn't perfect, but seems to be good
enough in practice. It's also consistent with how we detect some other
dependencies, see e.g. the CURL and UNZIP prerequisites.

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

worktree add: be tolerant of corrupt worktreesNguyễn Thái Ngọc Duy Mon, 13 May 2019 10:49:44 +0000 (17:49 +0700)

worktree add: be tolerant of corrupt worktrees

find_worktree() can die() unexpectedly because it uses real_path()
instead of the gentler version. When it's used in 'git worktree add' [1]
and there's a bad worktree, this die() could prevent people from adding
new worktrees.

The "bad" condition to trigger this is when a parent of the worktree's
location is deleted. Then real_path() will complain.

Use the other version so that bad worktrees won't affect 'worktree
add'. The bad ones will eventually be pruned, we just have to tolerate
them for a bit.

[1] added in cb56f55c16 (worktree: disallow adding same path multiple
times, 2018-08-28), or since v2.20.0. Though the real bug in
find_worktree() is much older.

Reported-by: Shaheed Haque <shaheedhaque@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

get_oid: handle NULL repo->indexJeff King Tue, 14 May 2019 13:54:55 +0000 (09:54 -0400)

get_oid: handle NULL repo->index

When get_oid() and its helpers see an index name like ":.gitmodules",
they try to load the index on demand, like:

if (repo->index->cache)
repo_read_index(repo);

However, that misses the case when "repo->index" itself is NULL; we'll
segfault in the conditional.

This never happens with the_repository; there we always point its index
field to &the_index. But a submodule repository may have a NULL index
field until somebody calls repo_read_index().

This bug is triggered by t7411, but it was hard to notice because it's
in an expect_failure block. That test was added by 2b1257e463 (t/helper:
add test-submodule-nested-repo-config, 2018-10-25). Back then we had no
easy way to access the .gitmodules blob of a submodule repo, so we
expected (and got) an error message to that effect. Later, d9b8b8f896
(submodule-config.c: use repo_get_oid for reading .gitmodules,
2019-04-16) started looking in the correct repo, which is when we
started triggering the segfault.

With this fix, the test starts passing (once we clean it up as its
comment instructs).

Note that as far as I know, this bug could not be triggered outside of
the test suite. It requires resolving an index name in a submodule, and
all of the code paths (aside from test-tool) which do that either load
the index themselves, or always pass the_repository.

Ultimately it comes from 3a7a698e93 (sha1-name.c: remove implicit
dependency on the_index, 2019-01-12), which replaced a check of
"the_index.cache" with "repo->index->cache". So even if there is another
way to trigger it, it wouldn't affect any versions before then.

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

http-push: prevent format overflow warning with gcc... Carlo Marcelo Arenas Belón Tue, 14 May 2019 21:11:17 +0000 (14:11 -0700)

http-push: prevent format overflow warning with gcc >= 9

In function 'finish_request',
inlined from 'process_response' at http-push.c:248:2:
http-push.c:587:4: warning: '%s' directive argument is null [-Wformat-overflow=]
587 | fprintf(stderr, "Unable to get pack file %s\n%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
588 | request->url, curl_errorstr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

request->url is needed for the error message if there was a failure
during fetch but was being cleared unnecessarily earlier.

note that the leak is prevented by calling release_request unconditionally
at the end.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: prefetch missing REF_DELTA basesJonathan Tan Tue, 14 May 2019 21:10:55 +0000 (14:10 -0700)

index-pack: prefetch missing REF_DELTA bases

When fetching, the client sends "have" commit IDs indicating that the
server does not need to send any object referenced by those commits,
reducing network I/O. When the client is a partial clone, the client
still sends "have"s in this way, even if it does not have every object
referenced by a commit it sent as "have".

If a server omits such an object, it is fine: the client could lazily
fetch that object before this fetch, and it can still do so after.

The issue is when the server sends a thin pack containing an object that
is a REF_DELTA against such a missing object: index-pack fails to fix
the thin pack. When support for lazily fetching missing objects was
added in 8b4c0103a9 ("sha1_file: support lazily fetching missing
objects", 2017-12-08), support in index-pack was turned off in the
belief that it accesses the repo only to do hash collision checks.
However, this is not true: it also needs to access the repo to resolve
REF_DELTA bases.

Support for lazy fetching should still generally be turned off in
index-pack because it is used as part of the lazy fetching process
itself (if not, infinite loops may occur), but we do need to fetch the
REF_DELTA bases. (When fetching REF_DELTA bases, it is unlikely that
those are REF_DELTA themselves, because we do not send "have" when
making such fetches.)

To resolve this, prefetch all missing REF_DELTA bases before attempting
to resolve them. This both ensures that all bases are attempted to be
fetched, and ensures that we make only one request per index-pack
invocation, and not one request per missing object.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5616: refactor packfile replacementJonathan Tan Tue, 14 May 2019 21:10:54 +0000 (14:10 -0700)

t5616: refactor packfile replacement

A subsequent patch will perform the same packfile replacement that is
already done twice, so refactor it into its own function. Also, the same
subsequent patch will use, in another way, part of the packfile
replacement functionality, so extract those out too.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: document stash.useBuiltinJohannes Schindelin Tue, 14 May 2019 09:19:15 +0000 (02:19 -0700)

stash: document stash.useBuiltin

The stash.useBuiltin variable introduced in 90a462725e ("stash:
optionally use the scripted version again", 2019-02-25) was turned on by
default, but had no documentation.

Let's document it so that users who run into any stability issues with
the C rewrite know there's an escape hatch, and spell out that the
user should please report the bug when they have to turn off the
built-in stash.

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

l10n: sv.po: Update Swedish translation (4577t0f0u)Peter Krefting Tue, 14 May 2019 14:46:15 +0000 (15:46 +0100)

l10n: sv.po: Update Swedish translation (4577t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>

l10n: sv.po: Update Swedish translationPeter Krefting Sun, 17 Mar 2019 15:52:33 +0000 (16:52 +0100)

l10n: sv.po: Update Swedish translation

Fix mistakes reported by Mattias Engdegård <mattiase@acm.org>.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>

l10n: git.pot: v2.22.0 round 1 (270 new, 56 removed)Jiang Xin Tue, 14 May 2019 09:09:58 +0000 (17:09 +0800)

l10n: git.pot: v2.22.0 round 1 (270 new, 56 removed)

Generate po/git.pot from v2.22.0-rc0 for git v2.22.0 l10n round 1.

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

sha1dc: update from upstreamÆvar Arnfjörð Bjarmason Mon, 13 May 2019 22:17:01 +0000 (00:17 +0200)

sha1dc: update from upstream

Update sha1dc from the latest version by the upstream
maintainer[1]. See 07a20f569b ("Makefile: fix unaligned loads in
sha1dc with UBSan", 2019-03-12) for the last update.

This fixes an issue where HP-UX IA64 was wrongly detected as a
Little-endian instead of a Big-endian system, see [2] and [3].

1. https://github.com/cr-marcstevens/sha1collisiondetection/commit/855827c583bc30645ba427885caa40c5b81764d2
2. https://public-inbox.org/git/603989bd-f86d-c61d-c6f5-fb6748a65ba9@siemens.com/
3. https://github.com/cr-marcstevens/sha1collisiondetection/pull/50

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

parse-options: adjust `parse_opt_unknown_cb()`s declare... Johannes Schindelin Mon, 13 May 2019 22:43:17 +0000 (15:43 -0700)

parse-options: adjust `parse_opt_unknown_cb()`s declared return type

In f41179f16ba2 (parse-options: avoid magic return codes, 2019-01-27),
the signature of the low-level parse-opt callback function was changed
to return an `enum`.

And while the implementations were changed, one declaration was left
unchanged, still claiming to return `int`.

This can potentially lead to problems, as compilers are free to choose
any integral type for an `enum` as long as it can represent all declared
values.

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

Git 2.22-rc0 v2.22.0-rc0Junio C Hamano Mon, 13 May 2019 14:40:13 +0000 (23:40 +0900)

Git 2.22-rc0

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

Merge branch 'jh/trace2'Junio C Hamano Mon, 13 May 2019 14:50:35 +0000 (23:50 +0900)

Merge branch 'jh/trace2'

A few embarrassing bugfixes.

* jh/trace2:
trace2: fix up a missing "leave" entry point
trace2: fix incorrect function pointer check

Merge branch 'cc/access-on-aix-workaround'Junio C Hamano Mon, 13 May 2019 14:50:35 +0000 (23:50 +0900)

Merge branch 'cc/access-on-aix-workaround'

Workaround for standard-compliant but less-than-useful behaviour of
access(2) for the root user.

* cc/access-on-aix-workaround:
git-compat-util: work around for access(X_OK) under root

Merge branch 'pw/clean-sequencer-state-upon-final-commit'Junio C Hamano Mon, 13 May 2019 14:50:35 +0000 (23:50 +0900)

Merge branch 'pw/clean-sequencer-state-upon-final-commit'

"git chery-pick" (and "revert" that shares the same runtime engine)
that deals with multiple commits got confused when the final step
gets stopped with a conflict and the user concluded the sequence
with "git commit". Attempt to fix it by cleaning up the state
files used by these commands in such a situation.

* pw/clean-sequencer-state-upon-final-commit:
fix cherry-pick/revert status after commit
commit/reset: try to clean up sequencer state

Merge branch 'pw/rebase-i-internal'Junio C Hamano Mon, 13 May 2019 14:50:34 +0000 (23:50 +0900)

Merge branch 'pw/rebase-i-internal'

The internal implementation of "git rebase -i" has been updated to
avoid forking a separate "rebase--interactive" process.

* pw/rebase-i-internal:
rebase -i: run without forking rebase--interactive
rebase: use a common action enum
rebase -i: use struct rebase_options in do_interactive_rebase()
rebase -i: use struct rebase_options to parse args
rebase -i: use struct object_id for squash_onto
rebase -i: use struct commit when parsing options
rebase -i: remove duplication
rebase -i: combine rebase--interactive.c with rebase.c
rebase: use OPT_RERERE_AUTOUPDATE()
rebase: rename write_basic_state()
rebase: don't translate trace strings
sequencer: always discard index after checkout

Merge branch 'jk/perf-aggregate-wo-libjson'Junio C Hamano Mon, 13 May 2019 14:50:34 +0000 (23:50 +0900)

Merge branch 'jk/perf-aggregate-wo-libjson'

The script to aggregate perf result unconditionally depended on
libjson-perl even though it did not have to, which has been
corrected.

* jk/perf-aggregate-wo-libjson:
t/perf: depend on perl JSON only when using --codespeed

Merge branch 'dl/rev-tilde-doc-clarify'Junio C Hamano Mon, 13 May 2019 14:50:33 +0000 (23:50 +0900)

Merge branch 'dl/rev-tilde-doc-clarify'

Docfix.

* dl/rev-tilde-doc-clarify:
revisions.txt: remove ambibuity between <rev>:<path> and :<path>
revisions.txt: mention <rev>~ form
revisions.txt: mark optional rev arguments with []
revisions.txt: change "rev" to "<rev>"

Merge branch 'jc/make-dedup-ls-files-output'Junio C Hamano Mon, 13 May 2019 14:50:33 +0000 (23:50 +0900)

Merge branch 'jc/make-dedup-ls-files-output'

A "ls-files" that emulates "find" to enumerate files in the working
tree resulted in duplicated Makefile rules that caused the build to
issue an unnecessary warning during a trial build after merge
conflicts are resolved in working tree *.h files but before the
resolved results are added to the index. This has been corrected.

* jc/make-dedup-ls-files-output:
Makefile: dedup list of files obtained from ls-files

Merge branch 'jk/ls-files-doc-markup-fix'Junio C Hamano Mon, 13 May 2019 14:50:33 +0000 (23:50 +0900)

Merge branch 'jk/ls-files-doc-markup-fix'

Docfix.

* jk/ls-files-doc-markup-fix:
doc/ls-files: put nested list for "-t" option into block

Merge branch 'jk/p5302-avoid-collision-check-cost'Junio C Hamano Mon, 13 May 2019 14:50:32 +0000 (23:50 +0900)

Merge branch 'jk/p5302-avoid-collision-check-cost'

Fix index-pack perf test so that the repeated invocations always
run in an empty repository, which emulates the initial clone
situation better.

* jk/p5302-avoid-collision-check-cost:
p5302: create the repo in each index-pack test

Merge branch 'dl/no-extern-in-func-decl'Junio C Hamano Mon, 13 May 2019 14:50:32 +0000 (23:50 +0900)

Merge branch 'dl/no-extern-in-func-decl'

Mechanically and systematically drop "extern" from function
declarlation.

* dl/no-extern-in-func-decl:
*.[ch]: manually align parameter lists
*.[ch]: remove extern from function declarations using sed
*.[ch]: remove extern from function declarations using spatch

Merge branch 'ew/repack-with-bitmaps-by-default'Junio C Hamano Mon, 13 May 2019 14:50:32 +0000 (23:50 +0900)

Merge branch 'ew/repack-with-bitmaps-by-default'

The connectivity bitmaps are created by default in bare
repositories now; also the pathname hash-cache is created by
default to avoid making crappy deltas when repacking.

* ew/repack-with-bitmaps-by-default:
pack-objects: default to writing bitmap hash-cache
t5310: correctly remove bitmaps for jgit test
repack: enable bitmaps by default on bare repos

Merge branch 'js/partial-clone-connectivity-check'Junio C Hamano Mon, 13 May 2019 14:50:31 +0000 (23:50 +0900)

Merge branch 'js/partial-clone-connectivity-check'

During an initial "git clone --depth=..." partial clone, it is
pointless to spend cycles for a large portion of the connectivity
check that enumerates and skips promisor objects (which by
definition is all objects fetched from the other side). This has
been optimized out.

* js/partial-clone-connectivity-check:
t/perf: add perf script for partial clones
clone: do faster object check for partial clones

Merge branch 'jh/trace2-sid-fix'Junio C Hamano Mon, 13 May 2019 14:50:31 +0000 (23:50 +0900)

Merge branch 'jh/trace2-sid-fix'

Polishing of the new trace2 facility continues. The system-level
configuration can specify site-wide trace2 settings, which can be
overridden with per-user configuration and environment variables.

* jh/trace2-sid-fix:
trace2: fixup access problem on /etc/gitconfig in read_very_early_config
trace2: update docs to describe system/global config settings
trace2: make SIDs more unique
trace2: clarify UTC datetime formatting
trace2: report peak memory usage of the process
trace2: use system/global config for default trace2 settings
config: add read_very_early_config()
trace2: find exec-dir before trace2 initialization
trace2: add absolute elapsed time to start event
trace2: refactor setting process starting time
config: initialize opts structure in repo_read_config()

difftool: fallback on merge.guitoolDenton Liu Mon, 29 Apr 2019 06:21:20 +0000 (02:21 -0400)

difftool: fallback on merge.guitool

In git-difftool.txt, it says

'git difftool' falls back to 'git mergetool' config variables when the
difftool equivalents have not been defined.

However, when `diff.guitool` is missing, it doesn't fallback to
anything. Make git-difftool fallback to `merge.guitool` when `diff.guitool` is
missing.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: make --gui, --tool and --extcmd mutually... Denton Liu Mon, 29 Apr 2019 06:21:17 +0000 (02:21 -0400)

difftool: make --gui, --tool and --extcmd mutually exclusive

In git-difftool, these options specify which tool to ultimately run. As
a result, they are logically conflicting. Explicitly disallow these
options from being used together.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool: fallback to tool when guitool unavailableDenton Liu Mon, 29 Apr 2019 06:21:14 +0000 (02:21 -0400)

mergetool: fallback to tool when guitool unavailable

In git-difftool, if the tool is called with --gui but `diff.guitool` is
not set, it falls back to `diff.tool`. Make git-mergetool also fallback
from `merge.guitool` to `merge.tool` if the former is undefined.

If git-difftool, when called with `--gui`, were to use
`get_configured_mergetool` in a future patch, it would also get the
fallback behavior in the following precedence:

1. diff.guitool
2. merge.guitool
3. diff.tool
4. merge.tool

The behavior for when difftool or mergetool are called without `--gui`
should be identical with or without this patch.

Note that the search loop could be written as

sections="merge"
keys="tool"
if diff_mode
then
sections="diff $sections"
fi
if gui_mode
then
keys="guitool $keys"
fi

merge_tool=$(
IFS=' '
for key in $keys
do
for section in $sections
do
selected=$(git config $section.$key)
if test -n "$selected"
then
echo "$selected"
return
fi
done
done)

which would make adding a mode in the future much easier. However,
adding a new mode will likely never happen as it is highly discouraged
so, as a result, it is written in its current form so that it is more
readable for future readers.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool--lib: create gui_mode functionDenton Liu Mon, 29 Apr 2019 06:21:11 +0000 (02:21 -0400)

mergetool--lib: create gui_mode function

Before, in `get_configured_merge_tool`, we would test the value of the
first argument directly, which corresponded to whether we were using
guitool. However, since `$GIT_MERGETOOL_GUI` is available as an
environment variable, create the `gui_mode` function which increases the
clarify of functions which use it.

While we're at it, add a space before `()` in function definitions to
fix the style.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool: use get_merge_tool functionDenton Liu Mon, 29 Apr 2019 06:21:08 +0000 (02:21 -0400)

mergetool: use get_merge_tool function

In git-mergetool, the logic for getting which merge tool to use is
duplicated in git-mergetool--lib, except for the fact that it needs to
know whether the tool was guessed or not.

Rewrite `get_merge_tool` to return whether or not the tool was guessed
through the return code and make git-mergetool call this function
instead of duplicating the logic. Note that 1 was chosen to be the
return code of when a tool is guessed because it seems like a slightly
more abnormal condition than getting a tool that's explicitly specified
but this is completely arbitrary.

Also, let `$GIT_MERGETOOL_GUI` be set to determine whether or not the
guitool will be selected.

This change is not completely backwards compatible as there may be
external users of git-mergetool--lib. However, only one user,
git-diffall[1], was found from searching GitHub and Google, and this
tool is superseded by `git difftool --dir-diff` anyway. It seems very
unlikely that there exists an external caller that would take into
account the return code of `get_merge_tool` as it would always return 0
before this change so this change probably does not affect any external
users.

[1]: https://github.com/thenigan/git-diffall

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace2: add variable description to git.txtDerrick Stolee Fri, 10 May 2019 19:44:26 +0000 (12:44 -0700)

trace2: add variable description to git.txt

Documentation/technical/api-trace2.txt contains the full details
of the trace2 API and the GIT_TR2* environment variables. However,
most environment variables are included in Documentation/git.txt,
including the GIT_TRACE* variables.

Add a brief description of the GIT_TR2* variables with links to
the full technical details. The biggest difference from the
original variables is that we can specify a Unix Domain Socket.
Mention this difference, but leave the details to the technical
documents.

Reported-by: Szeder Gábor <szeder.dev@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: fix display of rebase -ir's `label` commandJohannes Schindelin Fri, 10 May 2019 20:23:14 +0000 (13:23 -0700)

status: fix display of rebase -ir's `label` command

The argument of a `label` command does *not* want to be turned into an
abbreviated SHA-1.

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