gitweb.git
refs: use chdir_notify to update cached relative pathsJeff King Fri, 30 Mar 2018 18:35:12 +0000 (14:35 -0400)

refs: use chdir_notify to update cached relative paths

Commit f57f37e2e1 (files-backend: remove the use of
git_path(), 2017-03-26) introduced a regression when a
relative $GIT_DIR is used in a working tree:

- when we initialize the ref backend, we make a copy of
get_git_dir(), which may be relative

- later, we may call setup_work_tree() and chdir to the
root of the working tree

- further calls to the ref code will use the stored git
directory, but relative paths will now point to the
wrong place

The new test in t1501 demonstrates one such instance (the
bug causes us to write the ref update to the nonsense
"relative/relative/.git").

Since setup_work_tree() now uses chdir_notify, we can just
ask it update our relative paths when necessary.

Reported-by: Rafael Ascensao <rafa.almas@gmail.com>
Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

set_work_tree: use chdir_notifyJeff King Fri, 30 Mar 2018 18:35:08 +0000 (14:35 -0400)

set_work_tree: use chdir_notify

When we change to the top of the working tree, we manually
re-adjust $GIT_DIR and call set_git_dir() again, in order to
update any relative git-dir we'd compute earlier.

Instead of the work-tree code having to know to call the
git-dir code, let's use the new chdir_notify interface.
There are two spots that need updating, with a few
subtleties in each:

1. the set_git_dir() code needs to chdir_notify_register()
so it can be told when to update its path.

Technically we could push this down into repo_set_gitdir(),
so that even repository structs besides the_repository
could benefit from this. But that opens up a lot of
complications:

- we'd still need to touch set_git_dir(), because it
does some other setup (like setting $GIT_DIR in the
environment)

- submodules using other repository structs get
cleaned up, which means we'd need to remove them
from the chdir_notify list

- it's unlikely to fix any bugs, since we shouldn't
generally chdir() in the middle of working on a
submodule

2. setup_work_tree now needs to call chdir_notify(), and
can lose its manual set_git_dir() call.

Note that at first glance it looks like this undoes the
absolute-to-relative optimization added by 044bbbcb63
(Make git_dir a path relative to work_tree in
setup_work_tree(), 2008-06-19). But for the most part
that optimization was just _undoing_ the
relative-to-absolute conversion which the function was
doing earlier (and which is now gone).

It is true that if you already have an absolute git_dir
that the setup_work_tree() function will no longer make
it relative as a side effect. But:

- we generally do have relative git-dir's due to the
way the discovery code works

- if we really care about making git-dir's relative
when possible, then we should be relativizing them
earlier (e.g., when we see an absolute $GIT_DIR we
could turn it relative, whether we are going to
chdir into a worktree or not). That would cover all
cases, including ones that 044bbbcb63 did not.

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

add chdir-notify APIJeff King Fri, 30 Mar 2018 18:35:04 +0000 (14:35 -0400)

add chdir-notify API

If one part of the code does a permanent chdir(), then this
invalidates any relative paths that may be held by other
parts of the code. For example, setup_work_tree() moves us
to the top of the working tree, which may invalidate a
previously stored relative gitdir.

We've hacked around this case by teaching setup_work_tree()
to re-run set_git_dir() with an adjusted path, but this
stomps all over the idea of module boundaries.
setup_work_tree() shouldn't have to know all of the places
that need to be fed an adjusted path. And indeed, there's at
least one other place (the refs code) which needs adjusting.

Let's provide an API to let code that stores relative paths
"subscribe" to updates to the current working directory.
This means that callers of chdir() don't need to know about
all subscribers ahead of time; they can simply consult a
dynamically built list.

Note that our helper function to reparent relative paths
uses the simple remove_leading_path(). We could in theory
use the much smarter relative_path(), but that led to some
problems as described in 41894ae3a3 (Use simpler
relative_path when set_git_dir, 2013-10-14). Since we're
aiming to replace the setup_work_tree() code here, let's
follow its lead.

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

trace.c: export trace_setup_keyNguyễn Thái Ngọc Duy Fri, 30 Mar 2018 18:34:59 +0000 (14:34 -0400)

trace.c: export trace_setup_key

This is so that we can print traces based on this key outside trace.c.

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

set_git_dir: die when setenv() failsJeff King Fri, 30 Mar 2018 18:34:46 +0000 (14:34 -0400)

set_git_dir: die when setenv() fails

The set_git_dir() function returns an error if setenv()
fails, but there are zero callers who pay attention to this
return value. If this ever were to happen, it could cause
confusing results, as sub-processes would see a potentially
stale GIT_DIR (e.g., if it is relative and we chdir()-ed to
the root of the working tree).

We _could_ try to fix each caller, but there's really
nothing useful to do after this failure except die. Let's
just lump setenv() failure into the same category as malloc
failure: things that should never happen and cause us to
abort catastrophically.

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

Merge branch 'jh/partial-clone'Junio C Hamano Thu, 29 Mar 2018 22:39:59 +0000 (15:39 -0700)

Merge branch 'jh/partial-clone'

Hotfix.

* jh/partial-clone:
upload-pack: disable object filtering when disabled by config
unpack-trees: release oid_array after use in check_updates()

upload-pack: disable object filtering when disabled... Jonathan Nieder Wed, 28 Mar 2018 20:33:03 +0000 (13:33 -0700)

upload-pack: disable object filtering when disabled by config

When upload-pack gained partial clone support (v2.17.0-rc0~132^2~12,
2017-12-08), it was guarded by the uploadpack.allowFilter config item
to allow server operators to control when they start supporting it.

That config item didn't go far enough, though: it controls whether the
'filter' capability is advertised, but if a (custom) client ignores
the capability advertisement and passes a filter specification anyway,
the server would handle that despite allowFilter being false.

This is particularly significant if a security bug is discovered in
this new experimental partial clone code. Installations without
uploadpack.allowFilter ought not to be affected since they don't
intend to support partial clone, but they would be swept up into being
vulnerable.

Simplify and limit the attack surface by making uploadpack.allowFilter
disable the feature, not just the advertisement of it.

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

Git 2.17-rc2 v2.17.0-rc2Junio C Hamano Wed, 28 Mar 2018 18:05:14 +0000 (11:05 -0700)

Git 2.17-rc2

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

Merge branch 'tg/stash-doc-typofix'Junio C Hamano Wed, 28 Mar 2018 18:04:25 +0000 (11:04 -0700)

Merge branch 'tg/stash-doc-typofix'

Hotfix.

* tg/stash-doc-typofix:
git-stash.txt: remove extra square bracket

Merge branch 'pc/submodule-helper'Junio C Hamano Wed, 28 Mar 2018 18:04:25 +0000 (11:04 -0700)

Merge branch 'pc/submodule-helper'

Hotfix.

* pc/submodule-helper:
submodule deinit: handle non existing pathspecs gracefully

Merge branch 'nd/parseopt-completion'Junio C Hamano Wed, 28 Mar 2018 18:04:24 +0000 (11:04 -0700)

Merge branch 'nd/parseopt-completion'

Hotfix for recently graduated topic that give help to completion
scripts from the Git subcommands that are being completed

* nd/parseopt-completion:
t9902: disable test on the list of merge-strategies under GETTEXT_POISON
completion: clear cached --options when sourcing the completion script

submodule deinit: handle non existing pathspecs gracefullyStefan Beller Tue, 27 Mar 2018 23:28:24 +0000 (16:28 -0700)

submodule deinit: handle non existing pathspecs gracefully

This fixes a regression introduced in 2e612731b5 (submodule: port
submodule subcommand 'deinit' from shell to C, 2018-01-15), when
handling pathspecs that do not exist gracefully. This restores the
historic behavior of reporting the pathspec as unknown and returning
instead of reporting a bug.

Reported-by: Peter Oberndorfer <kumbayo84@arcor.de>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-stash.txt: remove extra square bracketThomas Gummerer Mon, 26 Mar 2018 21:11:47 +0000 (22:11 +0100)

git-stash.txt: remove extra square bracket

In 1ada5020b3 ("stash: use stash_push for no verb form", 2017-02-28),
when the pathspec argument was introduced in 'git stash', that was also
documented. However I forgot to remove an extra square bracket after
the '--message' argument, even though the square bracket should have
been after the pathspec argument (where it was also added).

Remove the extra square bracket after the '--message' argument, to show
that the pathspec argument should be used with the 'push' verb.

While the pathspec argument can be used without the push verb, that's a
special case described later in the man page, and removing the first extra
square bracket instead of the second one makes the synopis easier to
understand.

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

unpack-trees: release oid_array after use in check_upda... René Scharfe Sun, 25 Mar 2018 16:31:48 +0000 (18:31 +0200)

unpack-trees: release oid_array after use in check_updates()

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

t9902: disable test on the list of merge-strategies... Junio C Hamano Fri, 23 Mar 2018 17:40:06 +0000 (10:40 -0700)

t9902: disable test on the list of merge-strategies under GETTEXT_POISON

The code to learn the list of merge strategies from the output of
"git merge -s help" forces C locale, so that it can notice the
message shown to indicate where the list starts in the output.

However, GETTEXT_POISON build corrupts its output even when run in
the C locale, and we cannot expect this test to succeed.

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

Sync with Git 2.16.3Junio C Hamano Thu, 22 Mar 2018 21:36:51 +0000 (14:36 -0700)

Sync with Git 2.16.3

Git 2.16.3 v2.16.3Junio C Hamano Thu, 22 Mar 2018 21:24:45 +0000 (14:24 -0700)

Git 2.16.3

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

Merge branch 'ms/non-ascii-ticks' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:25 +0000 (14:24 -0700)

Merge branch 'ms/non-ascii-ticks' into maint

Doc markup fix.

* ms/non-ascii-ticks:
Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes

Merge branch 'jk/cached-commit-buffer' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:25 +0000 (14:24 -0700)

Merge branch 'jk/cached-commit-buffer' into maint

Code clean-up.

* jk/cached-commit-buffer:
revision: drop --show-all option
commit: drop uses of get_cached_commit_buffer()

Merge branch 'sm/mv-dry-run-update' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:25 +0000 (14:24 -0700)

Merge branch 'sm/mv-dry-run-update' into maint

Code clean-up.

* sm/mv-dry-run-update:
mv: remove unneeded 'if (!show_only)'
t7001: add test case for --dry-run

Merge branch 'tg/worktree-create-tracking' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:24 +0000 (14:24 -0700)

Merge branch 'tg/worktree-create-tracking' into maint

Hotfix for a recent topic.

* tg/worktree-create-tracking:
git-worktree.txt: fix indentation of example and text of 'add' command
git-worktree.txt: fix missing ")" typo

Merge branch 'gs/test-unset-xdg-cache-home' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:24 +0000 (14:24 -0700)

Merge branch 'gs/test-unset-xdg-cache-home' into maint

Test update.

* gs/test-unset-xdg-cache-home:
test-lib.sh: unset XDG_CACHE_HOME

Merge branch 'sb/status-doc-fix' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:23 +0000 (14:24 -0700)

Merge branch 'sb/status-doc-fix' into maint

Docfix.

* sb/status-doc-fix:
Documentation/git-status: clarify status table for porcelain mode

Merge branch 'rd/typofix' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:22 +0000 (14:24 -0700)

Merge branch 'rd/typofix' into maint

Typofix.

* rd/typofix:
Correct mispellings of ".gitmodule" to ".gitmodules"
t/: correct obvious typo "detahced"

Merge branch 'bp/fsmonitor' into maintJunio C Hamano Thu, 22 Mar 2018 21:24:21 +0000 (14:24 -0700)

Merge branch 'bp/fsmonitor' into maint

Doc update for a recently added feature.

* bp/fsmonitor:
fsmonitor: update documentation to remove reference to invalid config settings

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

completion: clear cached --options when sourcing the... SZEDER Gábor Thu, 22 Mar 2018 14:16:04 +0000 (15:16 +0100)

completion: clear cached --options when sourcing the completion script

The established way to update the completion script in an already
running shell is to simply source it again: this brings in any new
--options and features, and clears caching variables. E.g. it clears
the variables caching the list of (all|porcelain) git commands, so
when they are later lazy-initialized again, then they will list and
cache any newly installed commmands as well.

Unfortunately, since d401f3debc (git-completion.bash: introduce
__gitcomp_builtin, 2018-02-09) and subsequent patches this doesn't
work for a lot of git commands' options. To eliminate a lot of
hard-to-maintain hard-coded lists of options, those commits changed
the completion script to use a bunch of programmatically created and
lazy-initialized variables to cache the options of those builtin
porcelain commands that use parse-options. These variables are not
cleared upon sourcing the completion script, therefore they continue
caching the old lists of options, even when some commands recently
learned new options or when deprecated options were removed.

Always 'unset' these variables caching the options of builtin commands
when sourcing the completion script.

Redirect 'unset's stderr to /dev/null, because ZSH's 'unset' complains
if it's invoked without any arguments, i.e. no variables caching
builtin's options are set. This can happen, if someone were to source
the completion script twice without completing any --options in
between. Bash stays silent in this case.

Add tests to ensure that these variables are indeed cleared when the
completion script is sourced; not just the variables caching options,
but all other caching variables, i.e. the variables caching commands,
porcelain commands and merge strategies as well.

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

Git 2.17-rc1 v2.17.0-rc1Junio C Hamano Wed, 21 Mar 2018 19:02:04 +0000 (12:02 -0700)

Git 2.17-rc1

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

Merge branch 'jk/attributes-path-doc'Junio C Hamano Wed, 21 Mar 2018 18:30:15 +0000 (11:30 -0700)

Merge branch 'jk/attributes-path-doc'

Doc update.

* jk/attributes-path-doc:
doc/gitattributes: mention non-recursive behavior

Merge branch 'rj/warning-uninitialized-fix'Junio C Hamano Wed, 21 Mar 2018 18:30:15 +0000 (11:30 -0700)

Merge branch 'rj/warning-uninitialized-fix'

Compilation fix.

* rj/warning-uninitialized-fix:
read-cache: fix an -Wmaybe-uninitialized warning
-Wuninitialized: remove some 'init-self' workarounds

Merge branch 'tz/complete-tag-delete-tagname'Junio C Hamano Wed, 21 Mar 2018 18:30:15 +0000 (11:30 -0700)

Merge branch 'tz/complete-tag-delete-tagname'

* tz/complete-tag-delete-tagname:
completion: complete tags with git tag --delete/--verify

Merge branch 'ml/filter-branch-portability-fix'Junio C Hamano Wed, 21 Mar 2018 18:30:14 +0000 (11:30 -0700)

Merge branch 'ml/filter-branch-portability-fix'

Shell script portability fix.

* ml/filter-branch-portability-fix:
filter-branch: use printf instead of echo -e

Merge branch 'js/ming-strftime'Junio C Hamano Wed, 21 Mar 2018 18:30:14 +0000 (11:30 -0700)

Merge branch 'js/ming-strftime'

* js/ming-strftime:
mingw: abort on invalid strftime formats

Merge branch 'dp/merge-strategy-doc-fix'Junio C Hamano Wed, 21 Mar 2018 18:30:13 +0000 (11:30 -0700)

Merge branch 'dp/merge-strategy-doc-fix'

Doc fix.

* dp/merge-strategy-doc-fix:
Documentation/merge-strategies: typofix

Merge branch 'tz/relnotes-1.7-on-perl'Junio C Hamano Wed, 21 Mar 2018 18:30:12 +0000 (11:30 -0700)

Merge branch 'tz/relnotes-1.7-on-perl'

* tz/relnotes-1.7-on-perl:
RelNotes: add details on Perl module changes

Merge branch 'rj/http-code-cleanup'Junio C Hamano Wed, 21 Mar 2018 18:30:12 +0000 (11:30 -0700)

Merge branch 'rj/http-code-cleanup'

There was an unused file-scope static variable left in http.c when
building for versions of libCURL that is older than 7.19.4, which
has been fixed.

* rj/http-code-cleanup:
http: fix an unused variable warning for 'curl_no_proxy'

Merge branch 'ks/t3200-typofix'Junio C Hamano Wed, 21 Mar 2018 18:30:12 +0000 (11:30 -0700)

Merge branch 'ks/t3200-typofix'

Test typofix.

* ks/t3200-typofix:
t/t3200: fix a typo in a test description

Merge branch 'jt/transfer-fsck-with-promissor'Junio C Hamano Wed, 21 Mar 2018 18:30:11 +0000 (11:30 -0700)

Merge branch 'jt/transfer-fsck-with-promissor'

The transfer.fsckobjects configuration tells "git fetch" to
validate the data and connected-ness of objects in the received
pack; the code to perform this check has been taught about the
narrow clone's convention that missing objects that are reachable
from objects in a pack that came from a promissor remote is OK.

* jt/transfer-fsck-with-promissor:
fetch-pack: do not check links for partial fetch
index-pack: support checking objects but not links

Merge branch 'bp/refresh-cache-ent-rehash-fix'Junio C Hamano Wed, 21 Mar 2018 18:30:11 +0000 (11:30 -0700)

Merge branch 'bp/refresh-cache-ent-rehash-fix'

The codepath to replace an existing entry in the index had a bug in
updating the name hash structure, which has been fixed.

* bp/refresh-cache-ent-rehash-fix:
Fix bugs preventing adding updated cache entries to the name hash

Merge branch 'jh/fsck-promisors'Junio C Hamano Wed, 21 Mar 2018 18:30:10 +0000 (11:30 -0700)

Merge branch 'jh/fsck-promisors'

A hotfix to a topic that graduated recently.

* jh/fsck-promisors:
sha1_file: restore OBJECT_INFO_QUICK functionality

Merge branch 'ma/skip-writing-unchanged-index'Junio C Hamano Wed, 21 Mar 2018 18:30:10 +0000 (11:30 -0700)

Merge branch 'ma/skip-writing-unchanged-index'

Internal API clean-up to allow write_locked_index() optionally skip
writing the in-core index when it is not modified.

* ma/skip-writing-unchanged-index:
write_locked_index(): add flag to avoid writing unchanged index

Merge branch 'ma/config-page-only-in-list-mode'Junio C Hamano Wed, 21 Mar 2018 18:30:09 +0000 (11:30 -0700)

Merge branch 'ma/config-page-only-in-list-mode'

In a way similar to how "git tag" learned to honor the pager
setting only in the list mode, "git config" learned to ignore the
pager setting when it is used for setting values (i.e. when the
purpose of the operation is not to "show").

* ma/config-page-only-in-list-mode:
config: change default of `pager.config` to "on"
config: respect `pager.config` in list/get-mode only
t7006: add tests for how git config paginates

doc/gitattributes: mention non-recursive behaviorJeff King Tue, 20 Mar 2018 04:14:54 +0000 (00:14 -0400)

doc/gitattributes: mention non-recursive behavior

The gitattributes documentation claims that the pattern
rules are largely the same as for gitignore. However, the
rules for recursion are different.

In an ideal world, we would make them the same (if for
nothing else than consistency and simplicity), but that
would create backwards compatibility issues. For some
discussion, see this thread:

https://public-inbox.org/git/slrnkldd3g.1l4.jan@majutsushi.net/

But let's at least document the differences instead of
actively misleading the user by claiming that they're the
same.

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

read-cache: fix an -Wmaybe-uninitialized warningRamsay Jones Mon, 19 Mar 2018 17:56:11 +0000 (17:56 +0000)

read-cache: fix an -Wmaybe-uninitialized warning

The function ce_write_entry() uses a 'self-initialised' variable
construct, for the symbol 'saved_namelen', to suppress a gcc
'-Wmaybe-uninitialized' warning, given that the warning is a false
positive.

For the purposes of this discussion, the ce_write_entry() function has
three code blocks of interest, that look like so:

/* block #1 */
if (ce->ce_flags & CE_STRIP_NAME) {
saved_namelen = ce_namelen(ce);
ce->ce_namelen = 0;
}

/* block #2 */
/*
* several code blocks that contain, among others, calls
* to copy_cache_entry_to_ondisk(ondisk, ce);
*/

/* block #3 */
if (ce->ce_flags & CE_STRIP_NAME) {
ce->ce_namelen = saved_namelen;
ce->ce_flags &= ~CE_STRIP_NAME;
}

The warning implies that gcc thinks it is possible that the first
block is not entered, the calls to copy_cache_entry_to_ondisk()
could toggle the CE_STRIP_NAME flag on, thereby entering block #3
with saved_namelen unset. However, the copy_cache_entry_to_ondisk()
function does not write to ce->ce_flags (it only reads). gcc could
easily determine this, since that function is local to this file,
but it obviously doesn't.

In order to suppress this warning, we make it clear to the reader
(human and compiler), that block #3 will only be entered when the
first block has been entered, by introducing a new 'stripped_name'
boolean variable. We also take the opportunity to change the type
of 'saved_namelen' to 'unsigned int' to match ce->ce_namelen.

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

-Wuninitialized: remove some 'init-self' workaroundsRamsay Jones Mon, 19 Mar 2018 17:54:35 +0000 (17:54 +0000)

-Wuninitialized: remove some 'init-self' workarounds

The 'self-initialised' variables construct (ie <type> var = var;) has
been used to silence gcc '-W[maybe-]uninitialized' warnings. This has,
unfortunately, caused MSVC to issue 'uninitialized variable' warnings.
Also, using clang static analysis causes complaints about an 'Assigned
value is garbage or undefined'.

There are six such constructs in the current codebase. Only one of the
six causes gcc to issue a '-Wmaybe-uninitialized' warning (which will
be addressed elsewhere). The remaining five 'init-self' gcc workarounds
are noted below, along with the commit which introduced them:

1. builtin/rev-list.c: 'reaches' and 'all', see commit 457f08a030
("git-rev-list: add --bisect-vars option.", 2007-03-21).

2. merge-recursive.c:2064 'mrtree', see commit f120ae2a8e ("merge-
recursive.c: mrtree in merge() is not used before set", 2007-10-29).

3. fast-import.c:3023 'oe', see commit 85c62395b1 ("fast-import: let
importers retrieve blobs", 2010-11-28).

4. fast-import.c:3006 'oe', see commit 28c7b1f7b7 ("fast-import: add a
get-mark command", 2015-07-01).

Remove the 'self-initialised' variable constructs noted above.

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

filter-branch: use printf instead of echo -eMichele Locati Mon, 19 Mar 2018 15:52:59 +0000 (16:52 +0100)

filter-branch: use printf instead of echo -e

In order to echo a tab character, it's better to use printf instead of
"echo -e", because it's more portable (for instance, "echo -e" doesn't work
as expected on a Mac).

This solves the "fatal: Not a valid object name" error in git-filter-branch
when using the --state-branch option.

Furthermore, let's switch from "/bin/echo" to just "echo", so that the
built-in echo command is used where available.

Signed-off-by: Michele Locati <michele@locati.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: abort on invalid strftime formatsJohannes Schindelin Mon, 19 Mar 2018 16:49:22 +0000 (17:49 +0100)

mingw: abort on invalid strftime formats

On Windows, strftime() does not silently ignore invalid formats, but
warns about them and then returns 0 and sets errno to EINVAL.

Unfortunately, Git does not expect such a behavior, as it disagrees
with strftime()'s semantics on Linux. As a consequence, Git
misinterprets the return value 0 as "I need more space" and grows the
buffer. As the larger buffer does not fix the format, the buffer grows
and grows and grows until we are out of memory and abort.

Ideally, we would switch off the parameter validation just for
strftime(), but we cannot even override the invalid parameter handler
via _set_thread_local_invalid_parameter_handler() using MINGW because
that function is not declared. Even _set_invalid_parameter_handler(),
which *is* declared, does not help, as it simply does... nothing.

So let's just bite the bullet and override strftime() for MINGW and
abort on an invalid format string. While this does not provide the
best user experience, it is the best we can do.

See https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx for more
details.

This fixes https://github.com/git-for-windows/git/issues/863

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

completion: complete tags with git tag --delete/--verifyTodd Zullinger Sun, 18 Mar 2018 04:01:35 +0000 (00:01 -0400)

completion: complete tags with git tag --delete/--verify

Completion of tag names has worked for the short -d/-v options since
88e21dc746 ("Teach bash about completing arguments for git-tag",
2007-08-31). The long options were not added to "git tag" until many
years later, in c97eff5a95 ("git-tag: introduce long forms for the
options", 2011-08-28).

Extend tag name completion to --delete/--verify.

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

Documentation/merge-strategies: typofixDavid Pursehouse Sat, 17 Mar 2018 03:31:42 +0000 (12:31 +0900)

Documentation/merge-strategies: typofix

It's strategy, not stragegy.

Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

RelNotes: add details on Perl module changesTodd Zullinger Fri, 16 Mar 2018 22:07:48 +0000 (18:07 -0400)

RelNotes: add details on Perl module changes

Document changes to core and non-core Perl module handling in 2.17.

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

Git 2.17-rc0 v2.17.0-rc0Junio C Hamano Thu, 15 Mar 2018 22:01:05 +0000 (15:01 -0700)

Git 2.17-rc0

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

Merge branch 'tl/userdiff-csharp-async'Junio C Hamano Thu, 15 Mar 2018 22:00:47 +0000 (15:00 -0700)

Merge branch 'tl/userdiff-csharp-async'

Update funcname pattern used for C# to recognize "async" keyword.

* tl/userdiff-csharp-async:
userdiff.c: add C# async keyword in diff pattern

Merge branch 'sg/cvs-tests-with-x'Junio C Hamano Thu, 15 Mar 2018 22:00:46 +0000 (15:00 -0700)

Merge branch 'sg/cvs-tests-with-x'

Allow running a couple of tests with "sh -x".

* sg/cvs-tests-with-x:
t9402-git-cvsserver-refs: don't check the stderr of a subshell
t9400-git-cvsserver-server: don't rely on the output of 'test_cmp'

Merge branch 'ab/man-sec-list'Junio C Hamano Thu, 15 Mar 2018 22:00:46 +0000 (15:00 -0700)

Merge branch 'ab/man-sec-list'

Doc update.

* ab/man-sec-list:
git manpage: note git-security@googlegroups.com

Merge branch 'ab/perl-fixes'Junio C Hamano Thu, 15 Mar 2018 22:00:46 +0000 (15:00 -0700)

Merge branch 'ab/perl-fixes'

Clean-up to various pieces of Perl code we have.

* ab/perl-fixes:
perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS
Makefile: add NO_PERL_CPAN_FALLBACKS knob
perl: move the perl/Git/FromCPAN tree to perl/FromCPAN
perl: generalize the Git::LoadCPAN facility
perl: move CPAN loader wrappers to another namespace
perl: update our copy of Mail::Address
perl: update our ancient copy of Error.pm
git-send-email: unconditionally use Net::{SMTP,Domain}
Git.pm: hard-depend on the File::{Temp,Spec} modules
gitweb: hard-depend on the Digest::MD5 5.8 module
Git.pm: add the "use warnings" pragma
Git.pm: remove redundant "use strict" from sub-package
perl: *.pm files should not have the executable bit

Merge branch 'cl/send-email-reply-to'Junio C Hamano Thu, 15 Mar 2018 22:00:45 +0000 (15:00 -0700)

Merge branch 'cl/send-email-reply-to'

"git send-email" learned "--reply-to=<address>" option.

* cl/send-email-reply-to:
send-email: support separate Reply-To address
send-email: rename variable for clarity

Merge branch 'np/send-email-header-parsing'Junio C Hamano Thu, 15 Mar 2018 22:00:45 +0000 (15:00 -0700)

Merge branch 'np/send-email-header-parsing'

Code refactoring.

* np/send-email-header-parsing:
send-email: extract email-parsing code into a subroutine

t/t3200: fix a typo in a test descriptionKaartic Sivaraam Sat, 10 Mar 2018 15:54:16 +0000 (21:24 +0530)

t/t3200: fix a typo in a test description

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

http: fix an unused variable warning for 'curl_no_proxy'Ramsay Jones Wed, 14 Mar 2018 21:56:06 +0000 (21:56 +0000)

http: fix an unused variable warning for 'curl_no_proxy'

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

Fix bugs preventing adding updated cache entries to... Ben Peart Thu, 15 Mar 2018 15:25:20 +0000 (11:25 -0400)

Fix bugs preventing adding updated cache entries to the name hash

Update replace_index_entry() to clear the CE_HASHED flag from the new cache
entry so that it can add it to the name hash in set_index_entry()

Fix refresh_cache_ent() to use the copy_cache_entry() macro instead of memcpy()
so that it doesn't incorrectly copy the hash state from the old entry.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch-pack: do not check links for partial fetchJonathan Tan Wed, 14 Mar 2018 18:42:41 +0000 (11:42 -0700)

fetch-pack: do not check links for partial fetch

When doing a partial clone or fetch with transfer.fsckobjects=1, use the
--fsck-objects instead of the --strict flag when invoking index-pack so
that links are not checked, only objects. This is because incomplete
links are expected when doing a partial clone or fetch.

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

index-pack: support checking objects but not linksJonathan Tan Wed, 14 Mar 2018 18:42:40 +0000 (11:42 -0700)

index-pack: support checking objects but not links

The index-pack command currently supports the
--check-self-contained-and-connected argument, for internal use only,
that instructs it to only check for broken links and not broken objects.
For partial clones, we need the inverse, so add a --fsck-objects
argument that checks for broken objects and not broken links, also for
internal use only.

This will be used by fetch-pack in a subsequent patch.

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

Merge branch 'nd/parseopt-completion'Junio C Hamano Wed, 14 Mar 2018 19:01:06 +0000 (12:01 -0700)

Merge branch 'nd/parseopt-completion'

Teach parse-options API an option to help the completion script,
and make use of the mechanism in command line completion.

* nd/parseopt-completion: (45 commits)
completion: more subcommands in _git_notes()
completion: complete --{reuse,reedit}-message= for all notes subcmds
completion: simplify _git_notes
completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate
completion: use __gitcomp_builtin in _git_worktree
completion: use __gitcomp_builtin in _git_tag
completion: use __gitcomp_builtin in _git_status
completion: use __gitcomp_builtin in _git_show_branch
completion: use __gitcomp_builtin in _git_rm
completion: use __gitcomp_builtin in _git_revert
completion: use __gitcomp_builtin in _git_reset
completion: use __gitcomp_builtin in _git_replace
remote: force completing --mirror= instead of --mirror
completion: use __gitcomp_builtin in _git_remote
completion: use __gitcomp_builtin in _git_push
completion: use __gitcomp_builtin in _git_pull
completion: use __gitcomp_builtin in _git_notes
completion: use __gitcomp_builtin in _git_name_rev
completion: use __gitcomp_builtin in _git_mv
completion: use __gitcomp_builtin in _git_merge_base
...

Merge branch 'nd/object-allocation-comments'Junio C Hamano Wed, 14 Mar 2018 19:01:06 +0000 (12:01 -0700)

Merge branch 'nd/object-allocation-comments'

Code doc update.

* nd/object-allocation-comments:
object.h: realign object flag allocation comment
object.h: update flag allocation comment

Merge branch 'jk/smart-http-protocol-doc-fix'Junio C Hamano Wed, 14 Mar 2018 19:01:05 +0000 (12:01 -0700)

Merge branch 'jk/smart-http-protocol-doc-fix'

A doc update.

* jk/smart-http-protocol-doc-fix:
smart-http: document flush after "# service" line

Merge branch 'jk/add-i-diff-filter'Junio C Hamano Wed, 14 Mar 2018 19:01:05 +0000 (12:01 -0700)

Merge branch 'jk/add-i-diff-filter'

The "interactive.diffFilter" used by "git add -i" must retain
one-to-one correspondence between its input and output, but it was
not enforced and caused end-user confusion. We now at least make
sure the filtered result has the same number of lines as its input
to detect a broken filter.

* jk/add-i-diff-filter:
add--interactive: detect bogus diffFilter output
t3701: add a test for interactive.diffFilter

Merge branch 'nd/worktree-move'Junio C Hamano Wed, 14 Mar 2018 19:01:05 +0000 (12:01 -0700)

Merge branch 'nd/worktree-move'

"git worktree" learned move and remove subcommands.

* nd/worktree-move:
t2028: fix minor error and issues in newly-added "worktree move" tests
worktree remove: allow it when $GIT_WORK_TREE is already gone
worktree remove: new command
worktree move: refuse to move worktrees with submodules
worktree move: accept destination as directory
worktree move: new command
worktree.c: add update_worktree_location()
worktree.c: add validate_worktree()

Merge branch 'pw/add-p-recount'Junio C Hamano Wed, 14 Mar 2018 19:01:04 +0000 (12:01 -0700)

Merge branch 'pw/add-p-recount'

"git add -p" has been lazy in coalescing split patches before
passing the result to underlying "git apply", leading to corner
case bugs; the logic to prepare the patch to be applied after hunk
selections has been tightened.

* pw/add-p-recount:
add -p: don't rely on apply's '--recount' option
add -p: fix counting when splitting and coalescing
add -p: calculate offset delta for edited patches
add -p: adjust offsets of subsequent hunks when one is skipped
t3701: add failing test for pathological context lines
t3701: don't hard code sha1 hash values
t3701: use test_write_lines and write_script
t3701: indent here documents
add -i: add function to format hunk header

Merge branch 'ab/pre-auto-gc-battery'Junio C Hamano Wed, 14 Mar 2018 19:01:04 +0000 (12:01 -0700)

Merge branch 'ab/pre-auto-gc-battery'

A sample auto-gc hook (in contrib/) to skip auto-gc while on
battery has been updated to almost always allow running auto-gc
unless on_ac_power command is absolutely sure that we are on
battery power (earlier, it skipped unless the command is sure that
we are on ac power).

* ab/pre-auto-gc-battery:
hooks/pre-auto-gc-battery: allow gc to run on non-laptops

Merge branch 'sg/test-x'Junio C Hamano Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)

Merge branch 'sg/test-x'

Running test scripts under -x option of the shell is often not a
useful way to debug them, because the error messages from the
commands tests try to capture and inspect are contaminated by the
tracing output by the shell. An earlier work done to make it more
pleasant to run tests under -x with recent versions of bash is
extended to cover posix shells that do not support BASH_XTRACEFD.

* sg/test-x:
travis-ci: run tests with '-x' tracing
t/README: add a note about don't saving stderr of compound commands
t1510-repo-setup: mark as untraceable with '-x'
t9903-bash-prompt: don't check the stderr of __git_ps1()
t5570-git-daemon: don't check the stderr of a subshell
t5526: use $TRASH_DIRECTORY to specify the path of GIT_TRACE log file
t5500-fetch-pack: don't check the stderr of a subshell
t3030-merge-recursive: don't check the stderr of a subshell
t1507-rev-parse-upstream: don't check the stderr of a shell function
t: add means to disable '-x' tracing for individual test scripts
t: prevent '-x' tracing from interfering with test helpers' stderr

Merge branch 'rj/test-i18ngrep'Junio C Hamano Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)

Merge branch 'rj/test-i18ngrep'

Test updates.

* rj/test-i18ngrep:
t5536: simplify checking of messages output to stderr
t4151: consolidate multiple calls to test_i18ngrep

Merge branch 'ma/roll-back-lockfiles'Junio C Hamano Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)

Merge branch 'ma/roll-back-lockfiles'

Some codepaths used to take a lockfile and did not roll it back;
they are automatically rolled back at program exit, so there is no
real "breakage", but it still is a good practice to roll back when
you are done with a lockfile.

* ma/roll-back-lockfiles:
sequencer: do not roll back lockfile unnecessarily
merge: always roll back lock in `checkout_fast_forward()`
merge-recursive: always roll back lock in `merge_recursive_generic()`
sequencer: always roll back lock in `do_recursive_merge()`
sequencer: make lockfiles non-static

Merge branch 'nd/diff-stat-with-summary'Junio C Hamano Wed, 14 Mar 2018 19:01:02 +0000 (12:01 -0700)

Merge branch 'nd/diff-stat-with-summary'

"git diff" and friends learned "--compact-summary" that shows the
information usually given with the "--summary" option on the same
line as the diffstat output of the "--stat" option (which saves
vertical space and keeps info on a single path at the same place).

* nd/diff-stat-with-summary:
diff: add --compact-summary
diff.c: refactor pprint_rename() to use strbuf

sha1_file: restore OBJECT_INFO_QUICK functionalityJonathan Tan Tue, 13 Mar 2018 15:30:29 +0000 (08:30 -0700)

sha1_file: restore OBJECT_INFO_QUICK functionality

Support for the OBJECT_INFO_QUICK flag in sha1_object_info_extended()
was added in commit dfdd4afcf9 ("sha1_file: teach
sha1_object_info_extended more flags", 2017-06-26) in order to support
commit e83e71c5e1 ("sha1_file: refactor has_sha1_file_with_flags",
2017-06-26), but it was inadvertently removed in commit 8b4c0103a9
("sha1_file: support lazily fetching missing objects", 2017-12-08).

Restore this functionality.

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

t9402-git-cvsserver-refs: don't check the stderr of... SZEDER Gábor Thu, 8 Mar 2018 12:38:44 +0000 (13:38 +0100)

t9402-git-cvsserver-refs: don't check the stderr of a subshell

Four 'cvs diff' related tests in 't9402-git-cvsserver-refs.sh' fail
when the test script is run with '-x' tracing (and using a shell other
than a Bash version supporting BASH_XTRACEFD). The reason for those
failures is that the tests check the emptiness of a subshell's stderr,
which includes the trace of commands executed in that subshell as
well, throwing off the emptiness check.

Save the stdout and stderr of the invoked 'cvs' command instead of the
whole subshell, so the latter remains free from tracing output. (Note
that changing how stdout is saved is only done for the sake of
consistency, it's not necessary for correctness.)

After this change t9402 passes with '-x', even when running with
/bin/sh.

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

t9400-git-cvsserver-server: don't rely on the output... SZEDER Gábor Thu, 8 Mar 2018 22:44:58 +0000 (23:44 +0100)

t9400-git-cvsserver-server: don't rely on the output of 'test_cmp'

The test 'cvs update (-p)' redirects and checks 'test_cmp's stdout and
even its stderr. The commit introducing this test in 6e8937a084
(cvsserver: Add test for update -p, 2008-03-27) doesn't discuss why,
in fact its log message only consists of that subject line. Anyway,
weird as it is, it kind of made sense due to the way that test was
structured:

After a bit of preparation, this test updates four files via CVS and
checks their contents using 'test_cmp', but it does so in a for loop
iterating over the names of those four files. Now, the exit status of
a for loop is the exit status of the last command executed in the
loop, meaning that the test can't simply rely on the exit code of
'test_cmp' in the loop's body. Instead, the test works it around by
relying on the stdout of 'test_cmp' being silent on success and
showing the diff on failure, as it appends the stdout of all four
'test_cmp' invocations to a single file and checks that file's
emptiness after the loop (with 'test -z "$(cat ...)"', no less; there
was no 'test_must_be_empty' back then). Furthermore, the test
redirects the stderr of those 'test_cmp' invocations to this file,
too: while 'test_cmp' itself doesn't output anything to stderr, the
invoked 'diff' or 'cmp' commands do send their error messages there,
e.g. if they can't open a file because its name was misspelled.

This also makes this test fail when the test script is run with '-x'
tracing (and using a shell other than a Bash version supporting
BASH_XTRACEFD), because 'test_cmp's stderr contains the trace of the
'diff' command executed inside the helper function, throwing off the
subsequent emptiness check.

Stop relying on 'test_cmp's output and instead run 'test_cmp a b ||
return 1' in the for loop in order to make 'test_cmp's error code fail
the test. Furthermore, add the missing && after the cvs command to
create a && chain in the loop's body.

After this change t9400 passes with '-x', even when running with
/bin/sh.

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