gitweb.git
Merge branch 'sb/strbuf-h-update'Junio C Hamano Tue, 30 Oct 2018 06:43:41 +0000 (15:43 +0900)

Merge branch 'sb/strbuf-h-update'

Code clean-up to serve as a BCP example.

* sb/strbuf-h-update:
strbuf.h: format according to coding guidelines

Merge branch 'jk/run-command-notdot'Junio C Hamano Tue, 30 Oct 2018 06:43:41 +0000 (15:43 +0900)

Merge branch 'jk/run-command-notdot'

The implementation of run_command() API on the UNIX platforms had a
bug that caused a command not on $PATH to be found in the current
directory.

* jk/run-command-notdot:
run-command: mark path lookup errors with ENOENT

Merge branch 'tb/filter-alternate-refs'Junio C Hamano Tue, 30 Oct 2018 06:43:41 +0000 (15:43 +0900)

Merge branch 'tb/filter-alternate-refs'

Test fix.

* tb/filter-alternate-refs:
t5410: use longer path for sample script
Documentation/config.txt: fix typo in core.alternateRefsCommand

Merge branch 'rv/send-email-cc-misc-by'Junio C Hamano Tue, 30 Oct 2018 06:43:40 +0000 (15:43 +0900)

Merge branch 'rv/send-email-cc-misc-by'

"git send-email" learned to grab address-looking string on any
trailer whose name ends with "-by"; --suppress-cc=misc-by on the
command line, or setting sendemail.suppresscc configuration
variable to "misc-by", can be used to disable this behaviour.

This is a backward-incompatible change that may surprise existing
users.

* rv/send-email-cc-misc-by:
send-email: also pick up cc addresses from -by trailers
send-email: only consider lines containing @ or <> for automatic Cc'ing
Documentation/git-send-email.txt: style fixes

Merge branch 'lm/range-diff-submodule-fix'Junio C Hamano Tue, 30 Oct 2018 06:43:40 +0000 (15:43 +0900)

Merge branch 'lm/range-diff-submodule-fix'

"git range-diff" did not work well when the compared ranges had
changes in submodules and the "--submodule=log" was used.

* lm/range-diff-submodule-fix:
range-diff: allow to diff files regardless of submodule config

Merge branch 'ch/subtree-build'Junio C Hamano Tue, 30 Oct 2018 06:43:39 +0000 (15:43 +0900)

Merge branch 'ch/subtree-build'

Build update for "git subtree" (in contrib/) documentation pages.

* ch/subtree-build:
Revert "subtree: make install targets depend on build targets"
subtree: make install targets depend on build targets
subtree: add build targets 'man' and 'html'

Merge branch 'md/filter-trees'Junio C Hamano Tue, 30 Oct 2018 06:43:39 +0000 (15:43 +0900)

Merge branch 'md/filter-trees'

The "rev-list --filter" feature learned to exclude all trees via
"tree:0" filter.

* md/filter-trees:
list-objects: support for skipping tree traversal
filter-trees: code clean-up of tests
list-objects-filter: implement filter tree:0
list-objects-filter-options: do not over-strbuf_init
list-objects-filter: use BUG rather than die
revision: mark non-user-given objects instead
rev-list: handle missing tree objects properly
list-objects: always parse trees gently
list-objects: refactor to process_tree_contents
list-objects: store common func args in struct

Sixth batch for 2.20Junio C Hamano Fri, 26 Oct 2018 05:53:16 +0000 (14:53 +0900)

Sixth batch for 2.20

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

Merge branch 'js/mingw-default-ident'Junio C Hamano Fri, 26 Oct 2018 05:22:15 +0000 (14:22 +0900)

Merge branch 'js/mingw-default-ident'

The logic to select the default user name and e-mail on Windows has
been improved.

* js/mingw-default-ident:
mingw: use domain information for default email
getpwuid(mingw): provide a better default for the user name
getpwuid(mingw): initialize the structure only once

Merge branch 'ld/p4-unshelve'Junio C Hamano Fri, 26 Oct 2018 05:22:15 +0000 (14:22 +0900)

Merge branch 'ld/p4-unshelve'

"git p4 unshelve" improvements.

* ld/p4-unshelve:
git-p4: fully support unshelving changelists
git-p4: unshelve into refs/remotes/p4-unshelved, not refs/remotes/p4/unshelved
git-p4: do not fail in verbose mode for missing 'fileSize' key

Merge branch 'du/cherry-is-plumbing'Junio C Hamano Fri, 26 Oct 2018 05:22:14 +0000 (14:22 +0900)

Merge branch 'du/cherry-is-plumbing'

Doc update to mark "git cherry" as a plumbing command.

* du/cherry-is-plumbing:
doc: move git-cherry to plumbing

Merge branch 'ab/gc-doc-update'Junio C Hamano Fri, 26 Oct 2018 05:22:14 +0000 (14:22 +0900)

Merge branch 'ab/gc-doc-update'

The documentation of "git gc" has been updated to mention that it
is no longer limited to "pruning away crufts" but also updates
ancillary files like commit-graph as a part of repository
optimization.

* ab/gc-doc-update:
gc doc: mention the commit-graph in the intro

Merge branch 'js/fuzzer'Junio C Hamano Fri, 26 Oct 2018 05:22:13 +0000 (14:22 +0900)

Merge branch 'js/fuzzer'

An experiment to fuzz test a few areas, hopefully we can gain more
coverage to various areas.

* js/fuzzer:
fuzz: add fuzz testing for packfile indices.
fuzz: add basic fuzz testing target.

Merge branch 'rv/alias-help'Junio C Hamano Fri, 26 Oct 2018 05:22:13 +0000 (14:22 +0900)

Merge branch 'rv/alias-help'

"git cmd --help" when "cmd" is aliased used to only say "cmd is
aliased to ...". Now it shows that to the standard error stream
and runs "git $cmd --help" where $cmd is the first word of the
alias expansion.

This could be misleading for those who alias a command with options
(e.g. with "[alias] cpn = cherry-pick -n", "git cpn --help" would
show the manual of "cherry-pick", and the reader would not be told
to pay close attention to the part that describes the "--no-commit"
option until closing the pager that showed the contents of the
manual, if the pager is configured to restore the original screen,
or would not be told at all, if the pager simply makes the message
on the standard error scroll away.

* rv/alias-help:
git-help.txt: document "git help cmd" vs "git cmd --help" for aliases
git.c: handle_alias: prepend alias info when first argument is -h
help: redirect to aliased commands for "git cmd --help"

Merge branch 'sb/diff-emit-line-ws-markup-cleanup'Junio C Hamano Fri, 26 Oct 2018 05:22:13 +0000 (14:22 +0900)

Merge branch 'sb/diff-emit-line-ws-markup-cleanup'

Code clean-up.

* sb/diff-emit-line-ws-markup-cleanup:
diff.c: pass sign_index to emit_line_ws_markup

Merge branch 'du/get-tar-commit-id-is-plumbing'Junio C Hamano Fri, 26 Oct 2018 05:22:12 +0000 (14:22 +0900)

Merge branch 'du/get-tar-commit-id-is-plumbing'

Doc update to mark "git get-tar-commit-id" as a plumbing command.

* du/get-tar-commit-id-is-plumbing:
doc: move git-get-tar-commit-id to plumbing

Merge branch 'mm/doc-no-dashed-git'Junio C Hamano Fri, 26 Oct 2018 05:22:12 +0000 (14:22 +0900)

Merge branch 'mm/doc-no-dashed-git'

Doc update.

* mm/doc-no-dashed-git:
doc: fix a typo and clarify a sentence

Merge branch 'du/rev-parse-is-plumbing'Junio C Hamano Fri, 26 Oct 2018 05:22:11 +0000 (14:22 +0900)

Merge branch 'du/rev-parse-is-plumbing'

Doc update.

* du/rev-parse-is-plumbing:
doc: move git-rev-parse from porcelain to plumbing

Merge branch 'np/log-graph-octopus-fix'Junio C Hamano Fri, 26 Oct 2018 05:22:11 +0000 (14:22 +0900)

Merge branch 'np/log-graph-octopus-fix'

"git log --graph" showing an octopus merge sometimes miscounted the
number of display columns it is consuming to show the merge and its
parent commits, which has been corrected.

* np/log-graph-octopus-fix:
log: fix coloring of certain octopus merge shapes

Merge branch 'sg/split-index-racefix'Junio C Hamano Fri, 26 Oct 2018 05:22:10 +0000 (14:22 +0900)

Merge branch 'sg/split-index-racefix'

The codepath to support the experimental split-index mode had
remaining "racily clean" issues fixed.

* sg/split-index-racefix:
split-index: BUG() when cache entry refers to non-existing shared entry
split-index: smudge and add racily clean cache entries to split index
split-index: don't compare cached data of entries already marked for split index
split-index: count the number of deleted entries
t1700-split-index: date back files to avoid racy situations
split-index: add tests to demonstrate the racy split index problem
t1700-split-index: document why FSMONITOR is disabled in this test script

Merge branch 'ds/coverage-diff'Junio C Hamano Fri, 26 Oct 2018 05:22:10 +0000 (14:22 +0900)

Merge branch 'ds/coverage-diff'

The result of coverage test can be combined with "git blame" to
check the test coverage of code introduced recently with a new
'coverage-diff' tool (in contrib/).

* ds/coverage-diff:
contrib: add coverage-diff script

Merge branch 'bc/editorconfig'Junio C Hamano Fri, 26 Oct 2018 05:22:09 +0000 (14:22 +0900)

Merge branch 'bc/editorconfig'

To help developers, an EditorConfig file that attempts to follow
the project convention has been added.

* bc/editorconfig:
editorconfig: indicate settings should be kept in sync
editorconfig: provide editor settings for Git developers

Merge branch 'ma/t7005-bash-workaround'Junio C Hamano Fri, 26 Oct 2018 05:22:09 +0000 (14:22 +0900)

Merge branch 'ma/t7005-bash-workaround'

Test fix.

* ma/t7005-bash-workaround:
t7005-editor: quote filename to fix whitespace-issue

Merge branch 'rs/subtree-fixes'Junio C Hamano Fri, 26 Oct 2018 05:22:08 +0000 (14:22 +0900)

Merge branch 'rs/subtree-fixes'

Various subtree fixes.

* rs/subtree-fixes:
subtree: performance improvement for finding unexpected parent commits
subtree: improve decision on merges kept in split
subtree: use commits before rejoins for splits
subtree: make --ignore-joins pay attention to adds
subtree: refactor split of a commit into standalone method

range-diff: allow to diff files regardless of submodule... Lucas De Marchi Wed, 24 Oct 2018 19:46:17 +0000 (12:46 -0700)

range-diff: allow to diff files regardless of submodule config

If we have `submodule.diff = log' in the configuration file
or `--submodule=log' is given as argument, range-diff fails
to compare both diffs and we only get the following output:

Submodule a 0000000...0000000 (new submodule)

Even if the repository doesn't have any submodule.

That's because the mode in diff_filespec is not correct and when
flushing the diff, down in builtin_diff() we will enter the condition:

if (o->submodule_format == DIFF_SUBMODULE_LOG &&
(!one->mode || S_ISGITLINK(one->mode)) &&
(!two->mode || S_ISGITLINK(two->mode))) {
show_submodule_summary(o, one->path ? one->path : two->path,
&one->oid, &two->oid,
two->dirty_submodule);
return;

It turns out that S_ISGITLINK will return true (mode == 0160000 here).
Similar thing happens if submodule.diff is "diff".

Do like it's done in grep.c when calling fill_filespec() and force it to
be recognized as a file by adding S_IFREG to the mode.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5410: use longer path for sample scriptJeff King Wed, 24 Oct 2018 07:37:06 +0000 (03:37 -0400)

t5410: use longer path for sample script

t5410 creates a sample script "alternate-refs", and sets
core.alternateRefsCommand to just "alternate-refs". That
shouldn't work, as "." is not in our $PATH, and so we should
not find it.

However, due to a bug in run-command.c, we sometimes find it
anyway! Even more confusing, this bug is only in the
fork-based version of run-command. So the test passes on
Linux (etc), but fails on Windows.

In preparation for fixing the run-command bug, let's use a
more complete path here.

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

t0061: adjust to test-tool transitionJunio C Hamano Thu, 25 Oct 2018 02:41:09 +0000 (11:41 +0900)

t0061: adjust to test-tool transition

run-command: mark path lookup errors with ENOENTJeff King Wed, 24 Oct 2018 07:38:00 +0000 (03:38 -0400)

run-command: mark path lookup errors with ENOENT

Since commit e3a434468f (run-command: use the
async-signal-safe execv instead of execvp, 2017-04-19),
prepare_cmd() does its own PATH lookup for any commands we
run (on non-Windows platforms).

However, its logic does not match the old execvp call when
we fail to find a matching entry in the PATH. Instead of
feeding the name directly to execv, execvp would consider
that an ENOENT error. By continuing and passing the name
directly to execv, we effectively behave as if "." was
included at the end of the PATH. This can have confusing and
even dangerous results.

The fix itself is pretty straight-forward. There's a new
test in t0061 to cover this explicitly, and I've also added
a duplicate of the ENOENT test to ensure that we return the
correct errno for this case.

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

Documentation/config.txt: fix typo in core.alternateRef... Taylor Blau Tue, 23 Oct 2018 01:32:04 +0000 (18:32 -0700)

Documentation/config.txt: fix typo in core.alternateRefsCommand

In [1] Git learned about 'core.alternateRefsCommand', and with it, the
accompanying documentation. However, this documentation included a typo
involving the verb tense of "produced".

Match the tense of the surrounding bits by correcting this typo.

[1]: 89284c1d6c (transport.c: introduce core.alternateRefsCommand,
2018-10-08)

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fifth batch for 2.20Junio C Hamano Fri, 19 Oct 2018 04:52:51 +0000 (13:52 +0900)

Fifth batch for 2.20

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

Merge branch 'jt/cache-tree-allow-missing-object-in... Junio C Hamano Fri, 19 Oct 2018 04:34:08 +0000 (13:34 +0900)

Merge branch 'jt/cache-tree-allow-missing-object-in-partial-clone'

In a partial clone that will lazily be hydrated from the
originating repository, we generally want to avoid "does this
object exist (locally)?" on objects that we deliberately omitted
when we created the clone. The cache-tree codepath (which is used
to write a tree object out of the index) however insisted that the
object exists, even for paths that are outside of the partial
checkout area. The code has been updated to avoid such a check.

* jt/cache-tree-allow-missing-object-in-partial-clone:
cache-tree: skip some blob checks in partial clone

Merge branch 'tb/filter-alternate-refs'Junio C Hamano Fri, 19 Oct 2018 04:34:08 +0000 (13:34 +0900)

Merge branch 'tb/filter-alternate-refs'

When pushing into a repository that borrows its objects from an
alternate object store, "git receive-pack" that responds to the
push request on the other side lists the tips of refs in the
alternate to reduce the amount of objects transferred. This
sometimes is detrimental when the number of refs in the alternate
is absurdly large, in which case the bandwidth saved in potentially
fewer objects transferred is wasted in excessively large ref
advertisement. The alternate refs that are advertised are now
configurable with a pair of configuration variables.

* tb/filter-alternate-refs:
transport.c: introduce core.alternateRefsPrefixes
transport.c: introduce core.alternateRefsCommand
transport.c: extract 'fill_alternate_refs_command'
transport: drop refnames from for_each_alternate_ref

Merge branch 'jt/avoid-ls-refs'Junio C Hamano Fri, 19 Oct 2018 04:34:07 +0000 (13:34 +0900)

Merge branch 'jt/avoid-ls-refs'

Over some transports, fetching objects with an exact commit object
name can be done without first seeing the ref advertisements. The
code has been optimized to exploit this.

* jt/avoid-ls-refs:
fetch: do not list refs if fetching only hashes
transport: list refs before fetch if necessary
transport: do not list refs if possible
transport: allow skipping of ref listing

Merge branch 'ds/commit-graph-leakfix'Junio C Hamano Fri, 19 Oct 2018 04:34:07 +0000 (13:34 +0900)

Merge branch 'ds/commit-graph-leakfix'

Code clean-up.

* ds/commit-graph-leakfix:
commit-graph: reduce initial oid allocation
builtin/commit-graph.c: UNLEAK variables
commit-graph: clean up leaked memory during write

Merge branch 'jt/non-blob-lazy-fetch'Junio C Hamano Fri, 19 Oct 2018 04:34:07 +0000 (13:34 +0900)

Merge branch 'jt/non-blob-lazy-fetch'

A partial clone that is configured to lazily fetch missing objects
will on-demand issue a "git fetch" request to the originating
repository to fill not-yet-obtained objects. The request has been
optimized for requesting a tree object (and not the leaf blob
objects contained in it) by telling the originating repository that
no blobs are needed.

* jt/non-blob-lazy-fetch:
fetch-pack: exclude blobs when lazy-fetching trees
fetch-pack: avoid object flags if no_dependents

Merge branch 'pw/diff-color-moved-ws-fix'Junio C Hamano Fri, 19 Oct 2018 04:34:06 +0000 (13:34 +0900)

Merge branch 'pw/diff-color-moved-ws-fix'

Various fixes to "diff --color-moved-ws".

* pw/diff-color-moved-ws-fix:
diff --color-moved: fix a memory leak
diff --color-moved-ws: fix another memory leak
diff --color-moved-ws: fix a memory leak
diff --color-moved-ws: fix out of bounds string access
diff --color-moved-ws: fix double free crash

Merge branch 'rs/oidset-on-khash'Junio C Hamano Fri, 19 Oct 2018 04:34:06 +0000 (13:34 +0900)

Merge branch 'rs/oidset-on-khash'

The oidset API was built on top of the oidmap API which in turn is
on the hashmap API. Replace the implementation to build on top of
the khash API and gain performance.

* rs/oidset-on-khash:
oidset: uninline oidset_init()
oidset: use khash
khash: factor out kh_release_*
fetch-pack: load tip_oids eagerly iff needed
fetch-pack: factor out is_unmatched_ref()

Merge branch 'rs/grep-no-recursive'Junio C Hamano Fri, 19 Oct 2018 04:34:05 +0000 (13:34 +0900)

Merge branch 'rs/grep-no-recursive'

Unlike "grep", "git grep" by default recurses to the whole tree.
The command learned "git grep --recursive" option, so that "git
grep --no-recursive" can serve as a synonym to setting the
max-depth to 0.

* rs/grep-no-recursive:
grep: add -r/--[no-]recursive

Merge branch 'nd/help-commands-verbose-by-default'Junio C Hamano Fri, 19 Oct 2018 04:34:05 +0000 (13:34 +0900)

Merge branch 'nd/help-commands-verbose-by-default'

"git help -a" and "git help -av" give different pieces of
information, and generally the "verbose" version is more friendly
to the new users. "git help -a" by default now uses the more
verbose output (with "--no-verbose", you can go back to the
original). Also "git help -av" now lists aliases and external
commands, which it did not used to.

* nd/help-commands-verbose-by-default:
help -a: improve and make --verbose default

Merge branch 'jc/how-to-document-api'Junio C Hamano Fri, 19 Oct 2018 04:34:05 +0000 (13:34 +0900)

Merge branch 'jc/how-to-document-api'

Doc update.

* jc/how-to-document-api:
CodingGuidelines: document the API in *.h files

Merge branch 'sm/show-superproject-while-conflicted'Junio C Hamano Fri, 19 Oct 2018 04:34:04 +0000 (13:34 +0900)

Merge branch 'sm/show-superproject-while-conflicted'

A corner-case bugfix.

* sm/show-superproject-while-conflicted:
rev-parse: --show-superproject-working-tree should work during a merge

Merge branch 'jt/fetch-tips-in-partial-clone'Junio C Hamano Fri, 19 Oct 2018 04:34:04 +0000 (13:34 +0900)

Merge branch 'jt/fetch-tips-in-partial-clone'

"git fetch $repo $object" in a partial clone did not correctly
fetch the asked-for object that is referenced by an object in
promisor packfile, which has been fixed.

* jt/fetch-tips-in-partial-clone:
fetch: in partial clone, check presence of targets
connected: document connectivity in partial clones

Merge branch 'nd/status-refresh-progress'Junio C Hamano Fri, 19 Oct 2018 04:34:03 +0000 (13:34 +0900)

Merge branch 'nd/status-refresh-progress'

"git status" learns to show progress bar when refreshing the index
takes a long time.

* nd/status-refresh-progress:
status: show progress bar if refreshing the index takes too long

Merge branch 'bp/read-cache-parallel'Junio C Hamano Fri, 19 Oct 2018 04:34:03 +0000 (13:34 +0900)

Merge branch 'bp/read-cache-parallel'

A new extension to the index file has been introduced, which allows
the file to be read in parallel.

* bp/read-cache-parallel:
read-cache: load cache entries on worker threads
ieot: add Index Entry Offset Table (IEOT) extension
read-cache: load cache extensions on a worker thread
config: add new index.threads config setting
eoie: add End of Index Entry (EOIE) extension
read-cache: clean up casting and byte decoding
read-cache.c: optimize reading index format v4

Merge branch 'bp/rename-test-env-var'Junio C Hamano Fri, 19 Oct 2018 04:34:03 +0000 (13:34 +0900)

Merge branch 'bp/rename-test-env-var'

Some environment variables that control the runtime options of Git
used during tests are getting renamed for consistency.

* bp/rename-test-env-var:
t0000: do not get self-test disrupted by environment warnings
preload-index: update GIT_FORCE_PRELOAD_TEST support
read-cache: update TEST_GIT_INDEX_VERSION support
fsmonitor: update GIT_TEST_FSMONITOR support
preload-index: use git_env_bool() not getenv() for customization
t/README: correct spelling of "uncommon"

Merge branch 'ss/wt-status-committable'Junio C Hamano Fri, 19 Oct 2018 04:34:02 +0000 (13:34 +0900)

Merge branch 'ss/wt-status-committable'

Code clean-up in the internal machinery used by "git status" and
"git commit --dry-run".

* ss/wt-status-committable:
roll wt_status_state into wt_status and populate in the collect phase
wt-status.c: set the committable flag in the collect phase
t7501: add test of "commit --dry-run --short"
wt-status: rename commitable to committable
wt-status.c: move has_unmerged earlier in the file

Merge branch 'nd/the-index'Junio C Hamano Fri, 19 Oct 2018 04:34:02 +0000 (13:34 +0900)

Merge branch 'nd/the-index'

Various codepaths in the core-ish part learn to work on an
arbitrary in-core index structure, not necessarily the default
instance "the_index".

* nd/the-index: (23 commits)
revision.c: reduce implicit dependency the_repository
revision.c: remove implicit dependency on the_index
ws.c: remove implicit dependency on the_index
tree-diff.c: remove implicit dependency on the_index
submodule.c: remove implicit dependency on the_index
line-range.c: remove implicit dependency on the_index
userdiff.c: remove implicit dependency on the_index
rerere.c: remove implicit dependency on the_index
sha1-file.c: remove implicit dependency on the_index
patch-ids.c: remove implicit dependency on the_index
merge.c: remove implicit dependency on the_index
merge-blobs.c: remove implicit dependency on the_index
ll-merge.c: remove implicit dependency on the_index
diff-lib.c: remove implicit dependency on the_index
read-cache.c: remove implicit dependency on the_index
diff.c: remove implicit dependency on the_index
grep.c: remove implicit dependency on the_index
diff.c: remove the_index dependency in textconv() functions
blame.c: rename "repo" argument to "r"
combine-diff.c: remove implicit dependency on the_index
...

Merge branch 'nd/complete-fetch-multiple-args'Junio C Hamano Fri, 19 Oct 2018 04:34:01 +0000 (13:34 +0900)

Merge branch 'nd/complete-fetch-multiple-args'

Teach bash completion that "git fetch --multiple" only takes remote
names as arguments and no refspecs.

* nd/complete-fetch-multiple-args:
completion: support "git fetch --multiple"

list-objects: support for skipping tree traversalMatthew DeVore Thu, 18 Oct 2018 00:39:15 +0000 (17:39 -0700)

list-objects: support for skipping tree traversal

The tree:0 filter does not need to traverse the trees that it has
filtered out, so optimize list-objects and list-objects-filter to skip
traversing the trees entirely. Before this patch, we iterated over all
children of the tree, and did nothing for all of them, which was
wasteful.

Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Revert "subtree: make install targets depend on build... Junio C Hamano Thu, 18 Oct 2018 02:07:17 +0000 (11:07 +0900)

Revert "subtree: make install targets depend on build targets"

This reverts commit 744f7c4c314dc0e7816ac05520e8358c8318187a.

These targets do depend on the fact that each prereq is explicitly
listed via their use of $^, which I failed to notice, and broke the
build.

subtree: make install targets depend on build targetsChristian Hesse Tue, 16 Oct 2018 07:56:24 +0000 (09:56 +0200)

subtree: make install targets depend on build targets

Now that we have build targets let the install targets depend on them.
Also make the targets phony.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: also pick up cc addresses from -by trailersRasmus Villemoes Tue, 16 Oct 2018 07:39:23 +0000 (09:39 +0200)

send-email: also pick up cc addresses from -by trailers

When rerolling a patch series, including various Reviewed-by etc. that
may have come in, it is quite convenient to have git-send-email
automatically cc those people.

So pick up any *-by lines, with a new suppression category 'misc-by',
but special-case Signed-off-by, since that already has its own
suppression category. It seems natural to make 'misc-by' implied by
'body'.

Based-on-patch-by: Joe Perches <joe@perches.com>
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fourth batch for 2.20Junio C Hamano Tue, 16 Oct 2018 07:21:17 +0000 (16:21 +0900)

Fourth batch for 2.20

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

Merge branch 'sf/complete-stash-list'Junio C Hamano Tue, 16 Oct 2018 07:16:09 +0000 (16:16 +0900)

Merge branch 'sf/complete-stash-list'

The completion script (in contrib/) learned to complete a handful of
options "git stash list" command takes.

* sf/complete-stash-list:
git-completion.bash: add completion for stash list

Merge branch 'mw/doc-typofixes'Junio C Hamano Tue, 16 Oct 2018 07:16:09 +0000 (16:16 +0900)

Merge branch 'mw/doc-typofixes'

Typofixes.

* mw/doc-typofixes:
docs: typo: s/isimilar/similar/
docs: graph: remove unnecessary `graph_update()' call
docs: typo: s/go/to/

Merge branch 'js/mingw-wants-vista-or-above'Junio C Hamano Tue, 16 Oct 2018 07:16:08 +0000 (16:16 +0900)

Merge branch 'js/mingw-wants-vista-or-above'

The minimum version of Windows supported by Windows port fo Git is
now set to Vista.

* js/mingw-wants-vista-or-above:
mingw: bump the minimum Windows version to Vista
mingw: set _WIN32_WINNT explicitly for Git for Windows
compat/poll: prepare for targeting Windows Vista

Merge branch 'rs/sequencer-oidset-insert-avoids-dups'Junio C Hamano Tue, 16 Oct 2018 07:16:08 +0000 (16:16 +0900)

Merge branch 'rs/sequencer-oidset-insert-avoids-dups'

Code clean-up.

* rs/sequencer-oidset-insert-avoids-dups:
sequencer: use return value of oidset_insert()

Merge branch 'jk/oideq-hasheq-cleanup'Junio C Hamano Tue, 16 Oct 2018 07:16:07 +0000 (16:16 +0900)

Merge branch 'jk/oideq-hasheq-cleanup'

Code clean-up.

* jk/oideq-hasheq-cleanup:
more oideq/hasheq conversions

Merge branch 'ma/mailing-list-address-in-git-help'Junio C Hamano Tue, 16 Oct 2018 07:16:07 +0000 (16:16 +0900)

Merge branch 'ma/mailing-list-address-in-git-help'

Doc update.

* ma/mailing-list-address-in-git-help:
git doc: direct bug reporters to mailing list archive

Merge branch 'nd/packobjectshook-doc-fix'Junio C Hamano Tue, 16 Oct 2018 07:16:07 +0000 (16:16 +0900)

Merge branch 'nd/packobjectshook-doc-fix'

Doc update.

* nd/packobjectshook-doc-fix:
config.txt: correct the note about uploadpack.packObjectsHook

Merge branch 'rt/rebase-typofix'Junio C Hamano Tue, 16 Oct 2018 07:16:06 +0000 (16:16 +0900)

Merge branch 'rt/rebase-typofix'

Typofix.

* rt/rebase-typofix:
git-rebase.sh: fix typos in error messages

Merge branch 'ma/t1400-undebug-test'Junio C Hamano Tue, 16 Oct 2018 07:16:06 +0000 (16:16 +0900)

Merge branch 'ma/t1400-undebug-test'

Test fix.

* ma/t1400-undebug-test:
t1400: drop debug `echo` to actually execute `test`

Merge branch 'ma/commit-graph-docs'Junio C Hamano Tue, 16 Oct 2018 07:16:05 +0000 (16:16 +0900)

Merge branch 'ma/commit-graph-docs'

Doc update.

* ma/commit-graph-docs:
Doc: refer to the "commit-graph file" with dash
git-commit-graph.txt: refer to "*commit*-graph file"
git-commit-graph.txt: typeset more in monospace
git-commit-graph.txt: fix bullet lists

Merge branch 'dz/credential-doc-url-matching-rules'Junio C Hamano Tue, 16 Oct 2018 07:16:05 +0000 (16:16 +0900)

Merge branch 'dz/credential-doc-url-matching-rules'

Doc update.

* dz/credential-doc-url-matching-rules:
doc: clarify gitcredentials path component matching

Merge branch 'en/status-multiple-renames-to-the-same... Junio C Hamano Tue, 16 Oct 2018 07:16:05 +0000 (16:16 +0900)

Merge branch 'en/status-multiple-renames-to-the-same-target-fix'

The code in "git status" sometimes hit an assertion failure. This
was caused by a structure that was reused without cleaning the data
used for the first run, which has been corrected.

* en/status-multiple-renames-to-the-same-target-fix:
commit: fix erroneous BUG, 'multiple renames on the same target? how?'

Merge branch 'ds/reachable-final-cleanup'Junio C Hamano Tue, 16 Oct 2018 07:16:04 +0000 (16:16 +0900)

Merge branch 'ds/reachable-final-cleanup'

Code already in 'master' is further cleaned-up by this patch.

* ds/reachable-final-cleanup:
commit-reach: cleanups in can_all_from_reach...

Merge branch 'jk/check-everything-connected-is-long... Junio C Hamano Tue, 16 Oct 2018 07:16:04 +0000 (16:16 +0900)

Merge branch 'jk/check-everything-connected-is-long-gone'

Comment fix.

* jk/check-everything-connected-is-long-gone:
receive-pack: update comment with check_everything_connected

Merge branch 'jn/gc-auto'Junio C Hamano Tue, 16 Oct 2018 07:16:02 +0000 (16:16 +0900)

Merge branch 'jn/gc-auto'

"gc --auto" ended up calling exit(-1) upon error, which has been
corrected to use exit(1). Also the error reporting behaviour when
daemonized has been updated to exit with zero status when stopping
due to a previously discovered error (which implies there is no
point running gc to improve the situation); we used to exit with
failure in such a case.

* jn/gc-auto:
gc: do not return error for prior errors in daemonized mode

Merge branch 'jn/gc-auto-prep'Junio C Hamano Tue, 16 Oct 2018 07:16:02 +0000 (16:16 +0900)

Merge branch 'jn/gc-auto-prep'

Code clean-up.

* jn/gc-auto-prep:
gc: exit with status 128 on failure
gc: improve handling of errors reading gc.log

Merge branch 'md/test-cleanup'Junio C Hamano Tue, 16 Oct 2018 07:16:01 +0000 (16:16 +0900)

Merge branch 'md/test-cleanup'

Various test scripts have been updated for style and also correct
handling of exit status of various commands.

* md/test-cleanup:
tests: order arguments to git-rev-list properly
t9109: don't swallow Git errors upstream of pipes
tests: don't swallow Git errors upstream of pipes
t/*: fix ordering of expected/observed arguments
tests: standardize pipe placement
Documentation: add shell guidelines
t/README: reformat Do, Don't, Keep in mind lists

Merge branch 'fe/doc-updates'Junio C Hamano Tue, 16 Oct 2018 07:16:01 +0000 (16:16 +0900)

Merge branch 'fe/doc-updates'

Doc updates.

* fe/doc-updates:
git-describe.1: clarify that "human readable" is also git-readable
git-column.1: clarify initial description, provide examples
git-archimport.1: specify what kind of Arch we're talking about

Merge branch 'jn/mailmap-update'Junio C Hamano Tue, 16 Oct 2018 07:16:01 +0000 (16:16 +0900)

Merge branch 'jn/mailmap-update'

The mailmap file update.

* jn/mailmap-update:
mailmap: consistently normalize brian m. carlson's name

Merge branch 'tg/t5551-with-curl-7.61.1'Junio C Hamano Tue, 16 Oct 2018 07:16:00 +0000 (16:16 +0900)

Merge branch 'tg/t5551-with-curl-7.61.1'

Test update.

* tg/t5551-with-curl-7.61.1:
t5551: compare sorted cookies files
t5551: move setup code inside test_expect blocks

Merge branch 'en/merge-cleanup'Junio C Hamano Tue, 16 Oct 2018 07:16:00 +0000 (16:16 +0900)

Merge branch 'en/merge-cleanup'

Code clean-up.

* en/merge-cleanup:
merge-recursive: rename merge_file_1() and merge_content()
merge-recursive: remove final remaining caller of merge_file_one()
merge-recursive: avoid wrapper function when unnecessary and wasteful
merge-recursive: set paths correctly when three-way merging content

Merge branch 'rj/header-check'Junio C Hamano Tue, 16 Oct 2018 07:16:00 +0000 (16:16 +0900)

Merge branch 'rj/header-check'

Header files clean-up.

* rj/header-check:
delta-islands.h: add missing forward declarations (hdr-check)
midx.h: add missing forward declarations (hdr-check)
refs/refs-internal.h: add missing declarations (hdr-check)
refs/packed-backend.h: add missing declaration (hdr-check)
refs/ref-cache.h: add missing declarations (hdr-check)
ewah/ewok_rlw.h: add missing include (hdr-check)
json-writer.h: add missing include (hdr-check)
Makefile: add a hdr-check target

Merge branch 'ma/config-doc-update'Junio C Hamano Tue, 16 Oct 2018 07:16:00 +0000 (16:16 +0900)

Merge branch 'ma/config-doc-update'

Doc update.

* ma/config-doc-update:
git-config.txt: fix 'see: above' note
Doc: use `--type=bool` instead of `--bool`

Merge branch 'jk/delta-islands-with-bitmap-reuse-delta... Junio C Hamano Tue, 16 Oct 2018 07:16:00 +0000 (16:16 +0900)

Merge branch 'jk/delta-islands-with-bitmap-reuse-delta-fix'

Fix interactions between two recent topics.

* jk/delta-islands-with-bitmap-reuse-delta-fix:
pack-objects: handle island check for "external" delta base

Merge branch 'tq/refs-internal-comment-fix'Junio C Hamano Tue, 16 Oct 2018 07:15:59 +0000 (16:15 +0900)

Merge branch 'tq/refs-internal-comment-fix'

Fix for typo in a sample code in comment.

* tq/refs-internal-comment-fix:
refs: docstring typo

Merge branch 'ts/alias-of-alias'Junio C Hamano Tue, 16 Oct 2018 07:15:59 +0000 (16:15 +0900)

Merge branch 'ts/alias-of-alias'

An alias that expands to another alias has so far been forbidden,
but now it is allowed to create such an alias.

* ts/alias-of-alias:
t0014: introduce an alias testing suite
alias: show the call history when an alias is looping
alias: add support for aliases of an alias

Merge branch 'ds/commit-graph-with-grafts'Junio C Hamano Tue, 16 Oct 2018 07:15:59 +0000 (16:15 +0900)

Merge branch 'ds/commit-graph-with-grafts'

The recently introduced commit-graph auxiliary data is incompatible
with mechanisms such as replace & grafts that "breaks" immutable
nature of the object reference relationship. Disable optimizations
based on its use (and updating existing commit-graph) when these
incompatible features are in use in the repository.

* ds/commit-graph-with-grafts:
commit-graph: close_commit_graph before shallow walk
commit-graph: not compatible with uninitialized repo
commit-graph: not compatible with grafts
commit-graph: not compatible with replace objects
test-repository: properly init repo
commit-graph: update design document
refs.c: upgrade for_each_replace_ref to be a each_repo_ref_fn callback
refs.c: migrate internal ref iteration to pass thru repository argument

Merge branch 'ab/commit-graph-progress'Junio C Hamano Tue, 16 Oct 2018 07:15:58 +0000 (16:15 +0900)

Merge branch 'ab/commit-graph-progress'

Generation of (experimental) commit-graph files have so far been
fairly silent, even though it takes noticeable amount of time in a
meaningfully large repository. The users will now see progress
output.

* ab/commit-graph-progress:
gc: fix regression in 7b0f229222 impacting --quiet
commit-graph verify: add progress output
commit-graph write: add progress output

git-p4: fully support unshelving changelistsLuke Diamand Mon, 15 Oct 2018 11:14:08 +0000 (12:14 +0100)

git-p4: fully support unshelving changelists

The previous git-p4 unshelve support would check for changes
in Perforce to the files being unshelved since the original
shelve, and would complain if any were found.

This was to ensure that the user wouldn't end up with both the
shelved change delta, and some deltas from other changes in their
git commit.

e.g. given fileA:
the
quick
brown
fox

change1: s/the/The/ <- p4 shelve this change
change2: s/fox/Fox/ <- p4 submit this change
git p4 unshelve 1 <- FAIL

This change teaches the P4Unshelve class to always create a parent
commit which matches the P4 tree (for the files being unshelved) at
the point prior to the P4 shelve being created (which is reported
in the p4 description for a shelved changelist).

That then means git-p4 can always create a git commit matching the
P4 shelve that was originally created, without any extra deltas.

The user might still need to use the --origin option though - there
is no way for git-p4 to work out the versions of all of the other
*unchanged* files in the shelve, since this information is not recorded
by Perforce.

Additionally this fixes handling of shelved 'move' operations.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: unshelve into refs/remotes/p4-unshelved, not... Luke Diamand Mon, 15 Oct 2018 11:14:07 +0000 (12:14 +0100)

git-p4: unshelve into refs/remotes/p4-unshelved, not refs/remotes/p4/unshelved

The branch detection code looks for branches under refs/remotes/p4/...
and can end up getting confused if there are unshelved changes in
there as well. This happens in the function p4BranchesInGit().

Instead, put the unshelved changes into refs/remotes/p4-unshelved/<N>.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: use domain information for default emailJohannes Schindelin Mon, 15 Oct 2018 09:47:08 +0000 (02:47 -0700)

mingw: use domain information for default email

When a user is registered in a Windows domain, it is really easy to
obtain the email address. So let's do that.

Suggested by Lutz Roeder.

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

getpwuid(mingw): provide a better default for the user... Johannes Schindelin Mon, 15 Oct 2018 09:47:06 +0000 (02:47 -0700)

getpwuid(mingw): provide a better default for the user name

We do have the excellent GetUserInfoEx() function to obtain more
detailed information of the current user (if the user is part of a
Windows domain); Let's use it.

Suggested by Lutz Roeder.

To avoid the cost of loading Secur32.dll (even lazily, loading DLLs
takes a non-neglibile amount of time), we use the established technique
to load DLLs only when, and if, needed.

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

getpwuid(mingw): initialize the structure only onceJohannes Schindelin Mon, 15 Oct 2018 09:47:05 +0000 (02:47 -0700)

getpwuid(mingw): initialize the structure only once

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

fuzz: add fuzz testing for packfile indices.Josh Steadmon Sat, 13 Oct 2018 00:58:41 +0000 (17:58 -0700)

fuzz: add fuzz testing for packfile indices.

Breaks the majority of check_packed_git_idx() into a separate function,
load_idx(). The latter function operates on arbitrary buffers, which
makes it suitable as a fuzzing test target.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fuzz: add basic fuzz testing target.Josh Steadmon Sat, 13 Oct 2018 00:58:40 +0000 (17:58 -0700)

fuzz: add basic fuzz testing target.

fuzz-pack-headers.c provides a fuzzing entry point compatible with
libFuzzer (and possibly other fuzzing engines).

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

filter-trees: code clean-up of testsMatthew DeVore Fri, 12 Oct 2018 20:01:41 +0000 (13:01 -0700)

filter-trees: code clean-up of tests

A few trivial updates to test to match the current best practices.

- avoid "grep -q" that strips potentially useful output from tests
running under "-v".

- use test_write_lines to prepare multi-line expected output file.

- reserve use of test_must_fail to "git" commands.

Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

subtree: performance improvement for finding unexpected... Roger Strain Fri, 12 Oct 2018 13:52:18 +0000 (08:52 -0500)

subtree: performance improvement for finding unexpected parent commits

After testing a previous patch at larger scale, a performance issue was
detected when using git show to locate parent revisions, with a single
run of the git show command taking 2 seconds or longer in a complex repo.
When the command is required tens or hundreds of times in a run of the
script, the additional wait time is unaccepatable. Replacing the command
with git rev-parse resulted in significantly increased performance, with
the command in question returning instantly.

Signed-off-by: Roger Strain <rstrain@swri.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff.c: pass sign_index to emit_line_ws_markupStefan Beller Wed, 10 Oct 2018 23:24:59 +0000 (16:24 -0700)

diff.c: pass sign_index to emit_line_ws_markup

Instead of passing the sign directly to emit_line_ws_markup, pass only the
index to lookup the sign in diff_options->output_indicators.

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

git-p4: do not fail in verbose mode for missing 'fileSi... Luke Diamand Fri, 12 Oct 2018 05:28:31 +0000 (06:28 +0100)

git-p4: do not fail in verbose mode for missing 'fileSize' key

If deleting or moving a file, sometimes P4 doesn't report the file size.

The code handles this just fine but some logging crashes. Stop this
happening.

There was some earlier discussion on the list about this:

https://public-inbox.org/git/xmqq1sqpp1vv.fsf@gitster.mtv.corp.google.com/

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log: fix coloring of certain octopus merge shapesNoam Postavsky Sun, 2 Sep 2018 00:07:16 +0000 (20:07 -0400)

log: fix coloring of certain octopus merge shapes

For octopus merges where the first parent edge immediately merges into
the next column to the left, the number of columns should be one less
than the usual case.

First parent to the left case:

| *-.
| |\ \
|/ / /

The usual case:

| *-.
| |\ \
| | | *

Also refactor the code to iterate over columns rather than dashes,
building from an initial patch suggested by Jeff King.

Signed-off-by: Noam Postavsky <npostavs@users.sourceforge.net>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: move git-cherry to plumbingDaniels Umanovskis Thu, 11 Oct 2018 18:33:50 +0000 (20:33 +0200)

doc: move git-cherry to plumbing

Also remove git-cherry from Bash completion because plumbing
commands do not belong there.

Signed-off-by: Daniels Umanovskis <daniels@umanovskis.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: move git-get-tar-commit-id to plumbingDaniels Umanovskis Thu, 11 Oct 2018 18:39:32 +0000 (20:39 +0200)

doc: move git-get-tar-commit-id to plumbing

This is definitely a low-level command, it's hard to argue
against it belonging in plumbing.

Signed-off-by: Daniels Umanovskis <daniels@umanovskis.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

split-index: BUG() when cache entry refers to non-exist... SZEDER Gábor Thu, 11 Oct 2018 09:53:57 +0000 (11:53 +0200)

split-index: BUG() when cache entry refers to non-existing shared entry

When the split index feature is in use, then a cache entry is:

- either only present in the split index, in which case its 'index'
field must be 0,

- or it should refer to an existing entry in the shared index, i.e.
the 'index' field can't be greater than the size of the shared
index.

If a cache entry were to refer to a non-existing entry in the shared
index, then that's a sign of something being wrong in the index state,
either as a result of a bug in dealing with the split/shared index
entries, or perhaps a (potentially unrelated) memory corruption issue.

prepare_to_write_split_index() already has a condition to catch cache
entries with such bogus 'index' field, but instead of calling BUG() it
just sets cache entry's 'index = 0', and the entry will then be
written to the new split index.

Don't write a new index file from bogus index state, and call BUG()
upon encountering an cache entry referring to a non-existing shared
index entry.

Running the test suite repeatedly with 'GIT_TEST_SPLIT_INDEX=yes'
doesn't trigger this condition.

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

split-index: smudge and add racily clean cache entries... SZEDER Gábor Thu, 11 Oct 2018 09:43:09 +0000 (11:43 +0200)

split-index: smudge and add racily clean cache entries to split index

Ever since the split index feature was introduced [1], refreshing a
split index is prone to a variant of the classic racy git problem.

Consider the following sequence of commands updating the split index
when the shared index contains a racily clean cache entry, i.e. an
entry whose cached stat data matches with the corresponding file in
the worktree and the cached mtime matches that of the index:

echo "cached content" >file
git update-index --split-index --add file
echo "dirty worktree" >file # size stays the same!
# ... wait ...
git update-index --add other-file

Normally, when a non-split index is updated, then do_write_index()
(the function responsible for writing all kinds of indexes, "regular",
split, and shared) recognizes racily clean cache entries, and writes
them with smudged stat data, i.e. with file size set to 0. When
subsequent git commands read the index, they will notice that the
smudged stat data doesn't match with the file in the worktree, and
then go on to check the file's content and notice its dirtiness.

In the above example, however, in the second 'git update-index'
prepare_to_write_split_index() decides which cache entries stored only
in the shared index should be replaced in the new split index. Alas,
this function never looks out for racily clean cache entries, and
since the file's stat data in the worktree hasn't changed since the
shared index was written, it won't be replaced in the new split index.
Consequently, do_write_index() doesn't even get this racily clean
cache entry, and can't smudge its stat data. Subsequent git commands
will then see that the index has more recent mtime than the file and
that the (not smudged) cached stat data still matches with the file in
the worktree, and, ultimately, will erroneously consider the file
clean.

Modify prepare_to_write_split_index() to recognize racily clean cache
entries, and mark them to be added to the split index. Note that
there are two places where it should check raciness: first those cache
entries that are only stored in the shared index, and then those that
have been copied by unpack_trees() from the shared index while it
constructed a new index. This way do_write_index() will get these
racily clean cache entries as well, and will then write them with
smudged stat data to the new split index.

This change makes all tests in 't1701-racy-split-index.sh' pass, so
flip the two 'test_expect_failure' tests to success. Also add the '#'
(as in nr. of trial) to those tests' description that were omitted
when the tests expected failure.

Note that after this change if the index is split when it contains a
racily clean cache entry, then a smudged cache entry will be written
both to the new shared and to the new split indexes. This doesn't
affect regular git commands: as far as they are concerned this is just
an entry in the split index replacing an outdated entry in the shared
index. It did affect a few tests in 't1700-split-index.sh', though,
because they actually check which entries are stored in the split
index; a previous patch in this series has already made the necessary
adjustments in 't1700'. And racily clean cache entries and index
splitting are rare enough to not worry about the resulting duplicated
smudged cache entries, and the additional complexity required to
prevent them is not worth it.

Several tests failed occasionally when the test suite was run with
'GIT_TEST_SPLIT_INDEX=yes'. Here are those that I managed to trace
back to this racy split index problem, starting with those failing
more frequently, with a link to a failing Travis CI build job for
each. The highlighted line [2] shows when the racy file was written,
which is not always in the failing test but in a preceeding setup
test.

t3903-stash.sh:
https://travis-ci.org/git/git/jobs/385542084#L5858

t4024-diff-optimize-common.sh:
https://travis-ci.org/git/git/jobs/386531969#L3174

t4015-diff-whitespace.sh:
https://travis-ci.org/git/git/jobs/360797600#L8215

t2200-add-update.sh:
https://travis-ci.org/git/git/jobs/382543426#L3051

t0090-cache-tree.sh:
https://travis-ci.org/git/git/jobs/416583010#L3679

There might be others, e.g. perhaps 't1000-read-tree-m-3way.sh' and
others using 'lib-read-tree-m-3way.sh', but I couldn't confirm yet.

[1] In the branch leading to the merge commit v2.1.0-rc0~45 (Merge
branch 'nd/split-index', 2014-07-16).

[2] Note that those highlighted lines are in the 'after failure' fold,
and your browser might unhelpfully fold it up before you could
take a good look.

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

split-index: don't compare cached data of entries alrea... SZEDER Gábor Thu, 11 Oct 2018 09:43:08 +0000 (11:43 +0200)

split-index: don't compare cached data of entries already marked for split index

When unpack_trees() constructs a new index, it copies cache entries
from the original index [1]. prepare_to_write_split_index() has to
deal with this, and it has a dedicated code path for copied entries
that are present in the shared index, where it compares the cached
data in the corresponding copied and original entries. If the cached
data matches, then they are considered the same; if it differs, then
the copied entry will be marked for inclusion as a replacement entry
in the just about to be written split index by setting the
CE_UPDATE_IN_BASE flag.

However, a cache entry already has its CE_UPDATE_IN_BASE flag set upon
reading the split index, if the entry already has a replacement entry
there, or upon refreshing the cached stat data, if the corresponding
file was modified. The state of this flag is then preserved when
unpack_trees() copies a cache entry from the shared index.

So modify prepare_to_write_split_index() to check the copied cache
entries' CE_UPDATE_IN_BASE flag first, and skip the thorough
comparison of cached data if the flag is already set. Those couple of
lines comparing the cached data would then have too many levels of
indentation, so extract them into a helper function.

Note that comparing the cached data in copied and original entries in
the shared index might actually be entirely unnecessary. In theory
all code paths refreshing the cached stat data of an entry in the
shared index should set the CE_UPDATE_IN_BASE flag in that entry, and
unpack_trees() should preserve this flag when copying cache entries.
This means that the cached data is only ever changed if the
CE_UPDATE_IN_BASE flag is set as well. Our test suite seems to
confirm this: instrumenting the conditions in question and running the
test suite repeatedly with 'GIT_TEST_SPLIT_INDEX=yes' showed that the
cached data in a copied entry differs from the data in the shared
entry only if its CE_UPDATE_IN_BASE flag is indeed set.

In practice, however, our test suite doesn't have 100% coverage,
GIT_TEST_SPLIT_INDEX is inherently random, and I certainly can't claim
to possess complete understanding of what goes on in unpack_trees()...
Therefore I kept the comparison of the cached data when
CE_UPDATE_IN_BASE is not set, just in case that an unnoticed or future
code path were to accidentally miss setting this flag upon refreshing
the cached stat data or unpack_trees() were to drop this flag while
copying a cache entry.

[1] Note that when unpack_trees() constructs the new index and decides
that a cache entry should now refer to different content than what
was recorded in the original index (e.g. 'git read-tree -m
HEAD^'), then that can't really be considered a copy of the
original, but rather the creation of a new entry. Notably and
pertinent to the split index feature, such a new entry doesn't
have a reference to the original's shared index entry anymore,
i.e. its 'index' field is set to 0. Consequently, such an entry
is treated by prepare_to_write_split_index() as an entry not
present in the shared index and it will be added to the new split
index, while the original entry will be marked as deleted, and
neither the above discussion nor the changes in this patch apply
to them.

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

split-index: count the number of deleted entriesSZEDER Gábor Thu, 11 Oct 2018 09:43:07 +0000 (11:43 +0200)

split-index: count the number of deleted entries

'struct split_index' contains the field 'nr_deletions', whose name
with the 'nr_' prefix suggests that it contains the number of deleted
cache entries. However, barring its initialization to 0, this field
is only ever set to 1, indicating that there is at least one deleted
entry, but not the number of deleted entries. Luckily, this doesn't
cause any issues (other than confusing the reader, that is), because
the only place reading this field uses it in the same sense, i.e.: 'if
(si->nr_deletions)'.

To avoid confusion, we could either rename this field to something
like 'has_deletions' to make its name match its role, or make it a
counter of deleted cache entries to match its name.

Let's make it a counter, to keep it in sync with the related field
'nr_replacements', which does contain the number of replaced cache
entries. This will also give developers debugging the split index
code easy access to the number of deleted cache entries.

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

t1700-split-index: date back files to avoid racy situationsSZEDER Gábor Thu, 11 Oct 2018 09:43:06 +0000 (11:43 +0200)

t1700-split-index: date back files to avoid racy situations

't1700-split-index.sh' checks that the index was split correctly under
various circumstances and that all the different ways to turn the
split index feature on and off work correctly. To do so, most of its
tests use 'test-tool dump-split-index' to see which files have their
cache entries in the split index. All these tests assume that all
cache entries are written to the shared index (called "base"
throughout these tests) when a new shared index is created. This is
an implementation detail: most git commands (basically all except 'git
update-index') don't care or know at all about split index or whether
a cache entry is stored in the split or shared index.

As demonstrated in the previous patch, refreshing a split index is
prone to a variant of the classic racy git issue. The next patch will
fix this issue, but while doing so it will also slightly change this
behaviour: only cache entries with mtime in the past will be written
only to the newly created shared index, but racily clean cache entries
will be written to the new split index (with smudged stat data).

While this upcoming change won't at all affect any git commands, it
will violate the above mentioned assumption of 't1700's tests. Since
these tests create or modify files and create or refresh the split
index in rapid succession, there are plenty of racily clean cache
entries to be dealt with, which will then be written to the new split
indexes, and, ultimately, will cause several tests in 't1700' to fail.

Let's prepare 't1700-split-index.sh' for this upcoming change and
modify its tests to avoid racily clean files by backdating the mtime
of any file modifications (and since a lot of tests create or modify
files, encapsulate it into a helper function).

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