gitweb.git
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>

revision: keep topo-walk free of unintersting commitsDerrick Stolee Tue, 21 May 2019 13:59:53 +0000 (09:59 -0400)

revision: keep topo-walk free of unintersting commits

When updating the topo-order walk in b454241 (revision.c: generation-based
topo-order algorithm, 2018-11-01), the logic was a huge rewrite of the
walk logic. In that massive change, we accidentally included the
UNINTERESTING commits in expand_topo_walk(). This means that a simple
query like

git rev-list --topo-order HEAD~1..HEAD

will expand the topo walk for all commits reachable from HEAD, and not
just one commit.

This change should speed up these cases, but there is still a need
for corrected commit-date for some A..B queries.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revision: use generation for A..B --topo-order queriesDerrick Stolee Tue, 21 May 2019 13:14:38 +0000 (09:14 -0400)

revision: use generation for A..B --topo-order queries

If a commit-graph exists with computed generation numbers, then a
'git rev-list --topo-order -n <N> <rev>' query will use those generation
numbers to reduce the number of commits walked before writing N commits.

One caveat put in b454241 (revision.c: generation-based topo-order
algorithm, 2018-11-01) was to not enable the new algorithm for queries
with a revision range "A..B". The logic was placed to walk from "A" and
mark those commits as uninteresting, but the performance was actually
worse than the existing logic in some cases.

The root cause of this performance degradation is that generation
numbers _increase_ the number of commits we walk relative to the
existing heuristic of walking by commit date. While generation numbers
actually guarantee that the algorithm is correct, the existing logic
is very rarely wrong and that added requirement is not worth the cost.

This motivates the planned "corrected commit date" to replace
generation numbers in a future version of Git.

The current change enables the logic to use whatever reachability
index is currently in the commit-graph (generation numbers or
corrected commit date).

The limited flag in struct rev_info forces a full walk of the
commit history (after discovering the A..B range). Previosuly, it
is enabled whenever we see an uninteresting commit. We prevent
enabling the parameter when we are planning to use the reachability
index for a topo-order.

Signed-off-by: Derrick Stolee <dstolee@microsoft.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>

clone: add `--remote-submodules` flagBen Avison Sun, 19 May 2019 14:26:49 +0000 (15:26 +0100)

clone: add `--remote-submodules` flag

When using `git clone --recurse-submodules` there was previously no way to
pass a `--remote` switch to the implicit `git submodule update` command for
any use case where you want the submodules to be checked out on their
remote-tracking branch rather than with the SHA-1 recorded in the superproject.

This patch rectifies this situation. It actually passes `--no-fetch` to
`git submodule update` as well on the grounds they the submodule has only just
been cloned, so fetching from the remote again only serves to slow things down.

Signed-off-by: Ben Avison <bavison@riscosopen.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

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

documentation: add anchors to MyFirstContributionEmily Shaffer Fri, 17 May 2019 19:07:04 +0000 (12:07 -0700)

documentation: add anchors to MyFirstContribution

During the course of review for MyFirstContribution.txt, the suggestion
came up to include anchors to make it easier for veteran contributors to
link specific sections of this documents to newbies. To make life easier
for reviewers, add these anchors in their own commit. See review context
here: https://public-inbox.org/git/20190507195938.GD220818@google.com/

AsciiDoc does not support :sectanchors: and the anchors are not
discoverable, but they are referenceable. So a link to
"foo.com/MyFirstContribution.html#prerequisites" will still work if that
file was generated with AsciiDoc. The inclusion of :sectanchors: does
not create warnings or errors while compiling directly with `asciidoc -b
html5 Documentation/MyFirstContribution.txt` or while compiling with
`make doc`.

AsciiDoctor does support :sectanchors: and displays a paragraph link on
mouseover. When the anchor is included above or inline with a section
(as in this change), the link provided points to the custom ID contained
within [[]] instead of to an autogenerated ID. Practically speaking,
this means we have .../MyFirstContribution.html#summary instead of
.../MyFirstContribution.html#_summary. In addition to being prettier,
the custom IDs also enable anchor linking to work with
asciidoc-generated pages. This change compiles with no warnings using
`asciidoctor -b html5 Documentation/MyFirstContribution.txt`.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

documentation: add tutorial for first contributionEmily Shaffer Fri, 17 May 2019 19:07:02 +0000 (12:07 -0700)

documentation: add tutorial for first contribution

This tutorial covers how to add a new command to Git and, in the
process, everything from cloning git/git to getting reviewed on the
mailing list. It's meant for new contributors to go through
interactively, learning the techniques generally used by the git/git
development community.

Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

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>

merge: add --quitNguyễn Thái Ngọc Duy Sat, 18 May 2019 11:30:43 +0000 (18:30 +0700)

merge: add --quit

This allows to cancel the current merge without resetting worktree/index,
which is what --abort is for. Like other --quit(s), this is often used
when you forgot that you're in the middle of a merge and already
switched away, doing different things. By the time you've realized, you
can't even continue the merge anymore.

This also makes all in-progress commands, am, merge, rebase, revert and
cherry-pick, take all three --abort, --continue and --quit (bisect has a
different UI).

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

userdiff: add OctaveBoxuan Li Sat, 18 May 2019 03:46:23 +0000 (11:46 +0800)

userdiff: add Octave

Octave pattern is almost the same as matlab, except
that '%%%' and '##' can also be used to begin code sections,
in addition to '%%' that is understood by both. Octave
pattern is merged into Matlab pattern. Test cases for
the hunk header patterns of matlab and octave under
t/t4018 are added.

Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
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>

rebase -r: always reword merge -cPhillip Wood Thu, 2 May 2019 10:22:49 +0000 (11:22 +0100)

rebase -r: always reword merge -c

If a merge can be fast-forwarded then make sure that we still edit the
commit message if the user specifies -c. The implementation follows the
same pattern that is used for ordinary rewords that are fast-forwarded.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: document --no-[to|cc|bcc]Ævar Arnfjörð Bjarmason Fri, 17 May 2019 19:55:43 +0000 (21:55 +0200)

send-email: document --no-[to|cc|bcc]

These options added in f434c083a0 ("send-email: add --no-cc, --no-to,
and --no-bcc", 2010-03-07) were never documented.

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

send-email: fix broken transferEncoding testsÆvar Arnfjörð Bjarmason Fri, 17 May 2019 19:55:42 +0000 (21:55 +0200)

send-email: fix broken transferEncoding tests

I fixed a bug that had broken the reading of sendmail.transferEncoding
in 3494dfd3ee ("send-email: do defaults -> config -> getopt in that
order", 2019-05-09), but the test I added in that commit did nothing
to assert the bug had been fixed.

That issue originates in 8d81408435 ("git-send-email: add
--transfer-encoding option", 2014-11-25) which first added the
"sendemail.transferencoding=8bit".

That test has never done anything meaningful. It tested that the
"--transfer-encoding=8bit" option would turn on the 8bit
Transfer-Encoding, but that was the default at the time (and now). As
checking out 8d81408435 and editing the test to remove that option
will reveal, supplying it never did anything.

So when I copied it thinking it would work in 3494dfd3ee I copied a
previously broken test, although I was making sure it did the right
thing via da-hoc debugger inspection, so the bug was fixed.

So fix the test I added in 3494dfd3ee, as well as the long-standing
test added in 8d81408435. To test if we're actually setting the
Transfer-Encoding let's set it to 7bit, not 8bit, as 7bit will error
out on "email-using-8bit".

This means that we can remove the "sendemail.transferencoding=7bit
fails on 8bit data" test, since it was redundant, we now have other
tests that assert that that'll fail.

While I'm at it convert "git config <key> <value>" in the test setup
to just "-c <key>=<value>" on the command-line. Then we don't need to
cleanup after these tests, and there's no sense in asserting where
config values come from in these tests, we can take that as a given.

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

send-email: remove cargo-culted multi-patch pattern... Ævar Arnfjörð Bjarmason Fri, 17 May 2019 19:55:41 +0000 (21:55 +0200)

send-email: remove cargo-culted multi-patch pattern in tests

Change test code added in f434c083a0 ("send-email: add --no-cc,
--no-to, and --no-bcc", 2010-03-07) which blindly copied a pattern
from an earlier test added in 32ae83194b ("add a test for
git-send-email for non-threaded mails", 2009-06-12) where the
"$patches" variable was supplied more than once.

As it turns out we didn't need more than one "$patches" for the test
added in 32ae83194b either. The only tests that actually needed this
sort of invocation were the tests added in 54aae5e1a0 ("t9001:
send-email interation with --in-reply-to and --chain-reply-to",
2010-10-19).

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

Makefile: remove the NO_R_TO_GCC_LINKER flagÆvar Arnfjörð Bjarmason Fri, 17 May 2019 21:58:47 +0000 (23:58 +0200)

Makefile: remove the NO_R_TO_GCC_LINKER flag

Change our default CC_LD_DYNPATH invocation to something GCC likes
these days. Since the GCC 4.6 release unknown flags haven't been
passed through to ld(1). Thus our previous default of CC_LD_DYNPATH=-R
would cause an error on modern GCC unless NO_R_TO_GCC_LINKER was set.

This CC_LD_DYNPATH flag is really obscure, and I don't expect anyone
except those working on git development ever use this.

It's not needed to simply link to libraries like say libpcre,
but *only* for those cases where we're linking to such a library not
present in the OS's library directories. See e.g. ldconfig(8) on Linux
for more details.

I use this to compile my git with a LIBPCREDIR=$HOME/g/pcre2/inst as
I'm building that from source, but someone maintaining an OS package
is almost certainly not going to use this. They're just going to set
USE_LIBPCRE=YesPlease after installing the libpcre dependency,
which'll point to OS libraries which ld(1) will find without the help
of CC_LD_DYNPATH.

Another thing that helps mitigate any potential breakage is that we
detect the right type of invocation in configure.ac, which e.g. HP/UX
uses[1], as does IBM's AIX package[2]. From what I can tell both AIX
and Solaris packagers are building git with GCC, so I'm not adding a
corresponding config.mak.uname default to cater to their OS-native
linkers.

Now for an overview of past development in this area:

Our use of "-R" dates back to 455a7f3275 ("More portability.",
2005-09-30). Soon after that in bbfc63dd78 ("gcc does not necessarily
pass runtime libpath with -R", 2006-12-27) the NO_R_TO_GCC flag was
added, allowing optional use of "-Wl,-rpath=".

Then in f5b904db6b ("Makefile: Allow CC_LD_DYNPATH to be overriden",
2008-08-16) the ability to override this flag to something else
entirely was added, as some linkers use neither "-Wl,-rpath," nor
"-R".

From what I can tell we should, with the benefit of hindsight, have
made this change back in 2006. GCC & ld supported this type of
invocation back then, or since at least binutils-gdb.git's[3]
a1ad915dc4 ("[...]Add support for -rpath[...]", 1994-07-20).

Further reading and prior art can be found at [4][5][6][7]. Making a
plain "-R" an error seems from reading those reports to have been
introduced in GCC 4.6 released on March 25, 2011[8], but I couldn't
confirm this with absolute certainty, its release notes are ambiguous
on the subject, and I couldn't be bothered to try to build & bisect it
against GCC 4.5.

1. https://public-inbox.org/git/20190516093412.14795-1-avarab@gmail.com/
2. https://www.ibm.com/developerworks/aix/library/aix-toolbox/alpha.html
3. git://sourceware.org/git/binutils-gdb.git
4. https://github.com/tsuna/boost.m4/issues/15
5. https://bugzilla.gnome.org/show_bug.cgi?id=641416
6. https://stackoverflow.com/questions/12629042/g-4-6-real-error-unrecognized-option-r
7. https://curl.haxx.se/mail/archive-2014-11/0005.html
8. https://gcc.gnu.org/gcc-4.6/changes.html

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

format-patch: teach format.notes config optionDenton Liu Thu, 16 May 2019 23:14:14 +0000 (19:14 -0400)

format-patch: teach format.notes config option

In git-format-patch, notes can be appended with the `--notes` option.
However, this must be specified by the user on an
invocation-by-invocation basis. If a user is not careful, it's possible
that they may forget to include it and generate a patch series without
notes.

Teach git-format-patch the `format.notes` config option. Its value is a
notes ref that will be automatically appended. The special value of
"standard" can be used to specify the standard notes. This option is
overridable with the `--no-notes` option in case a user wishes not to
append notes.

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

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>

Doc: git.txt: remove backticks from link and add git... Philip Oakley Wed, 15 May 2019 22:47:09 +0000 (23:47 +0100)

Doc: git.txt: remove backticks from link and add git-scm.com/docs

While checking the html formatted git(1) manual page, it was noted
that the link to https://git.github.io/htmldocs/git.html was formatted
as code. Remove the backticks.

While at it, add the https://git-scm.com/docs link which one reviewer
noted had linkable section headings.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git.c: show usage for accessing the git(1) help pagePhilip Oakley Wed, 15 May 2019 22:47:08 +0000 (23:47 +0100)

git.c: show usage for accessing the git(1) help page

It is not immediately obvious how to use the `git help` system to show
the git(1) page, with its overview and its background and coordinating
material, such as environment variables.

Let's simply list it as the last few words of the last usage line.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
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>

update-server-info: avoid needless overwritesEric Wong Mon, 13 May 2019 23:17:08 +0000 (23:17 +0000)

update-server-info: avoid needless overwrites

Do not change the existing info/refs and objects/info/packs
files if they match the existing content on the filesystem.
This is intended to preserve mtime and make it easier for dumb
HTTP pollers to rely on the If-Modified-Since header.

Combined with stdio and kernel buffering; the kernel should be
able to avoid block layer writes and reduce wear for small files.

As a result, the --force option is no longer needed. So stop
documenting it, but let it remain for compatibility (and
debugging, if necessary).

v3: perform incremental comparison while generating to avoid
OOM with giant files. Remove documentation for --force.

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

worktree add: sanitize worktree namesNguyễn Thái Ngọc Duy Fri, 8 Mar 2019 09:28:34 +0000 (16:28 +0700)

worktree add: sanitize worktree names

Worktree names are based on $(basename $GIT_WORK_TREE). They aren't
significant until 3a3b9d8cde (refs: new ref types to make per-worktree
refs visible to all worktrees - 2018-10-21), where worktree name could
be part of a refname and must follow refname rules.

Update 'worktree add' code to remove special characters to follow
these rules. In the future the user will be able to specify the
worktree name by themselves if they're not happy with this dumb
character substitution.

Reported-by: Konstantin Kharlamov <hi-angel@yandex.ru>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
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>

help_unknown_ref(): check for refname ambiguityJeff King Tue, 14 May 2019 12:05:05 +0000 (08:05 -0400)

help_unknown_ref(): check for refname ambiguity

When the user asks to merge "foo" and we suggest "origin/foo" instead,
we do so by simply chopping off "refs/remotes/" from the front of the
suggested ref. This is usually fine, but it's possible that the
resulting name is ambiguous (e.g., you have "refs/heads/origin/foo",
too).

Let's use shorten_unambiguous_ref() to do this the right way, which
should usually yield the same "origin/foo", but "remotes/origin/foo" if
necessary.

Note that in this situation there may be other options (e.g., we could
suggest "heads/origin/foo" as well). I'll leave that up for debate; the
focus here is just to avoid giving advice that does not actually do what
we expect.

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

help_unknown_ref(): duplicate collected refnamesJeff King Tue, 14 May 2019 12:04:31 +0000 (08:04 -0400)

help_unknown_ref(): duplicate collected refnames

When "git merge" sees an unknown refname, we iterate through the refs to
try to suggest some possible alternates. We do so with for_each_ref(),
and in the callback we add some of the refnames we get to a
string_list that is declared with NODUP, directly adding a pointer into
the refname string our callback received.

But the for_each_ref() machinery does not promise that the refname
string will remain valid, and as a result we may print garbage memory.

The code in question dates back to its inception in e56181060e (help:
add help_unknown_ref(), 2013-05-04). But back then, the refname strings
generally did remain stable, at least immediately after the
for_each_ref() call. Later, in d1cf15516f (packed_ref_iterator_begin():
iterate using `mmapped_ref_iterator`, 2017-09-25), we started
consistently re-using a separate buffer for packed refs.

The fix is simple: duplicate the strings we intend to collect. We
already call string_list_clear(), so the memory is correctly freed.

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

rebase: fold git-rebase--common into the -p backendJohannes Schindelin Tue, 14 May 2019 11:22:34 +0000 (04:22 -0700)

rebase: fold git-rebase--common into the -p backend

The only remaining scripted part of `git rebase` is the
`--preserve-merges` backend. Meaning: there is little reason to keep the
"library of common rebase functions" as a separate file.

While moving the functions to `git-rebase--preserve-merges.sh`, we also
drop the `move_to_original_branch` function that is no longer used.

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

sequencer: the `am` and `rebase--interactive` scripts... Johannes Schindelin Tue, 14 May 2019 11:22:33 +0000 (04:22 -0700)

sequencer: the `am` and `rebase--interactive` scripts are gone

Update a code comment that referred to those files as if they were still
there.

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

.gitignore: there is no longer a built-in `git-rebase... Johannes Schindelin Tue, 14 May 2019 11:22:32 +0000 (04:22 -0700)

.gitignore: there is no longer a built-in `git-rebase--interactive`

This went away in 0609b741a4 (rebase -i: combine rebase--interactive.c
with rebase.c, 2019-04-17).

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

t3400: stop referring to the scripted rebaseJohannes Schindelin Tue, 14 May 2019 11:22:31 +0000 (04:22 -0700)

t3400: stop referring to the scripted rebase

One test case's title mentioned the then-current implementation detail
that the `--am` backend was implemented in `git-rebase--am.sh`.

This is no longer the case, so let's update the title to reflect the
current reality.

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

Drop unused git-rebase--am.shJohannes Schindelin Tue, 14 May 2019 11:22:31 +0000 (04:22 -0700)

Drop unused git-rebase--am.sh

Since 21853626ea (built-in rebase: call `git am` directly, 2019-01-18),
the built-in rebase already uses the built-in `git am` directly.

Now that d03ebd411c (rebase: remove the rebase.useBuiltin setting,
2019-03-18) even removed the scripted rebase, there is no longer any
user of `git-rebase--am.sh`, so let's just remove it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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>

fast-export: do automatic reencoding of commit messages... Elijah Newren Tue, 14 May 2019 04:31:02 +0000 (21:31 -0700)

fast-export: do automatic reencoding of commit messages only if requested

Automatic re-encoding of commit messages (and dropping of the encoding
header) hurts attempts to do reversible history rewrites (e.g. sha1sum
<-> sha256sum transitions, some subtree rewrites), and seems
inconsistent with the general principle followed elsewhere in
fast-export of requiring explicit user requests to modify the output
(e.g. --signed-tags=strip, --tag-of-filtered-object=rewrite). Add a
--reencode flag that the user can use to specify, and like other
fast-export flags, default it to 'abort'.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-export: differentiate between explicitly UTF-8... Elijah Newren Tue, 14 May 2019 04:31:01 +0000 (21:31 -0700)

fast-export: differentiate between explicitly UTF-8 and implicitly UTF-8

The find_encoding() function returned the encoding used by a commit
message, returning a default of git_commit_encoding (usually UTF-8).
Although the current code does not differentiate between a commit which
explicitly requested UTF-8 and one where we just assume UTF-8 because no
encoding is set, it will become important when we try to preserve the
encoding header. Since is_encoding_utf8() returns true when passed
NULL, we can just return NULL from find_encoding() instead of returning
git_commit_encoding.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-export: avoid stripping encoding header if we... Elijah Newren Tue, 14 May 2019 04:31:00 +0000 (21:31 -0700)

fast-export: avoid stripping encoding header if we cannot reencode

When fast-export encounters a commit with an 'encoding' header, it tries
to reencode in UTF-8 and then drops the encoding header. However, if it
fails to reencode in UTF-8 because e.g. one of the characters in the
commit message was invalid in the old encoding, then we need to retain
the original encoding or otherwise we lose information needed to
understand all the other (valid) characters in the original commit
message.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: support 'encoding' commit headerElijah Newren Tue, 14 May 2019 04:30:59 +0000 (21:30 -0700)

fast-import: support 'encoding' commit header

Since git supports commit messages with an encoding other than UTF-8,
allow fast-import to import such commits. This may be useful for folks
who do not want to reencode commit messages from an external system, and
may also be useful to achieve reversible history rewrites (e.g. sha1sum
<-> sha256sum transitions or subtree work) with git repositories that
have used specialized encodings in their commit history.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9350: fix encoding test to actually test reencodingElijah Newren Tue, 14 May 2019 04:30:58 +0000 (21:30 -0700)

t9350: fix encoding test to actually test reencoding

This test used an author with non-ascii characters in the name, but no
special commit message. It then grep'ed for those non-ascii characters,
but those are guaranteed to exist regardless of the reencoding process
since the reencoding only affects the commit message, not the author or
committer names. As such, the test would work even if the re-encoding
process simply stripped the commit message entirely. Modify the test to
actually check that the reencoding into UTF-8 worked.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: add a special setup where prerequisites failÆvar Arnfjörð Bjarmason Mon, 13 May 2019 18:32:42 +0000 (20:32 +0200)

tests: add a special setup where prerequisites fail

As discussed in [1] there's a regression in the "pu" branch now
because a new test implicitly assumed that a previous test guarded by
a prerequisite had been run. Add a "GIT_TEST_FAIL_PREREQS" special
test setup where we'll skip (nearly) all tests guarded by
prerequisites, allowing us to easily emulate those platform where we
don't run these tests.

As noted in the documentation I'm adding I'm whitelisting the SYMLINKS
prerequisite for now. A lot of tests started failing if we lied about
not supporting symlinks. It's also unlikely that we'll have a failing
test due to a hard dependency on symlinks without that being the
obvious cause, so for now it's not worth the effort to make it work.

1. https://public-inbox.org/git/nycvar.QRO.7.76.6.1905131531000.44@tvgsbejvaqbjf.bet/

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