gitweb.git
Merge branch 'bc/doc-interpret-trailers-grammofix'... Junio C Hamano Thu, 22 Mar 2018 21:24:21 +0000 (14:24 -0700)

Merge branch 'bc/doc-interpret-trailers-grammofix' into maint

Docfix.

* bc/doc-interpret-trailers-grammofix:
docs/interpret-trailers: fix agreement error

Merge branch 'sg/doc-test-must-fail-args' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:19 +0000 (14:24 -0700)

Merge branch 'sg/doc-test-must-fail-args' into maint

Devdoc update.

* sg/doc-test-must-fail-args:
t: document 'test_must_fail ok=<signal-name>'

Merge branch 'rj/sparse-updates' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:19 +0000 (14:24 -0700)

Merge branch 'rj/sparse-updates' into maint

Devtool update.

* rj/sparse-updates:
Makefile: suppress a sparse warning for pack-revindex.c
config.mak.uname: remove SPARSE_FLAGS setting for cygwin

Merge branch 'jk/gettext-poison' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:18 +0000 (14:24 -0700)

Merge branch 'jk/gettext-poison' into maint

Test updates.

* jk/gettext-poison:
git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEME
t0205: drop redundant test

Merge branch 'nd/ignore-glob-doc-update' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:18 +0000 (14:24 -0700)

Merge branch 'nd/ignore-glob-doc-update' into maint

Doc update.

* nd/ignore-glob-doc-update:
gitignore.txt: elaborate shell glob syntax

Merge branch 'rs/cocci-strbuf-addf-to-addstr' into... Junio C Hamano Thu, 22 Mar 2018 21:24:17 +0000 (14:24 -0700)

Merge branch 'rs/cocci-strbuf-addf-to-addstr' into maint

* rs/cocci-strbuf-addf-to-addstr:
cocci: simplify check for trivial format strings

Merge branch 'jc/worktree-add-short-help' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:17 +0000 (14:24 -0700)

Merge branch 'jc/worktree-add-short-help' into maint

Error message fix.

* jc/worktree-add-short-help:
worktree: say that "add" takes an arbitrary commit in short-help

Merge branch 'tz/doc-show-defaults-to-head' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:17 +0000 (14:24 -0700)

Merge branch 'tz/doc-show-defaults-to-head' into maint

Doc update.

* tz/doc-show-defaults-to-head:
doc: mention 'git show' defaults to HEAD

Merge branch 'nd/shared-index-fix' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:16 +0000 (14:24 -0700)

Merge branch 'nd/shared-index-fix' into maint

Code clean-up.

* nd/shared-index-fix:
read-cache: don't write index twice if we can't write shared index
read-cache.c: move tempfile creation/cleanup out of write_shared_index
read-cache.c: change type of "temp" in write_shared_index()

Merge branch 'jc/mailinfo-cleanup-fix' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:16 +0000 (14:24 -0700)

Merge branch 'jc/mailinfo-cleanup-fix' into maint

Corner case bugfix.

* jc/mailinfo-cleanup-fix:
mailinfo: avoid segfault when can't open files

Merge branch 'rb/hashmap-h-compilation-fix' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:15 +0000 (14:24 -0700)

Merge branch 'rb/hashmap-h-compilation-fix' into maint

Code clean-up.

* rb/hashmap-h-compilation-fix:
hashmap.h: remove unused variable

Merge branch 'rs/describe-unique-abbrev' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:14 +0000 (14:24 -0700)

Merge branch 'rs/describe-unique-abbrev' into maint

Code clean-up.

* rs/describe-unique-abbrev:
describe: use strbuf_add_unique_abbrev() for adding short hashes

Merge branch 'ks/submodule-doc-updates' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:13 +0000 (14:24 -0700)

Merge branch 'ks/submodule-doc-updates' into maint

Doc updates.

* ks/submodule-doc-updates:
Doc/git-submodule: improve readability and grammar of a sentence
Doc/gitsubmodules: make some changes to improve readability and syntax

Merge branch 'cl/t9001-cleanup' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:13 +0000 (14:24 -0700)

Merge branch 'cl/t9001-cleanup' into maint

Test clean-up.

* cl/t9001-cleanup:
t9001: use existing helper in send-email test

Merge branch 'bw/oidmap-autoinit' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:12 +0000 (14:24 -0700)

Merge branch 'bw/oidmap-autoinit' into maint

Code clean-up.

* bw/oidmap-autoinit:
oidmap: ensure map is initialized

Merge branch 'sg/test-i18ngrep' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:12 +0000 (14:24 -0700)

Merge branch 'sg/test-i18ngrep' into maint

Test fixes.

* sg/test-i18ngrep:
t: make 'test_i18ngrep' more informative on failure
t: validate 'test_i18ngrep's parameters
t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'
t5536: let 'test_i18ngrep' read the file without redirection
t5510: consolidate 'grep' and 'test_i18ngrep' patterns
t4001: don't run 'git status' upstream of a pipe
t6022: don't run 'git merge' upstream of a pipe
t5812: add 'test_i18ngrep's missing filename parameter
t5541: add 'test_i18ngrep's missing filename parameter

Merge branch 'jt/fsck-code-cleanup' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:12 +0000 (14:24 -0700)

Merge branch 'jt/fsck-code-cleanup' into maint

Plug recently introduced leaks in fsck.

* jt/fsck-code-cleanup:
fsck: fix leak when traversing trees

Merge branch 'ew/svn-branch-segfault-fix' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:11 +0000 (14:24 -0700)

Merge branch 'ew/svn-branch-segfault-fix' into maint

Workaround for segfault with more recent versions of SVN.

* ew/svn-branch-segfault-fix:
git-svn: control destruction order to avoid segfault

Merge branch 'nd/list-merge-strategy' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:11 +0000 (14:24 -0700)

Merge branch 'nd/list-merge-strategy' into maint

Completion of "git merge -s<strategy>" (in contrib/) did not work
well in non-C locale.

* nd/list-merge-strategy:
completion: fix completing merge strategies on non-C locales

Merge branch 'jk/daemon-fixes' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:10 +0000 (14:24 -0700)

Merge branch 'jk/daemon-fixes' into maint

Assorted fixes to "git daemon".

* jk/daemon-fixes:
daemon: fix length computation in newline stripping
t/lib-git-daemon: add network-protocol helpers
daemon: handle NULs in extended attribute string
daemon: fix off-by-one in logging extended attributes
t/lib-git-daemon: record daemon log
t5570: use ls-remote instead of clone for interp tests

Merge branch 'tg/split-index-fixes' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:10 +0000 (14:24 -0700)

Merge branch 'tg/split-index-fixes' into maint

The split-index mode had a few corner case bugs fixed.

* tg/split-index-fixes:
travis: run tests with GIT_TEST_SPLIT_INDEX
split-index: don't write cache tree with null oid entries
read-cache: fix reading the shared index for other repos

Merge branch 'mr/packed-ref-store-fix' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:10 +0000 (14:24 -0700)

Merge branch 'mr/packed-ref-store-fix' into maint

Crash fix for a corner case where an error codepath tried to unlock
what it did not acquire lock on.

* mr/packed-ref-store-fix:
files_initial_transaction_commit(): only unlock if locked

Merge branch 'jt/http-redact-cookies' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:09 +0000 (14:24 -0700)

Merge branch 'jt/http-redact-cookies' into maint

The http tracing code, often used to debug connection issues,
learned to redact potentially sensitive information from its output
so that it can be more safely sharable.

* jt/http-redact-cookies:
http: support omitting data from traces
http: support cookie redaction when tracing

Merge branch 'nd/diff-flush-before-warning' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:09 +0000 (14:24 -0700)

Merge branch 'nd/diff-flush-before-warning' into maint

Avoid showing a warning message in the middle of a line of "git
diff" output.

* nd/diff-flush-before-warning:
diff.c: flush stdout before printing rename warnings

Merge branch 'sg/travis-build-during-script-phase'... Junio C Hamano Thu, 22 Mar 2018 21:24:08 +0000 (14:24 -0700)

Merge branch 'sg/travis-build-during-script-phase' into maint

Build the executable in 'script' phase in Travis CI integration, to
follow the established practice, rather than during 'before_script'
phase. This allows the CI categorize the failures better ('failed'
is project's fault, 'errored' is build environment's).

* sg/travis-build-during-script-phase:
travis-ci: build Git during the 'script' phase

Merge branch 'ys/bisect-object-id-missing-conversion... Junio C Hamano Tue, 27 Feb 2018 18:43:55 +0000 (10:43 -0800)

Merge branch 'ys/bisect-object-id-missing-conversion-fix' into maint

Fix for a commented-out code to adjust it to a rather old API change.

* ys/bisect-object-id-missing-conversion-fix:
bisect: debug: convert struct object to object_id

Merge branch 'sb/submodule-update-reset-fix' into maintJunio C Hamano Tue, 27 Feb 2018 18:43:54 +0000 (10:43 -0800)

Merge branch 'sb/submodule-update-reset-fix' into maint

When resetting the working tree files recursively, the working tree
of submodules are now also reset to match.

* sb/submodule-update-reset-fix:
submodule: submodule_move_head omits old argument in forced case
unpack-trees: oneway_merge to update submodules
t/lib-submodule-update.sh: fix test ignoring ignored files in submodules
t/lib-submodule-update.sh: clarify test

Merge branch 'ab/commit-m-with-fixup' into maintJunio C Hamano Tue, 27 Feb 2018 18:43:54 +0000 (10:43 -0800)

Merge branch 'ab/commit-m-with-fixup' into maint

"git commit --fixup" did not allow "-m<message>" option to be used
at the same time; allow it to annotate resulting commit with more
text.

* ab/commit-m-with-fixup:
commit: add support for --fixup <commit> -m"<extra message>"
commit doc: document that -c, -C, -F and --fixup with -m error

Merge branch 'nd/ita-wt-renames-in-status' into maintJunio C Hamano Tue, 27 Feb 2018 18:39:34 +0000 (10:39 -0800)

Merge branch 'nd/ita-wt-renames-in-status' into maint

"git status" after moving a path in the working tree (hence making
it appear "removed") and then adding with the -N option (hence
making that appear "added") detected it as a rename, but did not
report the old and new pathnames correctly.

* nd/ita-wt-renames-in-status:
wt-status.c: handle worktree renames
wt-status.c: rename rename-related fields in wt_status_change_data
wt-status.c: catch unhandled diff status codes
wt-status.c: coding style fix
Use DIFF_DETECT_RENAME for detect_rename assignments
t2203: test status output with porcelain v2 format

Git 2.16.2 v2.16.2Junio C Hamano Thu, 15 Feb 2018 23:21:23 +0000 (15:21 -0800)

Git 2.16.2

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

Merge branch 'ab/doc-cat-file-e-still-shows-errors... Junio C Hamano Thu, 15 Feb 2018 23:18:15 +0000 (15:18 -0800)

Merge branch 'ab/doc-cat-file-e-still-shows-errors' into maint

Doc update.

* ab/doc-cat-file-e-still-shows-errors:
cat-file doc: document that -e will return some output

Merge branch 'as/read-tree-prefix-doc-fix' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:14 +0000 (15:18 -0800)

Merge branch 'as/read-tree-prefix-doc-fix' into maint

Doc update.

* as/read-tree-prefix-doc-fix:
doc/read-tree: remove obsolete remark

Merge branch 'nd/add-i-ignore-submodules' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:13 +0000 (15:18 -0800)

Merge branch 'nd/add-i-ignore-submodules' into maint

"git add -p" was taught to ignore local changes to submodules as
they do not interfere with the partial addition of regular changes
anyway.

* nd/add-i-ignore-submodules:
add--interactive: ignore submodule changes except HEAD

Merge branch 'tg/stash-with-pathspec-fix' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:13 +0000 (15:18 -0800)

Merge branch 'tg/stash-with-pathspec-fix' into maint

"git stash -- <pathspec>" incorrectly blew away untracked files in
the directory that matched the pathspec, which has been corrected.

* tg/stash-with-pathspec-fix:
stash: don't delete untracked files that match pathspec

Merge branch 'jk/abort-clone-with-existing-dest' into... Junio C Hamano Thu, 15 Feb 2018 23:18:12 +0000 (15:18 -0800)

Merge branch 'jk/abort-clone-with-existing-dest' into maint

"git clone $there $here" is allowed even when here directory exists
as long as it is an empty directory, but the command incorrectly
removed it upon a failure of the operation.

* jk/abort-clone-with-existing-dest:
clone: do not clean up directories we didn't create
clone: factor out dir_exists() helper
t5600: modernize style
t5600: fix outdated comment about unborn HEAD

Merge branch 'jc/merge-symlink-ours-theirs' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:12 +0000 (15:18 -0800)

Merge branch 'jc/merge-symlink-ours-theirs' into maint

"git merge -Xours/-Xtheirs" learned to use our/their version when
resolving a conflicting updates to a symbolic link.

* jc/merge-symlink-ours-theirs:
merge: teach -Xours/-Xtheirs to symbolic link merge

Merge branch 'rs/lose-leak-pending' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:11 +0000 (15:18 -0800)

Merge branch 'rs/lose-leak-pending' into maint

API clean-up around revision traversal.

* rs/lose-leak-pending:
commit: remove unused function clear_commit_marks_for_object_array()
revision: remove the unused flag leak_pending
checkout: avoid using the rev_info flag leak_pending
bundle: avoid using the rev_info flag leak_pending
bisect: avoid using the rev_info flag leak_pending
object: add clear_commit_marks_all()
ref-filter: use clear_commit_marks_many() in do_merge_filter()
commit: use clear_commit_marks_many() in remove_redundant()
commit: avoid allocation in clear_commit_marks_many()

Merge branch 'jm/svn-pushmergeinfo-fix' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:11 +0000 (15:18 -0800)

Merge branch 'jm/svn-pushmergeinfo-fix' into maint

"git svn dcommit" did not take into account the fact that a
svn+ssh:// URL with a username@ (typically used for pushing) refers
to the same SVN repository without the username@ and failed when
svn.pushmergeinfo option is set.

* jm/svn-pushmergeinfo-fix:
git-svn: fix svn.pushmergeinfo handling of svn+ssh usernames.

Merge branch 'dk/describe-all-output-fix' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:10 +0000 (15:18 -0800)

Merge branch 'dk/describe-all-output-fix' into maint

An old regression in "git describe --all $annotated_tag^0" has been
fixed.

* dk/describe-all-output-fix:
describe: prepend "tags/" when describing tags with embedded name

Merge branch 'ab/perf-grep-threads' into maintJunio C Hamano Thu, 15 Feb 2018 23:18:09 +0000 (15:18 -0800)

Merge branch 'ab/perf-grep-threads' into maint

More perf tests for threaded grep

* ab/perf-grep-threads:
perf: amend the grep tests to test grep.threads

docs/interpret-trailers: fix agreement errorbrian m. carlson Tue, 13 Feb 2018 02:23:52 +0000 (02:23 +0000)

docs/interpret-trailers: fix agreement error

In the description of git interpret-trailers, we describe "a group…of
lines" that have certain characteristics. Ensure both options
describing this group use a singular verb for parallelism.

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

Makefile: suppress a sparse warning for pack-revindex.cRamsay Jones Mon, 12 Feb 2018 00:21:02 +0000 (00:21 +0000)

Makefile: suppress a sparse warning for pack-revindex.c

Sparse has, for a long time, been issuing the following warning against
the pack-revindex.c file:

SP pack-revindex.c
pack-revindex.c:64:23: warning: memset with byte count of 262144

This results from a unconditional check, with a hard-coded limit, which
is really only appropriate for the kernel source code. (The check is for
a 'large' byte count in a call to memcpy(), memset(), copy_from_user()
and copy_to_user() functions).

A recent release of sparse (v0.5.1) has introduced some options to allow
this check to be turned off (-Wno-memcpy-max-count) or to specify the
actual limit used (-fmemcpy-max-count=COUNT), rather than a hard-coded
limit of 100000.

In order to suppress the warning, add a target for pack-revindex.sp that
adds the '-Wno-memcpy-max-count' option to the SPARSE_FLAGS variable.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config.mak.uname: remove SPARSE_FLAGS setting for cygwinRamsay Jones Mon, 12 Feb 2018 00:20:08 +0000 (00:20 +0000)

config.mak.uname: remove SPARSE_FLAGS setting for cygwin

Since commit f66450ae9 ("cygwin: Remove the Win32 l/stat() implementation",
2013-06-22), the cygwin build has not used the WIN32 API/header files.
This means that the '-isystem /usr/include/w32api' option to sparse is
no longer necessary (to allow sparse to find the WIN32 header files).
In addition, the '-Wno-one-bit-signed-bitfield' option can be removed,
since the warning suppressed by that option was only provoked by a WIN32
header file.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: document 'test_must_fail ok=<signal-name>'SZEDER Gábor Fri, 9 Feb 2018 02:42:33 +0000 (03:42 +0100)

t: document 'test_must_fail ok=<signal-name>'

Since 'test_might_fail' is implemented as a thin wrapper around
'test_must_fail', it also accepts the same options. Mention this in
the docs as well.

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

t: make 'test_i18ngrep' more informative on failureSZEDER Gábor Thu, 8 Feb 2018 15:56:56 +0000 (16:56 +0100)

t: make 'test_i18ngrep' more informative on failure

When 'test_i18ngrep' can't find the expected pattern, it exits
completely silently; when its negated form does find the pattern that
shouldn't be there, it prints the matching line(s) but otherwise exits
without any error message. This leaves the developer puzzled about
what could have gone wrong.

Make 'test_i18ngrep' more informative on failure by printing an error
message including the invoked 'grep' command and the contents of the
file it had to scan through.

Note that this "dump the scanned file" part is not quite perfect, as
it dumps only the file specified as the function's last positional
parameter, thus assuming that there is only a single file parameter.
I think that's a reasonable assumption to make, one that holds true in
the current code base. And even if someone were to scan multiple
files at once in the future, the worst thing that could happen is that
the verbose error message won't include the contents of all those
files, only the last one. Alas, we can't really do any better than
this, because checking whether the other positional parameters match a
filename can result in false positives: 't3400-rebase.sh' and
't3404-rebase-interactive.sh' contain one test each, where the
'test_i18ngrep's pattern verbatimly matches a file in the trash
directory.

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

t: validate 'test_i18ngrep's parametersSZEDER Gábor Thu, 8 Feb 2018 15:56:55 +0000 (16:56 +0100)

t: validate 'test_i18ngrep's parameters

Some of the previous patches in this series fixed bogus
'test_i18ngrep' invocations:

- Two invocations where the tested git command's standard output is
directly piped into 'test_i18ngrep'. While convenient, this is an
antipattern, because the pipe hides the git command's exit code,
and the test could continue even if the command exited with error.

- Two invocations that had neither a filename parameter nor anything
piped into their standard input, yet both managed to remain
unnoticed for years. A third similarly bogus invocation is
currently lurking in 'pu' for a couple of weeks now.

Prevent similar mistakes in the future by validating 'test_i18ngrep's
parameters requiring that

- The last parameter names an existing file to be read, effectively
forbidding piping into 'test_i18ngrep'.

Note that this change will also forbid cases where 'test_i18ngrep'
would legitimately read its standard input, e.g. when its standard
input is redirected from a file, or when a git command's standard
output is first written to an intermediate file, which is then
preprocessed by a non-git command before the results are piped
into 'test_i18ngrep'. See two of the previous patches for the
only such cases we had in our test suite. However, reliably
preventing the piping antipattern is arguably more important than
supporting these cases, which can be easily worked around by
opening the file directly or using an intermediate file anyway.

- There are at least two parameters, not including the optional '!'
to negate the pattern. This ought to catch corner cases when
'test_i18ngrep' looks for the name of an existing file on its
standard input; the above check would miss this case becase the
filename as pattern would be the last parameter.

Note that this is not quite perfect, as it doesn't account for any
'grep --options' given as parameters. However, doing so would be
far too complicated, considering that patterns can start with
dashes as well, and in the majority of the cases we don't use any
such options anyway.

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

t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test... SZEDER Gábor Thu, 8 Feb 2018 15:56:54 +0000 (16:56 +0100)

t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'

Both 'test_i18ncmp' and 'test_i18ngrep' helper functions are supposed
to be called from our test scripts, so they should be in
'test-lib-functions.sh'.

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

t5536: let 'test_i18ngrep' read the file without redire... SZEDER Gábor Thu, 8 Feb 2018 15:56:53 +0000 (16:56 +0100)

t5536: let 'test_i18ngrep' read the file without redirection

Redirecting 'test_i18ngrep's standard input from a file will interfere
with the linting that will be added in a later patch.

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

t5510: consolidate 'grep' and 'test_i18ngrep' patternsSZEDER Gábor Thu, 8 Feb 2018 15:56:52 +0000 (16:56 +0100)

t5510: consolidate 'grep' and 'test_i18ngrep' patterns

One of the tests in 't5510-fetch.sh' checks the output of 'git fetch'
using 'test_i18ngrep', and while doing so it prefilters the output
with 'grep' before piping the result into 'test_i18ngrep'.

This prefiltering is unnecessary, with the appropriate pattern
'test_i18ngrep' can do it all by itself. Furthermore, piping data
into 'test_i18ngrep' will interfere with the linting that will be
added in a later patch.

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

t4001: don't run 'git status' upstream of a pipeSZEDER Gábor Thu, 8 Feb 2018 15:56:51 +0000 (16:56 +0100)

t4001: don't run 'git status' upstream of a pipe

The primary purpose of three tests in 't4001-diff-rename.sh' is to
check rename detection in 'git status', but all three do so by running
'git status' upstream of a pipe, hiding its exit code. Consequently,
the test could continue even if 'git status' exited with error.

Use an intermediate file between 'git status' and 'test_i18ngrep' to
catch a potential failure of the former.

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

t6022: don't run 'git merge' upstream of a pipeSZEDER Gábor Thu, 8 Feb 2018 15:56:50 +0000 (16:56 +0100)

t6022: don't run 'git merge' upstream of a pipe

The primary purpose of 't6022-merge-rename.sh' is to test 'git merge',
but one of the tests runs it upstream of a pipe, hiding its exit code.
Consequently, the test could continue even if 'git merge' exited with
error.

Use an intermediate file between 'git merge' and 'test_i18ngrep' to
catch a potential failure of the former.

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

t5812: add 'test_i18ngrep's missing filename parameterSZEDER Gábor Thu, 8 Feb 2018 15:56:49 +0000 (16:56 +0100)

t5812: add 'test_i18ngrep's missing filename parameter

The second 'test_i18ngrep' invocation in the test 'curl redirects
respect whitelist' is missing its filename parameter. This has
remained unnoticed since its introduction in f4113cac0 (http: limit
redirection to protocol-whitelist, 2015-09-22), because it would only
cause the test to fail if Git was built with a sufficiently old
libcurl version. The test's two ||-chained 'test_i18ngrep'
invocations are supposed to check that either one of the two patterns
is present in 'git clone's error message. As it happens, the first
invocation covers the error message from any reasonably up-to-date
libcurl, thus the second invocation, the one without the filename
parameter, isn't executed at all. Apparently no one has run the test
suite's httpd tests with such an old libcurl in the last 2+ years, or
at least they haven't bothered to notify us about the failed test.

Fix this by consolidating the two patterns into a single extended
regexp, eliminating the need for an ||-chained second 'test_i18ngrep'
invocation.

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

t5541: add 'test_i18ngrep's missing filename parameterSZEDER Gábor Thu, 8 Feb 2018 15:56:48 +0000 (16:56 +0100)

t5541: add 'test_i18ngrep's missing filename parameter

The test 'push --no-progress silences progress but not status' runs
'test_i18ngrep' without specifying a filename parameter. This has
remained unnoticed since its introduction in e304aeba2 (t5541: test
more combinations of --progress, 2012-05-01), because that
'test_i18ngrep' is supposed to check that the given pattern is not
present in its input, and of course it won't find that pattern if its
input is empty (as it comes from /dev/null). This also means that
this test could miss a potential breakage of 'git push --no-progress'.

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

git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEMEJeff King Tue, 6 Feb 2018 08:44:56 +0000 (03:44 -0500)

git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEME

Running "make NO_GETTEXT=1 GETTEXT_POISON=1" currently fails
t0205.

While it might seem nonsensical at first glance to both
poison and disable gettext, it's useful to be able to do a
poison test-run on a system that doesn't have gettext at
all. And it works fine for C programs; the problem is only
with the shell code.

The issue is that we check the baked-in USE_GETTEXT_SCHEME
value before GETTEXT_POISON. And when NO_GETTEXT is set, the
Makefile sets USE_GETTEXT_SCHEME to "fallthrough".

So one fix would be to have the Makefile just set
USE_GETTEXT_SCHEME to "poison" if GETTEXT_POISON is set.
But there are two problems with that:

1. USE_GETTEXT_SCHEME is actually a user-facing knob, so
conceivably somebody could override it with:

make USE_GETTEXT_SCHEME=gnu GETTEXT_POISON=1

which would do the wrong thing (though that's much less
likely than them having the variable set in their
config.mak and just overriding GETTEXT_POISON on the
command-line for a one-off test).

2. We don't actually bake GETTEXT_POISON in to the shell
library like we do for the C code. It checks
$GIT_GETTEXT_POISON at runtime, which is set up by the
test suite. So it makes sense to put the fix in the
runtime code, too, which would cover something like:

GIT_GETTEXT_POISON=foo git foo

It's not likely that people use the poison code outside
of running the test suite, but it's easy enough to make
this case work.

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

t0205: drop redundant testJeff King Tue, 6 Feb 2018 08:43:19 +0000 (03:43 -0500)

t0205: drop redundant test

We check that a shell variable is non-empty, and then we
check that it's equal to a particular value. Just checking
the latter covers both cases.

I suspect the original was trying to give better output when
the test fails, but using "-x" covers that these days.

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

cocci: simplify check for trivial format stringsRené Scharfe Thu, 1 Feb 2018 18:56:34 +0000 (19:56 +0100)

cocci: simplify check for trivial format strings

353d84c537 (coccicheck: make transformation for strbuf_addf(sb, "...")
more precise) added a check to avoid transforming calls with format
strings which contain percent signs, as that would change the result.
It uses embedded Python code for that. Simplify this rule by using the
regular expression matching operator instead.

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

gitignore.txt: elaborate shell glob syntaxDuy Nguyen Thu, 1 Feb 2018 09:59:15 +0000 (16:59 +0700)

gitignore.txt: elaborate shell glob syntax

`fnmatch(3)` is a great mention if the intended audience is
programmers. For normal users it's probably better to spell out what
a shell glob is.

This paragraph is updated to roughly tell (or remind) what the main
wildcards are supposed to do. All the details are still hidden away
behind the `fnmatch(3)` wall because bringing the whole specification
here may be too much.

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

git-svn: control destruction order to avoid segfaultEric Wong Mon, 29 Jan 2018 23:11:07 +0000 (23:11 +0000)

git-svn: control destruction order to avoid segfault

It seems necessary to control destruction ordering to avoid a
segfault with SVN 1.9.5 when using "git svn branch". I've also
reported the problem against libsvn-perl to Debian [Bug #888791],
but releasing the SVN::Client instance can be beneficial anyways to
save memory.

ref: https://bugs.debian.org/888791
Tested-by: Todd Zullinger <tmz@pobox.com>
Reported-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: mention 'git show' defaults to HEADTodd Zullinger Sun, 28 Jan 2018 19:16:07 +0000 (14:16 -0500)

doc: mention 'git show' defaults to HEAD

When 'git show' is called without any object it defaults to HEAD. This
has been true since d4ed9793fd ("Simplify common default options setup
for built-in log family.", 2006-04-16).

The SYNOPSIS suggests that the object argument is required. Clarify
that it is not required and note the default.

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

completion: fix completing merge strategies on non... Duy Nguyen Fri, 26 Jan 2018 01:31:42 +0000 (08:31 +0700)

completion: fix completing merge strategies on non-C locales

The anchor string "Available strategies are:" is translatable so
__git_list_merge_strategies may fail to collect available strategies
from 'git merge' on non-C locales. Force C locale on this command.

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

daemon: fix length computation in newline strippingJeff King Thu, 25 Jan 2018 00:58:54 +0000 (19:58 -0500)

daemon: fix length computation in newline stripping

When git-daemon gets a pktline request, we strip off any
trailing newline, replacing it with a NUL. Clients prior to
5ad312bede (in git v1.4.0) would send:

git-upload-pack repo.git\n

and we need to strip it off to understand their request.
After 5ad312bede, we send the host attribute but no newline,
like:

git-upload-pack repo.git\0host=example.com\0

Both of these are parsed correctly by git-daemon. But if
some client were to combine the two:

git-upload-pack repo.git\n\0host=example.com\0

we don't parse it correctly. The problem is that we use the
"len" variable to record the position of the NUL separator,
but then decrement it when we strip the newline. So we start
with:

git-upload-pack repo.git\n\0host=example.com\0
^-- len

and end up with:

git-upload-pack repo.git\0\0host=example.com\0
^-- len

This is arguably correct, since "len" tells us the length of
the initial string, but we don't actually use it for that.
What we do use it for is finding the offset of the extended
attributes; they used to be at len+1, but are now at len+2.

We can solve that by just leaving "len" where it is. We
don't have to care about the length of the shortened string,
since we just treat it like a C string.

No version of Git ever produced such a string, but it seems
like the daemon code meant to handle this case (and it seems
like a reasonable thing for somebody to do in a 3rd-party
implementation).

Reported-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/lib-git-daemon: add network-protocol helpersJeff King Thu, 25 Jan 2018 00:58:19 +0000 (19:58 -0500)

t/lib-git-daemon: add network-protocol helpers

All of our git-protocol tests rely on invoking the client
and having it make a request of a server. That gives a nice
real-world test of how the two behave together, but it
doesn't leave any room for testing how a server might react
to _other_ clients.

Let's add a few test helper functions which can be used to
manually conduct a git-protocol conversation with a remote
git-daemon:

1. To connect to a remote git-daemon, we need something
like "netcat". But not everybody will have netcat. And
even if they do, the behavior with respect to
half-duplex shutdowns is not portable (openbsd netcat
has "-N", with others you must rely on "-q 1", which is
racy).

Here we provide a "fake_nc" that is capable of doing
a client-side netcat, with sane half-duplex semantics.
It relies on perl's IO::Socket::INET. That's been in
the base distribution since 5.6.0, so it's probably
available everywhere. But just to be on the safe side,
we'll add a prereq.

2. To help tests speak and read pktline, this patch adds
packetize() and depacketize() functions.

I've put fake_nc() into lib-git-daemon.sh, since that's
really the only server where we'd need to use a network
socket. Whereas the pktline helpers may be of more general
use, so I've added them to test-lib-functions.sh. Programs
like upload-pack speak pktline, but can talk directly over
stdio without a network socket.

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

daemon: handle NULs in extended attribute stringJeff King Thu, 25 Jan 2018 00:56:20 +0000 (19:56 -0500)

daemon: handle NULs in extended attribute string

If we receive a request with extended attributes after the
NUL, we try to write those attributes to the log. We do so
with a "%s" format specifier, which will only show
characters up to the first NUL.

That's enough for printing a "host=" specifier. But since
dfe422d04d (daemon: recognize hidden request arguments,
2017-10-16) we may have another NUL, followed by protocol
parameters, and those are not logged at all.

Let's cut out the attempt to show the whole string, and
instead log when we parse individual attributes. We could
leave the "extended attributes (%d bytes) exist" part of the
log, which in theory could alert us to attributes that fail
to parse. But anything we don't parse as a "host=" parameter
gets blindly added to the "protocol" attribute, so we'd see
it in that part of the log.

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

daemon: fix off-by-one in logging extended attributesJeff King Thu, 25 Jan 2018 00:56:07 +0000 (19:56 -0500)

daemon: fix off-by-one in logging extended attributes

If receive a request like:

git-upload-pack /foo.git\0host=localhost

we mark the offset of the NUL byte as "len", and then log
the bytes after the NUL with a "%.*s" placeholder, using
"pktlen - len" as the length, and "line + len + 1" as the
start of the string.

This is off-by-one, since the start of the string skips past
the separating NUL byte, but the adjusted length includes
it. Fortunately this doesn't actually read past the end of
the buffer, since "%.*s" will stop when it hits a NUL. And
regardless of what is in the buffer, packet_read() will
always add an extra NUL terminator for safety.

As an aside, the git.git client sends an extra NUL after a
"host" field, too, so we'd generally hit that one first, not
the one added by packet_read(). You can see this in the test
output which reports 15 bytes, even though the string has
only 14 bytes of visible data. But the point is that even a
client sending unusual data could not get us to read past
the end of the buffer, so this is purely a cosmetic fix.

Reported-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/lib-git-daemon: record daemon logJeff King Thu, 25 Jan 2018 19:16:41 +0000 (14:16 -0500)

t/lib-git-daemon: record daemon log

When we start git-daemon for our tests, we send its stderr
log stream to a named pipe. We synchronously read the first
line to make sure that the daemon started, and then dump the
rest to descriptor 4. This is handy for debugging test
output with "--verbose", but the tests themselves can't
access the log data.

Let's dump the log into a file, as well, so that future
tests can check the log. There are a few subtleties worth
calling out here:

- we'll continue to send output to descriptor 4 for
viewing/debugging, which would imply swapping out "cat"
for "tee". But we want to ensure that there's no
buffering, and "tee" doesn't have a standard way to
ask for that. So we'll use a shell loop around "read"
and "printf" instead. That ensures that after a request
has been served, the matching log entries will have made
it to the file.

- the existing first-line shell loop used read/echo. We'll
switch to consistently using "read -r" and "printf" to
relay data as faithfully as possible.

- we open the logfile for append, rather than just output.
That makes it OK for tests to truncate the logfile
without restarting the daemon (the OS will atomically
seek to the end of the file when outputting each line).
That allows tests to look at the log without worrying
about pollution from earlier tests.

Helped-by: Lucas Werkmeister <mail@lucaswerkmeister.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5570: use ls-remote instead of clone for interp testsJeff King Thu, 25 Jan 2018 00:55:05 +0000 (19:55 -0500)

t5570: use ls-remote instead of clone for interp tests

We don't actually care about the clone operation here; we
just want to know if we were able to actually contact the
remote repository. Using ls-remote does that more
efficiently, and without us having to worry about managing
the tmp.git directory.

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

mailinfo: avoid segfault when can't open filesJuan F. Codagnone Wed, 24 Jan 2018 16:56:47 +0000 (13:56 -0300)

mailinfo: avoid segfault when can't open files

If <msg> or <patch> files can't be opened, then mailinfo() returns an
error before it even initializes mi->p_hdr_data or mi->s_hdr_data.
When cmd_mailinfo() then calls clear_mailinfo(), we dereference the
NULL pointers trying to free their contents.

Signed-off-by: Juan F. Codagnone <jcodagnone@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read-cache: don't write index twice if we can't write... Nguyễn Thái Ngọc Duy Wed, 24 Jan 2018 09:38:29 +0000 (16:38 +0700)

read-cache: don't write index twice if we can't write shared index

In a0a967568e ("update-index --split-index: do not split if $GIT_DIR is
read only", 2014-06-13), we tried to make sure we can still write an
index, even if the shared index can not be written.

We did so by just calling 'do_write_locked_index()' just before
'write_shared_index()'. 'do_write_locked_index()' always at least
closes the tempfile nowadays, and used to close or commit the lockfile
if COMMIT_LOCK or CLOSE_LOCK were given at the time this feature was
introduced. COMMIT_LOCK or CLOSE_LOCK is passed in by most callers of
'write_locked_index()'.

After calling 'write_shared_index()', we call 'write_split_index()',
which calls 'do_write_locked_index()' again, which then tries to use the
closed lockfile again, but in fact fails to do so as it's already
closed. This eventually leads to a segfault.

Make sure to write the main index only once.

[nd: most of the commit message and investigation done by Thomas, I only
tweaked the solution a bit]

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

fsck: fix leak when traversing treesEric Wong Sat, 20 Jan 2018 07:43:51 +0000 (07:43 +0000)

fsck: fix leak when traversing trees

While fsck_walk/fsck_walk_tree/parse_tree populates "struct tree"
idempotently, it is still up to the fsck_walk caller to call
free_tree_buffer.

Fixes: ad2db4030e42890e ("fsck: remove redundant parse_tree() invocation")

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

Git 2.16.1 v2.16.1Junio C Hamano Mon, 22 Jan 2018 05:14:25 +0000 (21:14 -0800)

Git 2.16.1

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

Merge branch 'bc/hash-algo' into maintJunio C Hamano Mon, 22 Jan 2018 05:12:37 +0000 (21:12 -0800)

Merge branch 'bc/hash-algo' into maint

* bc/hash-algo:
t5601-clone: test case-conflicting files on case-insensitive filesystem
repository: pre-initialize hash algo pointer

t5601-clone: test case-conflicting files on case-insens... Eric Sunshine Sun, 21 Jan 2018 08:07:28 +0000 (03:07 -0500)

t5601-clone: test case-conflicting files on case-insensitive filesystem

A recently introduced regression caused a segfault at clone time on
case-insensitive filesystems when filenames differing only in case are
present. This bug has already been fixed (repository: pre-initialize
hash algo pointer, 2018-01-18), but it's not the first time similar
problems have arisen. Therefore, introduce a test to catch this case and
protect against future regressions.

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

repository: pre-initialize hash algo pointerbrian m. carlson Fri, 19 Jan 2018 04:18:25 +0000 (04:18 +0000)

repository: pre-initialize hash algo pointer

There are various git subcommands (among them, clone) which don't set up
the repository (that is, they lack RUN_SETUP or RUN_SETUP_GENTLY) but
end up needing to have information about the hash algorithm in use.
Because the hash algorithm is part of struct repository and it's only
initialized in repository setup, we can end up dereferencing a NULL
pointer in some cases if we call one of these subcommands and look up
the empty blob or empty tree values.

A "git clone" of a project that has two paths that differ only in
case suffers from this if it is run on a case insensitive platform.
When the command attempts to check out one of these two paths after
checking out the other one, the checkout codepath needs to see if
the version that is already on the filesystem (which should not
happen if the FS were case sensitive) is dirty, and it needs to
exercise the hashing code at that point.

In the future, we can add a command line option for this or read it
from the configuration, but until we're ready to expose that
functionality to the user, simply initialize the repository
structure to use the current hash algorithm, SHA-1.

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

files_initial_transaction_commit(): only unlock if... Mathias Rav Thu, 18 Jan 2018 13:38:41 +0000 (14:38 +0100)

files_initial_transaction_commit(): only unlock if locked

Running git clone --single-branch --mirror -b TAGNAME previously
triggered the following error message:

fatal: multiple updates for ref 'refs/tags/TAGNAME' not allowed.

This error condition is handled in files_initial_transaction_commit().

42c7f7ff9 ("commit_packed_refs(): remove call to `packed_refs_unlock()`", 2017-06-23)
introduced incorrect unlocking in the error path of this function,
which changes the error message to

fatal: BUG: packed_refs_unlock() called when not locked

Move the call to packed_refs_unlock() above the "cleanup:" label
since the unlocking should only be done in the last error path.

Signed-off-by: Mathias Rav <m@git.strova.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: support omitting data from tracesJonathan Tan Fri, 19 Jan 2018 00:28:02 +0000 (16:28 -0800)

http: support omitting data from traces

GIT_TRACE_CURL provides a way to debug what is being sent and received
over HTTP, with automatic redaction of sensitive information. But it
also logs data transmissions, which significantly increases the log file
size, sometimes unnecessarily. Add an option "GIT_TRACE_CURL_NO_DATA" to
allow the user to omit such data transmissions.

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

http: support cookie redaction when tracingJonathan Tan Fri, 19 Jan 2018 00:28:01 +0000 (16:28 -0800)

http: support cookie redaction when tracing

When using GIT_TRACE_CURL, Git already redacts the "Authorization:" and
"Proxy-Authorization:" HTTP headers. Extend this redaction to a
user-specified list of cookies, specified through the
"GIT_REDACT_COOKIES" environment variable.

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

travis: run tests with GIT_TEST_SPLIT_INDEXThomas Gummerer Sun, 7 Jan 2018 22:30:15 +0000 (22:30 +0000)

travis: run tests with GIT_TEST_SPLIT_INDEX

Split index mode only has a few dedicated tests, but as the index is
involved in nearly every git operation, this doesn't quite cover all the
ways repositories with split index can break. To use split index mode
throughout the test suite a GIT_TEST_SPLIT_INDEX environment variable
can be set, which makes git split the index at random and thus
excercises the functionality much more thoroughly.

As this is not turned on by default, it is not executed nearly as often
as the test suite is run, so occationally breakages slip through. Try
to counteract that by running the test suite with GIT_TEST_SPLIT_INDEX
mode turned on on travis.

To avoid using too many cycles on travis only run split index mode in
the linux-gcc target only. The Linux build was chosen over the Mac OS
builds because it tends to be much faster to complete.

The linux gcc build was chosen over the linux clang build because the
linux clang build is the fastest build, so it can serve as an early
indicator if something is broken and we want to avoid spending the extra
cycles of running the test suite twice for that.

Helped-by: Lars Schneider <larsxschneider@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

split-index: don't write cache tree with null oid entriesThomas Gummerer Sun, 7 Jan 2018 22:30:14 +0000 (22:30 +0000)

split-index: don't write cache tree with null oid entries

In a96d3cc3f6 ("cache-tree: reject entries with null sha1", 2017-04-21)
we made sure that broken cache entries do not get propagated to new
trees. Part of that was making sure not to re-use an existing cache
tree that includes a null oid.

It did so by dropping the cache tree in 'do_write_index()' if one of
the entries contains a null oid. In split index mode however, there
are two invocations to 'do_write_index()', one for the shared index
and one for the split index. The cache tree is only written once, to
the split index.

As we only loop through the elements that are effectively being
written by the current invocation, that may not include the entry with
a null oid in the split index (when it is already written to the
shared index), where we write the cache tree. Therefore in split
index mode we may still end up writing the cache tree, even though
there is an entry with a null oid in the index.

Fix this by checking for null oids in prepare_to_write_split_index,
where we loop the entries of the shared index as well as the entries for
the split index.

This fixes t7009 with GIT_TEST_SPLIT_INDEX. Also add a new test that's
more specifically showing the problem.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read-cache: fix reading the shared index for other... Thomas Gummerer Sun, 7 Jan 2018 22:30:13 +0000 (22:30 +0000)

read-cache: fix reading the shared index for other repos

read_index_from() takes a path argument for the location of the index
file. For reading the shared index in split index mode however it just
ignores that path argument, and reads it from the gitdir of the current
repository.

This works as long as an index in the_repository is read. Once that
changes, such as when we read the index of a submodule, or of a
different working tree than the current one, the gitdir of
the_repository will no longer contain the appropriate shared index,
and git will fail to read it.

For example t3007-ls-files-recurse-submodules.sh was broken with
GIT_TEST_SPLIT_INDEX set in 188dce131f ("ls-files: use repository
object", 2017-06-22), and t7814-grep-recurse-submodules.sh was also
broken in a similar manner, probably by introducing struct repository
there, although I didn't track down the exact commit for that.

be489d02d2 ("revision.c: --indexed-objects add objects from all
worktrees", 2017-08-23) breaks with split index mode in a similar
manner, not erroring out when it can't read the index, but instead
carrying on with pruning, without taking the index of the worktree into
account.

Fix this by passing an additional gitdir parameter to read_index_from,
to indicate where it should look for and read the shared index from.

read_cache_from() defaults to using the gitdir of the_repository. As it
is mostly a convenience macro, having to pass get_git_dir() for every
call seems overkill, and if necessary users can have more control by
using read_index_from().

Helped-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.16 v2.16.0Junio C Hamano Wed, 17 Jan 2018 21:06:51 +0000 (13:06 -0800)

Git 2.16

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

worktree: say that "add" takes an arbitrary commit... Junio C Hamano Wed, 17 Jan 2018 18:32:32 +0000 (10:32 -0800)

worktree: say that "add" takes an arbitrary commit in short-help

c4738aed ("worktree: add can be created from any commit-ish",
2017-11-26) taught "git worktree add" to start a new worktree
with an arbitrary commit-ish checked out, not limited to a tip
of a branch.

"git worktree --help" was updated to describe this, but we forgot to
update "git worktree -h".

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

Merge tag 'l10n-2.16.0-rnd2' of git://github.com/git... Junio C Hamano Tue, 16 Jan 2018 22:49:58 +0000 (14:49 -0800)

Merge tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-po

l10n for Git 2.16.0 round 2

* tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-po: (24 commits)
l10n: de.po: translate 72 new messages
l10n: de.po: improve messages when a branch starts to track another ref
l10n: bg.po: Updated Bulgarian translation (3288t)
l10n: TEAMS: add zh_CN team members
l10n: zh_CN: for git v2.16.0 l10n round 2
l10n: sv.po: Update Swedish translation (3288t0f0u)
l10n: ru.po: update Russian translation
l10n: TEAMS: Add ko team members
l10n: ko.po: Update Korean translation
l10n: fr.po 2.16 round 2
l10n: es.po: Spanish translation 2.16.0 round 2
l10n: vi.po(3288t): Updated Vietnamese translation for v2.16.0 round 2
l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed)
l10n: es.po: Update Spanish Translation v2.16.0
l10n: fr.po v2.16.0 round 1
l10n: bg.po: Updated Bulgarian translation (3284t)
l10n: sv.po: Update Swedish translation (3284t0f0u)
l10n: fr.po: "worktree list" mistranslated as prune
l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed)
l10n: fixes to German translation
...

diff.c: flush stdout before printing rename warningsNguyễn Thái Ngọc Duy Tue, 16 Jan 2018 09:23:49 +0000 (16:23 +0700)

diff.c: flush stdout before printing rename warnings

The diff output is buffered in a FILE object and could still be
partially buffered when we print these warnings (directly to fd 2).
The output is messed up like this

worktree.c | 138 +-
worktree.h warning: inexact rename detection was skipped due to too many files.
| 12 +-
wrapper.c | 83 +-

It gets worse if the warning is printed after color codes for the graph
part are already printed. You'll get a warning in green or red.

Flush stdout first, so we can get something like this instead:

xdiff/xutils.c | 42 +-
xdiff/xutils.h | 4 +-
1033 files changed, 150824 insertions(+), 69395 deletions(-)
warning: inexact rename detection was skipped due to too many files.

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

hashmap.h: remove unused variableRandall S. Becker Sun, 14 Jan 2018 18:07:48 +0000 (13:07 -0500)

hashmap.h: remove unused variable

In 'hashmap_enable_item_counting()', item is assigned but never
used. This causes a warning on HP NonStop. As the variable is
never used, fix this by just removing it.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Helped-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

describe: use strbuf_add_unique_abbrev() for adding... René Scharfe Mon, 15 Jan 2018 17:10:32 +0000 (18:10 +0100)

describe: use strbuf_add_unique_abbrev() for adding short hashes

Call strbuf_add_unique_abbrev() to add an abbreviated hash to a strbuf
instead of taking a detour through find_unique_abbrev() and its static
buffer. This is shorter and a bit more efficient.

Patch generated by Coccinelle (and contrib/coccinelle/strbuf.cocci).

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

read-cache.c: move tempfile creation/cleanup out of... Nguyễn Thái Ngọc Duy Sun, 14 Jan 2018 10:18:19 +0000 (17:18 +0700)

read-cache.c: move tempfile creation/cleanup out of write_shared_index

For one thing, we have more consistent cleanup procedure now and always
keep errno intact.

The real purpose is the ability to break out of write_locked_index()
early when mks_tempfile() fails in the next patch. It's more awkward to
do it if this mks_tempfile() is still inside write_shared_index().

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

read-cache.c: change type of "temp" in write_shared_index()Nguyễn Thái Ngọc Duy Sun, 14 Jan 2018 10:18:18 +0000 (17:18 +0700)

read-cache.c: change type of "temp" in write_shared_index()

This local variable 'temp' will be passed in from the caller in the next
patch. To reduce patch noise, let's change its type now while it's still
a local variable and get all the trival conversion out of the next patch.

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

add--interactive: ignore submodule changes except HEADNguyễn Thái Ngọc Duy Sat, 13 Jan 2018 12:10:38 +0000 (19:10 +0700)

add--interactive: ignore submodule changes except HEAD

For 'add -i' and 'add -p', the only action we can take on a dirty
submodule entry is update the index with a new value from its HEAD. The
content changes inside (from its own index, untracked files...) do not
matter, at least until 'git add -i' learns about launching a new
interactive add session inside a submodule.

Ignore all other submodules changes except HEAD. This reduces the number
of entries the user has to check through in 'git add -i', and the number
of 'no' they have to answer to 'git add -p' when dirty submodules are
present.

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

Doc/git-submodule: improve readability and grammar... Kaartic Sivaraam Sun, 14 Jan 2018 17:37:37 +0000 (23:07 +0530)

Doc/git-submodule: improve readability and grammar of a sentence

While at it, correctly quote important words.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Doc/gitsubmodules: make some changes to improve readabi... Kaartic Sivaraam Sun, 14 Jan 2018 17:37:36 +0000 (23:07 +0530)

Doc/gitsubmodules: make some changes to improve readability and syntax

* Only mention porcelain commands in examples

* Split a sentence for better readability

* Add missing apostrophes

* Clearly specify the advantages of using submodules

* Avoid abbreviations

* Use "Git" consistently

* Improve readability of certain lines

* Clarify when a submodule is considered active

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: de.po: translate 72 new messagesRalf Thielow Tue, 2 Jan 2018 09:14:40 +0000 (10:14 +0100)

l10n: de.po: translate 72 new messages

Translate 72 new messages came from git.pot update in 18a907225 (l10n:
git.pot: v2.16.0 round 1 (64 new, 25 removed)) and 005c62fe4 (l10n:
git.pot: v2.16.0 round 2 (8 new, 4 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>

l10n: de.po: improve messages when a branch starts... Ralf Thielow Sat, 16 Dec 2017 19:32:16 +0000 (20:32 +0100)

l10n: de.po: improve messages when a branch starts to track another ref

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

RelNotes: minor typofixSZEDER Gábor Fri, 12 Jan 2018 10:47:36 +0000 (11:47 +0100)

RelNotes: minor typofix

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

t9001: use existing helper in send-email testChristian Ludwig Fri, 12 Jan 2018 10:37:24 +0000 (11:37 +0100)

t9001: use existing helper in send-email test

Use the wrapper function around the sed statement like everywhere
else in the test. Unfortunately the wrapper function is defined
pretty late.

Move the wrapper to the top of the test file, so future users have it
available right away.

Signed-off-by: Christian Ludwig <chrissicool@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.16-rc2 v2.16.0-rc2Junio C Hamano Thu, 11 Jan 2018 21:20:41 +0000 (13:20 -0800)

Git 2.16-rc2

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

Merge branch 'jh/object-filtering'Junio C Hamano Thu, 11 Jan 2018 21:16:37 +0000 (13:16 -0800)

Merge branch 'jh/object-filtering'

Hotfix for a topic already in 'master'.

* jh/object-filtering:
oidset: don't return value from oidset_init

Merge branch 'tg/worktree-create-tracking'Junio C Hamano Thu, 11 Jan 2018 21:16:36 +0000 (13:16 -0800)

Merge branch 'tg/worktree-create-tracking'

Doc hotfix.

* tg/worktree-create-tracking:
Documentation/git-worktree.txt: add missing `

Merge branch 'js/test-with-ws-in-path'Junio C Hamano Thu, 11 Jan 2018 21:16:36 +0000 (13:16 -0800)

Merge branch 'js/test-with-ws-in-path'

Hot fix to a test.

* js/test-with-ws-in-path:
t3900: add some more quotes

l10n: bg.po: Updated Bulgarian translation (3288t)Alexander Shopov Thu, 11 Jan 2018 20:59:37 +0000 (21:59 +0100)

l10n: bg.po: Updated Bulgarian translation (3288t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>

Documentation/git-worktree.txt: add missing `Ralf Thielow Thu, 11 Jan 2018 18:18:21 +0000 (19:18 +0100)

Documentation/git-worktree.txt: add missing `

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>