gitweb.git
Merge branch 'jh/memihash-opt'Junio C Hamano Tue, 30 May 2017 02:16:42 +0000 (11:16 +0900)

Merge branch 'jh/memihash-opt'

perf-test update.

* jh/memihash-opt:
p0004: don't error out if test repo is too small
p0004: don't abort if multi-threaded is too slow
p0004: use test_perf
p0004: avoid using pipes
p0004: simplify calls of test-lazy-init-name-hash

Merge branch 'bp/sub-process-convert-filter'Junio C Hamano Tue, 30 May 2017 02:16:42 +0000 (11:16 +0900)

Merge branch 'bp/sub-process-convert-filter'

Code from "conversion using external process" codepath has been
extracted to a separate sub-process.[ch] module.

* bp/sub-process-convert-filter:
convert: update subprocess_read_status() to not die on EOF
sub-process: move sub-process functions into separate files
convert: rename reusable sub-process functions
convert: update generic functions to only use generic data structures
convert: separate generic structures and variables from the filter specific ones
convert: split start_multi_file_filter() into two separate functions
pkt-line: annotate packet_writel with LAST_ARG_MUST_BE_NULL
convert: move packet_write_line() into pkt-line as packet_writel()
pkt-line: add packet_read_line_gently()
pkt-line: fix packet_read_line() to handle len < 0 errors
convert: remove erroneous tests for errno == EPIPE

Merge branch 'bw/forking-and-threading'Junio C Hamano Tue, 30 May 2017 02:16:41 +0000 (11:16 +0900)

Merge branch 'bw/forking-and-threading'

The "run-command" API implementation has been made more robust
against dead-locking in a threaded environment.

* bw/forking-and-threading:
usage.c: drop set_error_handle()
run-command: restrict PATH search to executable files
run-command: expose is_executable function
run-command: block signals between fork and execve
run-command: add note about forking and threading
run-command: handle dup2 and close errors in child
run-command: eliminate calls to error handling functions in child
run-command: don't die in child when duping /dev/null
run-command: prepare child environment before forking
string-list: add string_list_remove function
run-command: use the async-signal-safe execv instead of execvp
run-command: prepare command before forking
t0061: run_command executes scripts without a #! line
t5550: use write_script to generate post-update hook

Merge branch 'ab/perf-wildmatch'Junio C Hamano Tue, 30 May 2017 02:16:40 +0000 (11:16 +0900)

Merge branch 'ab/perf-wildmatch'

Add perf-test for wildmatch.

* ab/perf-wildmatch:
perf: add test showing exponential growth in path globbing
perf: add function to setup a fresh test repo

Merge branch 'bw/pathspec-sans-the-index'Junio C Hamano Tue, 30 May 2017 02:16:40 +0000 (11:16 +0900)

Merge branch 'bw/pathspec-sans-the-index'

Simplify parse_pathspec() codepath and stop it from looking at the
default in-core index.

* bw/pathspec-sans-the-index:
pathspec: convert find_pathspecs_matching_against_index to take an index
pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP
ls-files: prevent prune_cache from overeagerly pruning submodules
pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag
submodule: add die_in_unpopulated_submodule function
pathspec: provide a more descriptive die message

Merge branch 'jc/name-rev-lw-tag'Junio C Hamano Tue, 30 May 2017 02:16:39 +0000 (11:16 +0900)

Merge branch 'jc/name-rev-lw-tag'

"git describe --contains" penalized light-weight tags so much that
they were almost never considered. Instead, give them about the
same chance to be considered as an annotated tag that is the same
age as the underlying commit would.

* jc/name-rev-lw-tag:
name-rev: favor describing with tags and use committer date to tiebreak
name-rev: refactor logic to see if a new candidate is a better name

Third batch for 2.14Junio C Hamano Mon, 29 May 2017 03:39:46 +0000 (12:39 +0900)

Third batch for 2.14

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

Merge branch 'jk/ignore-broken-tags-when-ignoring-missi... Junio C Hamano Mon, 29 May 2017 03:34:54 +0000 (12:34 +0900)

Merge branch 'jk/ignore-broken-tags-when-ignoring-missing-links'

Tag objects, which are not reachable from any ref, that point at
missing objects were mishandled by "git gc" and friends (they
should silently be ignored instead)

* jk/ignore-broken-tags-when-ignoring-missing-links:
revision.c: ignore broken tags with ignore_missing_links

Merge branch 'jk/alternate-ref-optim'Junio C Hamano Mon, 29 May 2017 03:34:53 +0000 (12:34 +0900)

Merge branch 'jk/alternate-ref-optim'

A test allowed both "git push" and "git receive-pack" on the other
end write their traces into the same file. This is OK on platforms
that allows atomically appending to a file opened with O_APPEND,
but on other platforms led to a mangled output, causing
intermittent test failures. This has been fixed by disabling
traces from "receive-pack" in the test.

* jk/alternate-ref-optim:
t5400: avoid concurrent writes into a trace file

Merge branch 'bm/interpret-trailers-cut-line-is-eom'Junio C Hamano Mon, 29 May 2017 03:34:52 +0000 (12:34 +0900)

Merge branch 'bm/interpret-trailers-cut-line-is-eom'

"git interpret-trailers", when used as GIT_EDITOR for "git commit
-v", looked for and appended to a trailer block at the very end,
i.e. at the end of the "diff" output. The command has been
corrected to pay attention to the cut-mark line "commit -v" adds to
the buffer---the real trailer block should appear just before it.

* bm/interpret-trailers-cut-line-is-eom:
interpret-trailers: honor the cut line

Merge branch 'tg/stash-push-fixup'Junio C Hamano Mon, 29 May 2017 03:34:52 +0000 (12:34 +0900)

Merge branch 'tg/stash-push-fixup'

The shell completion script (in contrib/) learned "git stash" has
a new "push" subcommand.

* tg/stash-push-fixup:
completion: add git stash push

Merge branch 'pw/rebase-i-regression-fix'Junio C Hamano Mon, 29 May 2017 03:34:51 +0000 (12:34 +0900)

Merge branch 'pw/rebase-i-regression-fix'

Regression fix to topic recently merged to 'master'.

* pw/rebase-i-regression-fix:
rebase -i: add missing newline to end of message
rebase -i: silence stash apply
rebase -i: fix reflog message

Merge branch 'kn/ref-filter-branch-list'Junio C Hamano Mon, 29 May 2017 03:34:50 +0000 (12:34 +0900)

Merge branch 'kn/ref-filter-branch-list'

"git for-each-ref --format=..." with %(HEAD) in the format used to
resolve the HEAD symref as many times as it had processed refs,
which was wasteful, and "git branch" shared the same problem.

* kn/ref-filter-branch-list:
ref-filter: resolve HEAD when parsing %(HEAD) atom

Merge branch 'km/log-showsignature-doc'Junio C Hamano Mon, 29 May 2017 03:34:49 +0000 (12:34 +0900)

Merge branch 'km/log-showsignature-doc'

* km/log-showsignature-doc:
config.txt: add an entry for log.showSignature

Merge branch 'jk/update-links-in-docs'Junio C Hamano Mon, 29 May 2017 03:34:48 +0000 (12:34 +0900)

Merge branch 'jk/update-links-in-docs'

A few http:// links that are redirected to https:// in the
documentation have been updated to https:// links.

* jk/update-links-in-docs:
doc: use https links to Wikipedia to avoid http redirects

Merge branch 'ja/do-not-ask-needless-questions'Junio C Hamano Mon, 29 May 2017 03:34:48 +0000 (12:34 +0900)

Merge branch 'ja/do-not-ask-needless-questions'

Git sometimes gives an advice in a rhetorical question that does
not require an answer, which can confuse new users and non native
speakers. Attempt to rephrase them.

* ja/do-not-ask-needless-questions:
git-filter-branch: be more direct in an error message
read-tree -m: make error message for merging 0 trees less smart aleck
usability: don't ask questions if no reply is required

Merge branch 'jk/doc-config-include'Junio C Hamano Mon, 29 May 2017 03:34:47 +0000 (12:34 +0900)

Merge branch 'jk/doc-config-include'

Clarify documentation for include.path and includeIf.<condition>.path
configuration variables.

* jk/doc-config-include:
docs/config: consistify include.path examples
docs/config: avoid the term "expand" for includes
docs/config: give a relative includeIf example
docs/config: clarify include/includeIf relationship

Merge branch 'sg/core-filemode-doc-typofix'Junio C Hamano Mon, 29 May 2017 03:34:46 +0000 (12:34 +0900)

Merge branch 'sg/core-filemode-doc-typofix'

* sg/core-filemode-doc-typofix:
docs/config.txt: fix indefinite article in core.fileMode description

Merge branch 'jk/bug-to-abort'Junio C Hamano Mon, 29 May 2017 03:34:45 +0000 (12:34 +0900)

Merge branch 'jk/bug-to-abort'

Introduce the BUG() macro to improve die("BUG: ...").

* jk/bug-to-abort:
usage: add NORETURN to BUG() function definitions
config: complain about --local outside of a git repo
setup_git_env: convert die("BUG") to BUG()
usage.c: add BUG() function

Merge branch 'js/eol-on-ourselves'Junio C Hamano Mon, 29 May 2017 03:34:45 +0000 (12:34 +0900)

Merge branch 'js/eol-on-ourselves'

Make sure our tests would pass when the sources are checked out
with "platform native" line ending convention by default on
Windows. Some "text" files out tests use and the test scripts
themselves that are meant to be run with /bin/sh, ought to be
checked out with eol=LF even on Windows.

* js/eol-on-ourselves:
t4051: mark supporting files as requiring LF-only line endings
Fix the remaining tests that failed with core.autocrlf=true
t3901: move supporting files into t/t3901/
completion: mark bash script as LF-only
git-new-workdir: mark script as LF-only
Fix build with core.autocrlf=true

Merge branch 'jc/read-tree-empty-with-m'Junio C Hamano Mon, 29 May 2017 03:34:45 +0000 (12:34 +0900)

Merge branch 'jc/read-tree-empty-with-m'

"git read-tree -m" (no tree-ish) gave a nonsense suggestion "use
--empty if you want to clear the index". With "-m", such a request
will still fail anyway, as you'd need to name at least one tree-ish
to be merged.

* jc/read-tree-empty-with-m:
read-tree: "read-tree -m --empty" does not make sense

Merge branch 'js/plug-leaks'Junio C Hamano Mon, 29 May 2017 03:34:44 +0000 (12:34 +0900)

Merge branch 'js/plug-leaks'

Fix memory leaks pointed out by Coverity (and people).

* js/plug-leaks: (26 commits)
checkout: fix memory leak
submodule_uses_worktrees(): plug memory leak
show_worktree(): plug memory leak
name-rev: avoid leaking memory in the `deref` case
remote: plug memory leak in match_explicit()
add_reflog_for_walk: avoid memory leak
shallow: avoid memory leak
line-log: avoid memory leak
receive-pack: plug memory leak in update()
fast-export: avoid leaking memory in handle_tag()
mktree: plug memory leaks reported by Coverity
pack-redundant: plug memory leak
setup_discovered_git_dir(): plug memory leak
setup_bare_git_dir(): help static analysis
split_commit_in_progress(): simplify & fix memory leak
checkout: fix memory leak
cat-file: fix memory leak
mailinfo & mailsplit: check for EOF while parsing
status: close file descriptor after reading git-rebase-todo
difftool: address a couple of resource/memory leaks
...

Merge branch 'jk/disable-pack-reuse-when-broken'Junio C Hamano Mon, 29 May 2017 03:34:44 +0000 (12:34 +0900)

Merge branch 'jk/disable-pack-reuse-when-broken'

"pack-objects" can stream a slice of an existing packfile out when
the pack bitmap can tell that the reachable objects are all needed
in the output, without inspecting individual objects. This
strategy however would not work well when "--local" and other
options are in use, and need to be disabled.

* jk/disable-pack-reuse-when-broken:
t5310: fix "; do" style
pack-objects: disable pack reuse for object-selection options

Merge branch 'bc/object-id'Junio C Hamano Mon, 29 May 2017 03:34:43 +0000 (12:34 +0900)

Merge branch 'bc/object-id'

Conversion from uchar[20] to struct object_id continues.

* bc/object-id: (53 commits)
object: convert parse_object* to take struct object_id
tree: convert parse_tree_indirect to struct object_id
sequencer: convert do_recursive_merge to struct object_id
diff-lib: convert do_diff_cache to struct object_id
builtin/ls-tree: convert to struct object_id
merge: convert checkout_fast_forward to struct object_id
sequencer: convert fast_forward_to to struct object_id
builtin/ls-files: convert overlay_tree_on_cache to object_id
builtin/read-tree: convert to struct object_id
sha1_name: convert internals of peel_onion to object_id
upload-pack: convert remaining parse_object callers to object_id
revision: convert remaining parse_object callers to object_id
revision: rename add_pending_sha1 to add_pending_oid
http-push: convert process_ls_object and descendants to object_id
refs/files-backend: convert many internals to struct object_id
refs: convert struct ref_update to use struct object_id
ref-filter: convert some static functions to struct object_id
Convert struct ref_array_item to struct object_id
Convert the verify_pack callback to struct object_id
Convert lookup_tag to struct object_id
...

Merge branch 'nd/split-index-unshare'Junio C Hamano Mon, 29 May 2017 03:34:43 +0000 (12:34 +0900)

Merge branch 'nd/split-index-unshare'

Plug some leaks and updates internal API used to implement the
split index feature to make it easier to avoid such a leak in the
future.

* nd/split-index-unshare:
p3400: add perf tests for rebasing many changes
split-index: add and use unshare_split_index()

Merge branch 'jk/diff-submodule-diff-inline'Junio C Hamano Mon, 29 May 2017 03:34:42 +0000 (12:34 +0900)

Merge branch 'jk/diff-submodule-diff-inline'

"git diff --submodule=diff" now recurses into nested submodules.

* jk/diff-submodule-diff-inline:
diff: recurse into nested submodules for inline diff

Merge branch 'bw/dir-c-stops-relying-on-the-index'Junio C Hamano Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)

Merge branch 'bw/dir-c-stops-relying-on-the-index'

API update.

* bw/dir-c-stops-relying-on-the-index:
dir: convert fill_directory to take an index
dir: convert read_directory to take an index
dir: convert read_directory_recursive to take an index
dir: convert open_cached_dir to take an index
dir: convert is_excluded to take an index
dir: convert prep_exclude to take an index
dir: convert add_excludes to take an index
dir: convert is_excluded_from_list to take an index
dir: convert last_exclude_matching_from_list to take an index
dir: convert dir_add* to take an index
dir: convert get_dtype to take index
dir: convert directory_exists_in_index to take index
dir: convert read_skip_worktree_file_from_index to take an index
dir: stop using the index compatibility macros

Merge branch 'sb/checkout-recurse-submodules'Junio C Hamano Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)

Merge branch 'sb/checkout-recurse-submodules'

"git checkout --recurse-submodules" did not quite work with a
submodule that itself has submodules.

* sb/checkout-recurse-submodules:
submodule: properly recurse for read-tree and checkout
submodule: avoid auto-discovery in new working tree manipulator code
submodule_move_head: reuse child_process structure for futher commands

Merge branch 'jc/repack-threads'Junio C Hamano Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)

Merge branch 'jc/repack-threads'

"git repack" learned to accept the --threads=<n> option and pass it
to pack-objects.

* jc/repack-threads:
repack: accept --threads=<n> and pass it down to pack-objects

Merge branch 'sb/reset-recurse-submodules'Junio C Hamano Mon, 29 May 2017 03:34:40 +0000 (12:34 +0900)

Merge branch 'sb/reset-recurse-submodules'

"git reset" learned "--recurse-submodules" option.

* sb/reset-recurse-submodules:
builtin/reset: add --recurse-submodules switch
submodule.c: submodule_move_head works with broken submodules
submodule.c: uninitialized submodules are ignored in recursive commands
entry.c: submodule recursing: respect force flag correctly

docs/config.txt: fix indefinite article in core.fileMod... SZEDER Gábor Thu, 25 May 2017 23:20:46 +0000 (01:20 +0200)

docs/config.txt: fix indefinite article in core.fileMode description

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

Second batch for 2.14Junio C Hamano Tue, 23 May 2017 04:51:32 +0000 (13:51 +0900)

Second batch for 2.14

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

Merge branch 'ab/fix-poison-tests'Junio C Hamano Tue, 23 May 2017 04:46:08 +0000 (13:46 +0900)

Merge branch 'ab/fix-poison-tests'

Update tests to pass under GETTEXT_POISON (a mechanism to ensure
that output strings that should not be translated are not
translated by mistake), and tell TravisCI to run them.

* ab/fix-poison-tests:
travis-ci: add job to run tests with GETTEXT_POISON
travis-ci: setup "prove cache" in "script" step
tests: fix tests broken under GETTEXT_POISON=YesPlease

Merge branch 'tb/dedup-crlf-tests'Junio C Hamano Tue, 23 May 2017 04:46:07 +0000 (13:46 +0900)

Merge branch 'tb/dedup-crlf-tests'

* tb/dedup-crlf-tests:
t0027: tests are not expensive; remove t0025

Merge branch 'jt/push-options-doc'Junio C Hamano Tue, 23 May 2017 04:46:07 +0000 (13:46 +0900)

Merge branch 'jt/push-options-doc'

The receive-pack program now makes sure that the push certificate
records the same set of push options used for pushing.

* jt/push-options-doc:
receive-pack: verify push options in cert
docs: correct receive.advertisePushOptions default

Merge branch 'ab/doc-replace-gmane-links'Junio C Hamano Tue, 23 May 2017 04:46:05 +0000 (13:46 +0900)

Merge branch 'ab/doc-replace-gmane-links'

The Web interface to gmane news archive is long gone, even though
the articles are still accessible via NTTP. Replace the links with
ones to public-inbox.org. Because their message identification is
based on the actual message-id, it is likely that it will be easier
to migrate away from it if/when necessary.

* ab/doc-replace-gmane-links:
doc: replace more gmane links
doc: replace a couple of broken gmane links

Merge branch 'rs/checkout-am-fix-unborn'Junio C Hamano Tue, 23 May 2017 04:46:05 +0000 (13:46 +0900)

Merge branch 'rs/checkout-am-fix-unborn'

A few codepaths in "checkout" and "am" working on an unborn branch
tried to access an uninitialized piece of memory.

* rs/checkout-am-fix-unborn:
am: check return value of resolve_refdup before using hash
checkout: check return value of resolve_refdup before using hash

Merge branch 'ls/travis-relays-for-windows-ci'Junio C Hamano Tue, 23 May 2017 04:46:03 +0000 (13:46 +0900)

Merge branch 'ls/travis-relays-for-windows-ci'

* ls/travis-relays-for-windows-ci:
travis-ci: retry if Git for Windows CI returns HTTP error 502 or 503
travis-ci: handle Git for Windows CI status "failed" explicitly

Merge branch 'ah/log-decorate-default-to-auto'Junio C Hamano Tue, 23 May 2017 04:46:02 +0000 (13:46 +0900)

Merge branch 'ah/log-decorate-default-to-auto'

Setting "log.decorate=false" in the configuration file did not take
effect in v2.13, which has been corrected.

* ah/log-decorate-default-to-auto:
builtin/log: honor log.decorate

Merge branch 'bw/submodule-with-bs-path'Junio C Hamano Tue, 23 May 2017 04:46:01 +0000 (13:46 +0900)

Merge branch 'bw/submodule-with-bs-path'

A hotfix to a topic that is already in v2.13.

* bw/submodule-with-bs-path:
t7400: add !CYGWIN prerequisite to 'add with \\ in path'

usage: add NORETURN to BUG() function definitionsRamsay Jones Sun, 21 May 2017 22:25:39 +0000 (23:25 +0100)

usage: add NORETURN to BUG() function definitions

Commit d8193743e0 ("usage.c: add BUG() function", 12-05-2017) added the
BUG() functions and macros as a replacement for calls to die("BUG: ..").
The use of NORETURN on the declarations (in git-compat-util.h) and the
lack of NORETURN on the function definitions, however, leads sparse to
complain thus:

SP usage.c
usage.c:220:6: error: symbol 'BUG_fl' redeclared with different type
(originally declared at git-compat-util.h:1074) - different modifiers

In order to suppress the sparse error, add the NORETURN to the function
definitions.

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

revision.c: ignore broken tags with ignore_missing_linksJeff King Sat, 20 May 2017 08:30:25 +0000 (04:30 -0400)

revision.c: ignore broken tags with ignore_missing_links

When peeling a tag for prepare_revision_walk(), we do not
respect the ignore_missing_links flag. This can lead to a
bogus error when pack-objects walks the possibly-broken
unreachable-but-recent part of the object graph.

The other link-following all happens via traverse_commit_list(),
which explains why this case was missed. And our tests
covered only broken links from commits. Let's be more
comprehensive and cover broken tree entries (which do work)
and tags (which shows off this bug).

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

config.txt: add an entry for log.showSignatureKyle Meyer Fri, 19 May 2017 02:44:51 +0000 (22:44 -0400)

config.txt: add an entry for log.showSignature

The configuration variable log.showSignature is mentioned in git-log's
manpage. Document it in git-config's manpage as well.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: add missing newline to end of messagePhillip Wood Fri, 19 May 2017 14:32:48 +0000 (15:32 +0100)

rebase -i: add missing newline to end of message

The message that's printed when auto-stashed changes are successfully
restored was missing '\n' at the end.

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

rebase -i: silence stash applyPhillip Wood Thu, 18 May 2017 10:02:33 +0000 (11:02 +0100)

rebase -i: silence stash apply

The shell version of rebase -i silences the status output from 'git
stash apply' when restoring the autostashed changes. The C version
does not.

Having the output from git stash apply on the screen is
distracting as it makes it difficult to find the message from git
rebase saying that the rebase succeeded. Also the status information
that git stash prints talks about looking in .git/rebase-merge/done to
see which commits have been applied. As .git/rebase-merge is removed
shortly after the message is printed before rebase -i exits this is
confusing.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: fix reflog messagePhillip Wood Thu, 18 May 2017 10:02:32 +0000 (11:02 +0100)

rebase -i: fix reflog message

When rebase -i was converted to C a bug was introduced into the code
that creates the reflog message. Instead of saying
rebase -i (finish): <head-name> onto <onto>
it says
rebase -i (finish): <head-name> onto <orig-head><onto>
as the strbuf is not reset between reading the value of <orig-head>
and <onto>.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: resolve HEAD when parsing %(HEAD) atomJeff King Fri, 19 May 2017 06:12:12 +0000 (02:12 -0400)

ref-filter: resolve HEAD when parsing %(HEAD) atom

If the user asks to display (or sort by) the %(HEAD) atom,
ref-filter has to compare each refname to the value of HEAD.
We do so by resolving HEAD fresh when calling populate_value()
on each ref. If there are a large number of refs, this can
have a measurable impact on runtime.

Instead, let's resolve HEAD once when we realize we need the
%(HEAD) atom, allowing us to do a simple string comparison
for each ref. On a repository with 3000 branches (high, but
an actual example found in the wild) this drops the
best-of-five time to run "git branch >/dev/null" from 59ms
to 48ms (~20% savings).

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

interpret-trailers: honor the cut lineBrian Malehorn Tue, 16 May 2017 06:06:49 +0000 (23:06 -0700)

interpret-trailers: honor the cut line

If a commit message is edited with the "verbose" option, the buffer
will have a cut line and diff after the log message, like so:

my subject

# ------------------------ >8 ------------------------
# Do not touch the line above.
# Everything below will be removed.
diff --git a/foo.txt b/foo.txt
index 5716ca5..7601807 100644
--- a/foo.txt
+++ b/foo.txt
@@ -1 +1 @@
-bar
+baz

"git interpret-trailers" is unaware of the cut line, and assumes the
trailer block would be at the end of the whole thing. This can easily
be seen with:

$ GIT_EDITOR='git interpret-trailers --in-place --trailer Acked-by:me' \
git commit --amend -v

Teach "git interpret-trailers" to notice the cut-line and ignore the
remainder of the input when looking for a place to add new trailer
block. This makes it consistent with how "git commit -v -s" inserts a
new Signed-off-by: line.

This can be done by the same logic as the existing helper function,
wt_status_truncate_message_at_cut_line(), uses, but it wants the caller
to pass a strbuf to it. Because the function ignore_non_trailer() used
by the command takes a <pointer, length> pair, not a strbuf, steal the
logic from wt_status_truncate_message_at_cut_line() to create a new
wt_status_locate_end() helper function that takes <pointer, length>
pair, and make ignore_non_trailer() call it to help "interpret-trailers".

Since there is only one caller of wt_status_truncate_message_at_cut_line()
in cmd_commit(), rewrite it to call wt_status_locate_end() helper instead
and remove the old helper that no longer has any caller.

Signed-off-by: Brian Malehorn <bmalehorn@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5400: avoid concurrent writes into a trace fileJeff King Thu, 18 May 2017 05:02:09 +0000 (01:02 -0400)

t5400: avoid concurrent writes into a trace file

One test in t5400 examines the packet exchange between git-push and
git-receive-pack. The latter inherits the GIT_TRACE_PACKET environment
variable, so that both processes dump trace data into the same file
concurrently. This should not be a problem because the trace file is
opened with O_APPEND.

On Windows, however, O_APPEND is not atomic as it should be: it is
emulated as lseek(SEEK_END) followed by write(). For this reason, the
test is unreliable: it can happen that one process overwrites a line
that was just written by the other process. As a consequence, the test
sometimes does not find one or another line that is expected (and it is
also successful occasionally).

The test case is actually only interested in the output of git-push.
To ensure that only git-push writes to the trace file, override the
receive-pack command such that it does not even open the trace file.

Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: add git stash pushThomas Gummerer Tue, 16 May 2017 19:59:45 +0000 (20:59 +0100)

completion: add git stash push

When introducing git stash push in f5727e26e4 ("stash: introduce push
verb", 2017-02-19), I forgot to add it to the completion code. Add it
now.

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

Start post 2.13 cycleJunio C Hamano Tue, 16 May 2017 02:52:09 +0000 (11:52 +0900)

Start post 2.13 cycle

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

Merge branch 'js/larger-timestamps'Junio C Hamano Tue, 16 May 2017 02:51:59 +0000 (11:51 +0900)

Merge branch 'js/larger-timestamps'

Some platforms have ulong that is smaller than time_t, and our
historical use of ulong for timestamp would mean they cannot
represent some timestamp that the platform allows. Invent a
separate and dedicated timestamp_t (so that we can distingiuish
timestamps and a vanilla ulongs, which along is already a good
move), and then declare uintmax_t is the type to be used as the
timestamp_t.

* js/larger-timestamps:
archive-tar: fix a sparse 'constant too large' warning
use uintmax_t for timestamps
date.c: abort if the system time cannot handle one of our timestamps
timestamp_t: a new data type for timestamps
PRItime: introduce a new "printf format" for timestamps
parse_timestamp(): specify explicitly where we parse timestamps
t0006 & t5000: skip "far in the future" test when time_t is too limited
t0006 & t5000: prepare for 64-bit timestamps
ref-filter: avoid using `unsigned long` for catch-all data type

Merge branch 'jc/apply-fix-mismerge'Junio C Hamano Tue, 16 May 2017 02:51:59 +0000 (11:51 +0900)

Merge branch 'jc/apply-fix-mismerge'

* jc/apply-fix-mismerge:
apply.c: fix whitespace-only mismerge

Merge branch 'ab/aix-needs-compat-regex'Junio C Hamano Tue, 16 May 2017 02:51:58 +0000 (11:51 +0900)

Merge branch 'ab/aix-needs-compat-regex'

Build fix.

* ab/aix-needs-compat-regex:
config.mak.uname: set NO_REGEX=NeedsStartEnd on AIX

Merge branch 'jn/credential-doc-on-clear'Junio C Hamano Tue, 16 May 2017 02:51:57 +0000 (11:51 +0900)

Merge branch 'jn/credential-doc-on-clear'

Doc update.

* jn/credential-doc-on-clear:
credential doc: make multiple-helper behavior more prominent

Merge branch 'jn/clone-add-empty-config-from-command... Junio C Hamano Tue, 16 May 2017 02:51:56 +0000 (11:51 +0900)

Merge branch 'jn/clone-add-empty-config-from-command-line'

"git clone --config var=val" is a way to populate the
per-repository configuration file of the new repository, but it did
not work well when val is an empty string. This has been fixed.

* jn/clone-add-empty-config-from-command-line:
clone: handle empty config values in -c

Merge branch 'bw/submodule-has-commits-update'Junio C Hamano Tue, 16 May 2017 02:51:56 +0000 (11:51 +0900)

Merge branch 'bw/submodule-has-commits-update'

Code clean-up and duplicate removal.

* bw/submodule-has-commits-update:
submodule: refactor logic to determine changed submodules
submodule: improve submodule_has_commits()
submodule: change string_list changed_submodule_paths
submodule: remove add_oid_to_argv()
submodule: rename free_submodules_sha1s()
submodule: rename add_sha1_to_array()

Merge branch 'ls/travis-doc-asciidoctor'Junio C Hamano Tue, 16 May 2017 02:51:55 +0000 (11:51 +0900)

Merge branch 'ls/travis-doc-asciidoctor'

Travis CI gained a task to format the documentation with both
AsciiDoc and AsciiDoctor.

* ls/travis-doc-asciidoctor:
travis-ci: check AsciiDoc/AsciiDoctor stderr output
travis-ci: unset compiler for jobs that do not need one
travis-ci: parallelize documentation build
travis-ci: build documentation with AsciiDoc and Asciidoctor

Merge branch 'rs/large-zip'Junio C Hamano Tue, 16 May 2017 02:51:54 +0000 (11:51 +0900)

Merge branch 'rs/large-zip'

"git archive --format=zip" learned to use zip64 extension when
necessary to go beyond the 4GB limit.

* rs/large-zip:
t5004: require 64-bit support for big ZIP tests
archive-zip: set version field for big files correctly
archive-zip: support files bigger than 4GB
archive-zip: support archives bigger than 4GB
archive-zip: write ZIP dir entry directly to strbuf
archive-zip: use strbuf for ZIP directory
archive-zip: add tests for big ZIP archives

Merge branch 'ab/clone-no-tags'Junio C Hamano Tue, 16 May 2017 02:51:54 +0000 (11:51 +0900)

Merge branch 'ab/clone-no-tags'

"git clone" learned the "--no-tags" option not to fetch all tags
initially, and also set up the tagopt not to follow any tags in
subsequent fetches.

* ab/clone-no-tags:
tests: rename a test having to do with shallow submodules
clone: add a --no-tags option to clone without tags
tests: change "cd ... && git fetch" to "cd &&\n\tgit fetch"

Merge branch 'sk/status-short-branch-color-config'Junio C Hamano Tue, 16 May 2017 02:51:53 +0000 (11:51 +0900)

Merge branch 'sk/status-short-branch-color-config'

The colors in which "git status --short --branch" showed the names
of the current branch and its remote-tracking branch are now
configurable.

* sk/status-short-branch-color-config:
status: add color config slots for branch info in "--short --branch"
status: fix missing newline when comment chars are disabled

Merge branch 'jk/am-leakfix'Junio C Hamano Tue, 16 May 2017 02:51:53 +0000 (11:51 +0900)

Merge branch 'jk/am-leakfix'

The codepath in "git am" that is used when running "git rebase"
leaked memory held for the log message of the commits being rebased.

* jk/am-leakfix:
am: shorten ident_split variable name in get_commit_info()
am: simplify allocations in get_commit_info()
am: fix commit buffer leak in get_commit_info()

Merge branch 'jt/use-trailer-api-in-commands'Junio C Hamano Tue, 16 May 2017 02:51:52 +0000 (11:51 +0900)

Merge branch 'jt/use-trailer-api-in-commands'

"git cherry-pick" and other uses of the sequencer machinery
mishandled a trailer block whose last line is an incomplete line.
This has been fixed so that an additional sign-off etc. are added
after completing the existing incomplete line.

* jt/use-trailer-api-in-commands:
sequencer: add newline before adding footers

Merge branch 'nd/worktree-kill-parse-ref'Junio C Hamano Tue, 16 May 2017 02:51:51 +0000 (11:51 +0900)

Merge branch 'nd/worktree-kill-parse-ref'

"git gc" did not interact well with "git worktree"-managed
per-worktree refs.

* nd/worktree-kill-parse-ref:
refs: kill set_worktree_head_symref()
worktree.c: kill parse_ref() in favor of refs_resolve_ref_unsafe()
refs: introduce get_worktree_ref_store()
refs: add REFS_STORE_ALL_CAPS
refs.c: make submodule ref store hashmap generic
environment.c: fix potential segfault by get_git_common_dir()

Merge branch 'dt/gc-ignore-old-gc-logs'Junio C Hamano Tue, 16 May 2017 02:51:50 +0000 (11:51 +0900)

Merge branch 'dt/gc-ignore-old-gc-logs'

Attempt to allow us notice "fishy" situation where we fail to
remove the temporary directory used during the test.

* dt/gc-ignore-old-gc-logs:
test-lib: retire $remove_trash variable
test-lib.sh: do not barf under --debug at the end of the test
test-lib: abort when can't remove trash directory

Merge branch 'jk/no-null-sha1-in-cache-tree'Junio C Hamano Tue, 16 May 2017 02:51:50 +0000 (11:51 +0900)

Merge branch 'jk/no-null-sha1-in-cache-tree'

Code to update the cache-tree has been tightened so that we won't
accidentally write out any 0{40} entry in the tree object.

* jk/no-null-sha1-in-cache-tree:
cache-tree: reject entries with null sha1

Merge branch 'dt/raise-core-packed-git-limit'Junio C Hamano Tue, 16 May 2017 02:51:49 +0000 (11:51 +0900)

Merge branch 'dt/raise-core-packed-git-limit'

The default packed-git limit value has been raised on larger
platforms to save "git fetch" from a (recoverable) failure while
"gc" is running in parallel.

* dt/raise-core-packed-git-limit:
Increase core.packedGitLimit

p0004: don't error out if test repo is too smallRené Scharfe Sat, 13 May 2017 16:03:50 +0000 (18:03 +0200)

p0004: don't error out if test repo is too small

Repositories with less than 4000 entries are always handled using a
single thread, causing test-lazy-init-name-hash --multi to error out.
Don't abort the whole test script in that case, but simply skip the
multi-threaded performance check. We can still use it to compare the
single-threaded speed of different versions in that case.

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

p0004: don't abort if multi-threaded is too slowRené Scharfe Sat, 13 May 2017 16:03:22 +0000 (18:03 +0200)

p0004: don't abort if multi-threaded is too slow

If the single-threaded variant beats the multi-threaded one then we may
have a performance bug, but that doesn't justify aborting the test.
Drop that check; we can compare the results for --single and --multi
using the actual performance tests.

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

p0004: use test_perfRené Scharfe Sat, 13 May 2017 16:02:32 +0000 (18:02 +0200)

p0004: use test_perf

The perf test suite (more specifically: t/perf/aggregate.perl) requires
each test script to write test results into a file, otherwise it aborts
when aggregating. Add actual performance tests with test_perf to allow
p0004 to be run together with other perf scripts.

Calibrate the value for the parameter --count based on the size of the
test repository, in order to get meaningful results with smaller repos
yet still be able to finish the script against huge ones without having
to wait for hours.

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

p0004: avoid using pipesRené Scharfe Sat, 13 May 2017 16:00:15 +0000 (18:00 +0200)

p0004: avoid using pipes

The return code of commands on the producing end of a pipe is ignored.
Evaluate the outcome of test-lazy-init-name-hash by calling sort
separately.

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

p0004: simplify calls of test-lazy-init-name-hashRené Scharfe Sat, 13 May 2017 15:59:46 +0000 (17:59 +0200)

p0004: simplify calls of test-lazy-init-name-hash

The test library puts helpers into $PATH, so we can simply call them
without specifying their location.

The suffix $X is also not necessary because .exe files on Windows can be
started without specifying their extension, and on other platforms it's
empty anyway.

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

doc: use https links to Wikipedia to avoid http redirectsSven Strickroth Sat, 13 May 2017 09:54:51 +0000 (11:54 +0200)

doc: use https links to Wikipedia to avoid http redirects

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert: update subprocess_read_status() to not die... Ben Peart Fri, 5 May 2017 15:28:02 +0000 (11:28 -0400)

convert: update subprocess_read_status() to not die on EOF

Enable sub-processes to gracefully handle when the process dies by
updating subprocess_read_status to return an error on EOF instead of
dying.

Update apply_multi_file_filter to take advantage of the revised
subprocess_read_status.

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

sub-process: move sub-process functions into separate... Ben Peart Fri, 5 May 2017 15:28:01 +0000 (11:28 -0400)

sub-process: move sub-process functions into separate files

Move the sub-proces functions into sub-process.h/c. Add documentation
for the new module in Documentation/technical/api-sub-process.txt

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

convert: rename reusable sub-process functionsBen Peart Fri, 5 May 2017 15:28:00 +0000 (11:28 -0400)

convert: rename reusable sub-process functions

Do a mechanical rename of the functions that will become the reusable
sub-process module.

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

convert: update generic functions to only use generic... Ben Peart Fri, 5 May 2017 15:27:59 +0000 (11:27 -0400)

convert: update generic functions to only use generic data structures

Update all functions that are going to be moved into a reusable module
so that they only work with the reusable data structures. Move code
that is specific to the filter out into the filter specific functions.

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

convert: separate generic structures and variables... Ben Peart Fri, 5 May 2017 15:27:58 +0000 (11:27 -0400)

convert: separate generic structures and variables from the filter specific ones

To enable future reuse of the filter.<driver>.process infrastructure,
split the cmd2process structure into two separate parts.

subprocess_entry will now contain the generic data required to manage
the creation and tracking of the child process in a hashmap.

cmd2process is a filter protocol specific structure that is used to
track the negotiated capabilities of the filter.

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

convert: split start_multi_file_filter() into two separ... Ben Peart Fri, 5 May 2017 15:27:57 +0000 (11:27 -0400)

convert: split start_multi_file_filter() into two separate functions

To enable future reuse of the filter.<driver>.process infrastructure,
split start_multi_file_filter() into two separate parts.

start_multi_file_filter() will now only contain the generic logic to
manage the creation and tracking of the child process in a hashmap.

start_multi_file_filter_fn() is a protocol specific initialization
function that will negotiate the multi-file-filter interface version
and capabilities.

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

pkt-line: annotate packet_writel with LAST_ARG_MUST_BE_NULLJeff King Sat, 13 May 2017 09:04:58 +0000 (05:04 -0400)

pkt-line: annotate packet_writel with LAST_ARG_MUST_BE_NULL

packet_writel() takes a variable-sized list and reads to
the first NULL. Let's let the compiler know so that it can
help us catch mistakes in the callers.

This should have been annotated similarly when it was a
static function, but it's doubly important now that the
function is available to the whole code-base.

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

usage.c: drop set_error_handle()Jeff King Sat, 13 May 2017 03:48:18 +0000 (23:48 -0400)

usage.c: drop set_error_handle()

The set_error_handle() function was introduced by 3b331e926
(vreportf: report to arbitrary filehandles, 2015-08-11) so
that run-command could send post-fork, pre-exec errors to
the parent's original stderr.

That use went away in 79319b194 (run-command: eliminate
calls to error handling functions in child, 2017-04-19),
which pushes all of the error reporting to the parent.
This leaves no callers of set_error_handle(). As we're not
likely to add any new ones, let's drop it.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/log: honor log.decoratebrian m. carlson Sun, 14 May 2017 18:00:58 +0000 (18:00 +0000)

builtin/log: honor log.decorate

The recent change that introduced autodecorating of refs accidentally
broke the ability of users to set log.decorate = false to override it.
When the git_log_config was traversed a second time with an option other
than log.decorate, the decoration style would be set to the automatic
style, even if the user had already overridden it. Instead of setting
the option in config parsing, set it in init_log_defaults instead.

Add a test for this case. The actual additional config option doesn't
matter, but it needs to be something not already set in the
configuration file.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Alex Henrie <alexhenrie24@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: complain about --local outside of a git repoJeff King Sat, 13 May 2017 03:29:31 +0000 (23:29 -0400)

config: complain about --local outside of a git repo

The "--local" option instructs git-config to read or modify
the repository-level config. This doesn't make any sense if
you're not actually in a repository.

Older versions of Git would blindly try to read or write
".git/config". For reading, this would result in a quiet
failure, since there was no config to read (and thus no
matching config value). Writing would generally fail
noisily, since ".git" was unlikely to exist. But since
b1ef400ee (setup_git_env: avoid blind fall-back to ".git",
2016-10-20), we catch this in the call to git_pathdup() and
die with an assertion.

Dying is the right thing to do, but we should catch the
problem early and give a more human-friendly error message.

Note that even without --local, git-config will sometimes
default to using local repository config (e.g., when
writing). These cases are already protected by similar
checks, and covered by a test in t1308.

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

setup_git_env: convert die("BUG") to BUG()Jeff King Sat, 13 May 2017 03:29:18 +0000 (23:29 -0400)

setup_git_env: convert die("BUG") to BUG()

Converting to BUG() makes it easier to detect and debug
cases where we hit this assertion. Coupled with a new test
in t1300, this shows that the test suite can detect such
corner cases.

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

usage.c: add BUG() functionJeff King Sat, 13 May 2017 03:28:50 +0000 (23:28 -0400)

usage.c: add BUG() function

There's a convention in Git's code base to write assertions
as:

if (...some_bad_thing...)
die("BUG: the terrible thing happened");

with the idea that users should never see a "BUG:" message
(but if they, it at least gives a clue what happened). We
use die() here because it's convenient, but there are a few
draw-backs:

1. Without parsing the messages, it's hard for callers to
distinguish BUG assertions from regular errors.

For instance, it would be nice if the test suite could
check that we don't hit any assertions, but
test_must_fail will pass BUG deaths as OK.

2. It would be useful to add more debugging features to
BUG assertions, like file/line numbers or dumping core.

3. The die() handler can be replaced, and might not
actually exit the whole program (e.g., it may just
pthread_exit()). This is convenient for normal errors,
but for an assertion failure (which is supposed to
never happen), we're probably better off taking down
the whole process as quickly and cleanly as possible.

We could address these by checking in die() whether the
error message starts with "BUG", and behaving appropriately.
But there's little advantage at that point to sharing the
die() code, and only downsides (e.g., we can't change the
BUG() interface independently). Moreover, converting all of
the existing BUG calls reveals that the test suite does
indeed trigger a few of them.

Instead, this patch introduces a new BUG() function, which
prints an error before dying via SIGABRT. This gives us test
suite checking and core dumps. The function is actually a
macro (when supported) so that we can show the file/line
number.

We can convert die("BUG") invocations to BUG() in further
patches, dealing with any test fallouts individually.

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

git-filter-branch: be more direct in an error messageJean-Noel Avila Thu, 11 May 2017 12:06:34 +0000 (14:06 +0200)

git-filter-branch: be more direct in an error message

git-filter-branch requires the specification of a branch by one way or
another. If no branch appears to have been specified, we know the user
got the usage wrong but we don't know what they were trying to do ---
e.g. maybe they specified the ref to rewrite but in the wrong place.

In this case, just state that the branch specification is missing.

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

read-tree -m: make error message for merging 0 trees... Jean-Noel Avila Thu, 11 May 2017 12:06:33 +0000 (14:06 +0200)

read-tree -m: make error message for merging 0 trees less smart aleck

"git read-tree -m" requires a tree argument to name the tree to be
merged in. Git uses a cutesy error message to say so and why:

$ git read-tree -m
warning: read-tree: emptying the index with no arguments is
deprecated; use --empty
fatal: just how do you expect me to merge 0 trees?
$ git read-tree -m --empty
fatal: just how do you expect me to merge 0 trees?

When lucky, that could produce an ah-hah moment for the user, but it's
more likely to irritate and distract them.

Instead, tell the user plainly that the tree argument is
required. Also document this requirement in the git-read-tree(1)
manpage where there is room to explain it in a more straightforward way.

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

usability: don't ask questions if no reply is requiredJean-Noel Avila Thu, 11 May 2017 12:06:32 +0000 (14:06 +0200)

usability: don't ask questions if no reply is required

There has been a bug report by a corporate user that stated that
"spelling mistake of stash followed by a yes prints character 'y'
infinite times."

This analysis was false. When the spelling of a command contains
errors, the git program tries to help the user by providing candidates
which are close to the unexisting command. E.g Git prints the
following:

git: 'stahs' is not a git command. See 'git --help'.
Did you mean this?

stash

and then exits.

The problem with this hint is that it is not formally indicated as an
hint and the user is in fact encouraged to reply to the question,
whereas the Git command is already finished.

The user was unlucky enough that it was the command he was looking
for, and replied "yes" on the command line, effectively launching the
`yes` program.

The initial error is that the Git programs, when launched in
command-line mode (without interaction) must not ask questions,
because these questions would normally require a user input as a reply
that they won't handle indeed. That's a source of confusion on UX
level.

To improve the general usability of the Git suite, the following rule
was applied:

if the sentence
* appears in a non-interactive session
* is printed last before exit
* is a question addressing the user ("you")

the sentence is turned into affirmative and proposes the option.

The basic rewording of the question sentences has been extended to
other spots found in the source.

Requested at https://github.com/git/git-scm.com/issues/999 by rpai1

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

pathspec: convert find_pathspecs_matching_against_index... Brandon Williams Thu, 11 May 2017 22:04:27 +0000 (15:04 -0700)

pathspec: convert find_pathspecs_matching_against_index to take an index

Convert find_pathspecs_matching_against_index to take an index
parameter.

In addition mark pathspec.c with NO_THE_INDEX_COMPATIBILITY_MACROS now
that it doesn't use any cache macros or reference 'the_index'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAPBrandon Williams Thu, 11 May 2017 22:04:26 +0000 (15:04 -0700)

pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP

Since (ae8d08242 pathspec: pass directory indicator to
match_pathspec_item()) the path matching logic has been able to cope
with submodules without needing to strip off a trailing slash if a path
refers to a submodule.

Since stripping the slash is no longer necessary, remove the
PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP flag.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ls-files: prevent prune_cache from overeagerly pruning... Brandon Williams Thu, 11 May 2017 22:04:25 +0000 (15:04 -0700)

ls-files: prevent prune_cache from overeagerly pruning submodules

Since (ae8d08242 pathspec: pass directory indicator to
match_pathspec_item()) the path matching logic has been able to cope
with submodules without needing to strip off a trailing slash if a path
refers to a submodule.

ls-files is the only caller of 'parse_pathspec()' which relies on the
behavior of the PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP flag because it
uses the result to construct a common prefix of all provided pathspecs
which is then used to prune the index of all entries which don't have
that prefix. Since submodules entries in the index don't have a
trailing slash 'prune_cache()' will be overeager and prune a submodule
'sub' if the common prefix is 'sub/'. To correct this behavior, only
prune entries which don't match up to, but not including, a trailing
slash of the common prefix.

This is in preparation to remove the
PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP flag in a later patch.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSI... Brandon Williams Thu, 11 May 2017 22:04:24 +0000 (15:04 -0700)

pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag

Since (ae8d08242 pathspec: pass directory indicator to
match_pathspec_item()) the path matching logic has been able to cope
with submodules without needing to strip off a trailing slash if a path
refers to a submodule.

Since the stripping the trailing slash is no longer necessary, remove
the PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag. In addition, factor
out the logic which dies if a path decends into a submodule so that it
can still be used as a check after a pathspec struct has been
initialized.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

perf: add test showing exponential growth in path globbingÆvar Arnfjörð Bjarmason Thu, 11 May 2017 09:41:08 +0000 (09:41 +0000)

perf: add test showing exponential growth in path globbing

Add a test showing that runtimes of the wildmatch() function used for
globbing in git grow exponentially in the face of some pathological
globs.

This issue affects both globs matching filenames via e.g. ls-files,
and globs matching refnames via e.g. for-each-ref.

As noted in the test description this is a test to see whether Git
suffers from the issue noted in an article Russ Cox posted today about
common bugs in various glob implementations:
https://research.swtch.com/glob

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

perf: add function to setup a fresh test repoÆvar Arnfjörð Bjarmason Thu, 11 May 2017 09:41:07 +0000 (09:41 +0000)

perf: add function to setup a fresh test repo

Add a function to setup a fresh test repo via 'git init' to compliment
the existing functions to copy over a normal & large repo.

Some performance tests don't need any existing repository data at all
to be significant, e.g. tests which stress glob matches against single
pathological revisions or files, which I'm about to add in a
subsequent commit.

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

docs/config: consistify include.path examplesJeff King Thu, 11 May 2017 09:14:30 +0000 (05:14 -0400)

docs/config: consistify include.path examples

Most of the include examples use "foo.inc", but some use
"foo". Since the string of examples are meant to show
variations and how they differ, it's a good idea to change
only one thing at a time. The filename differences are not
relevant to what we're trying to show.

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

docs/config: avoid the term "expand" for includesJeff King Thu, 11 May 2017 09:13:04 +0000 (05:13 -0400)

docs/config: avoid the term "expand" for includes

Using the word "expand" to refer to including the contents
of another config file isn't really accurate, since it's a
verbatim insertion. And it can cause confusion with the
expanding of the path itself via things like "~".

Let's clarify when we are referring to the contents versus
the filename, and use appropriate verbs in each case.

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

docs/config: give a relative includeIf exampleJeff King Thu, 11 May 2017 09:11:06 +0000 (05:11 -0400)

docs/config: give a relative includeIf example

The changes in the previous commit hopefully clarify that
the evaluation of an include "path" variable is the same no
matter if it's in a conditional section or not. But since
this question came up on the list, let's add an example that
makes it obvious.

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

docs/config: clarify include/includeIf relationshipJeff King Thu, 11 May 2017 09:10:47 +0000 (05:10 -0400)

docs/config: clarify include/includeIf relationship

The "includeIf" directives behave exactly like include ones,
except they only kick in when the conditional is true. That
was mentioned in the "conditional" section, but let's make
it more clear for the whole "includes" section, since people
don't necessarily read the documentation top to bottom.

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

travis-ci: add job to run tests with GETTEXT_POISONLars Schneider Fri, 5 May 2017 15:40:53 +0000 (17:40 +0200)

travis-ci: add job to run tests with GETTEXT_POISON

Add a job to run Git tests with GETTEXT_POISON. In this job we don't run
the git-p4, git-svn, and HTTPD tests to save resources/time (those tests
are already executed in other jobs). Since we don't run these tests, we
can also skip the "before_install" step (which would install the
necessary dependencies) with an empty override.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

travis-ci: setup "prove cache" in "script" stepLars Schneider Fri, 5 May 2017 15:40:52 +0000 (17:40 +0200)

travis-ci: setup "prove cache" in "script" step

The command that made the "prove cache" persistent across builds was
executed in the "before_install" step. Consequently, every job that
wanted to make use of the cache had to run this step.

The "prove cache" is only used in the "script" step for the
"make test" command. Therefore, we should configure the "prove cache"
in this step.

This change is useful for a subsequent patch that adds a job which does
not need the "before_install" step but wants to run the "script" step to
execute the tests.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>