git
4 years agoMerge branch 'ma/t7004'
Junio C Hamano [Sun, 1 Dec 2019 17:04:41 +0000 (09:04 -0800)] 
Merge branch 'ma/t7004'

Test fix.

* ma/t7004:
  t7004: check existence of correct tag

4 years agoMerge branch 'js/complete-svn-recursive'
Junio C Hamano [Sun, 1 Dec 2019 17:04:40 +0000 (09:04 -0800)] 
Merge branch 'js/complete-svn-recursive'

The completion script (in contrib/) has been taught that "git svn"
supports the "--recursive" option.

* js/complete-svn-recursive:
  completion: tab-complete "git svn --recursive"

4 years agoMerge branch 'jk/send-pack-remote-failure'
Junio C Hamano [Sun, 1 Dec 2019 17:04:40 +0000 (09:04 -0800)] 
Merge branch 'jk/send-pack-remote-failure'

Error handling after "git push" finishes sending the packdata and
waits for the response to the remote side has been improved.

* jk/send-pack-remote-failure:
  send-pack: check remote ref status on pack-objects failure

4 years agoMerge branch 'jc/fsmonitor-sanity-fix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)] 
Merge branch 'jc/fsmonitor-sanity-fix'

Remove an incorrect BUG() that should not trigger.

* jc/fsmonitor-sanity-fix:
  fsmonitor: do not compare bitmap size with size of split index

4 years agoMerge branch 'sg/skip-skipped-prereq'
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)] 
Merge branch 'sg/skip-skipped-prereq'

Test update to avoid wasted cycles.

* sg/skip-skipped-prereq:
  test-lib: don't check prereqs of test cases that won't be run anyway

4 years agoMerge branch 'ds/test-read-graph'
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)] 
Merge branch 'ds/test-read-graph'

Dev support for commit-graph feature.

* ds/test-read-graph:
  test-tool: use 'read-graph' helper

4 years agoMerge branch 'rs/use-copy-array-in-mingw-shell-command-preparation'
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)] 
Merge branch 'rs/use-copy-array-in-mingw-shell-command-preparation'

Code cleanup.

* rs/use-copy-array-in-mingw-shell-command-preparation:
  mingw: use COPY_ARRAY for copying array

4 years agoMerge branch 'rs/parse-options-dup-null-fix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:38 +0000 (09:04 -0800)] 
Merge branch 'rs/parse-options-dup-null-fix'

Code cleanup.

* rs/parse-options-dup-null-fix:
  parse-options: avoid arithmetic on pointer that's potentially NULL

4 years agoMerge branch 'jt/fetch-remove-lazy-fetch-plugging'
Junio C Hamano [Sun, 1 Dec 2019 17:04:38 +0000 (09:04 -0800)] 
Merge branch 'jt/fetch-remove-lazy-fetch-plugging'

"git fetch" codepath had a big "do not lazily fetch missing objects
when I ask if something exists" switch.  This has been corrected by
marking the "does this thing exist?" calls with "if not please do not
lazily fetch it" flag.

* jt/fetch-remove-lazy-fetch-plugging:
  promisor-remote: remove fetch_if_missing=0
  clone: remove fetch_if_missing=0
  fetch: remove fetch_if_missing=0

4 years agoMerge branch 'jk/optim-in-pack-idx-conversion'
Junio C Hamano [Sun, 1 Dec 2019 17:04:38 +0000 (09:04 -0800)] 
Merge branch 'jk/optim-in-pack-idx-conversion'

Code clean-up.

* jk/optim-in-pack-idx-conversion:
  pack-objects: avoid pointless oe_map_new_pack() calls

4 years agoMerge branch 'dl/complete-rebase-onto'
Junio C Hamano [Sun, 1 Dec 2019 17:04:37 +0000 (09:04 -0800)] 
Merge branch 'dl/complete-rebase-onto'

The completion script (in contrib/) learned that the "--onto"
option of "git rebase" can take its argument as the value of the
option.

* dl/complete-rebase-onto:
  completion: learn to complete `git rebase --onto=`

4 years agoMerge branch 'tg/stash-refresh-index'
Junio C Hamano [Sun, 1 Dec 2019 17:04:37 +0000 (09:04 -0800)] 
Merge branch 'tg/stash-refresh-index'

Recent update to "git stash pop" made the command empty the index
when run with the "--quiet" option, which has been corrected.

* tg/stash-refresh-index:
  stash: make sure we have a valid index before writing it

4 years agoMerge branch 'nn/doc-rebase-merges'
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)] 
Merge branch 'nn/doc-rebase-merges'

Doc update.

* nn/doc-rebase-merges:
  doc: improve readability of --rebase-merges in git-rebase

4 years agoMerge branch 'dd/sequencer-utf8'
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)] 
Merge branch 'dd/sequencer-utf8'

Handling of commit objects that use non UTF-8 encoding during
"rebase -i" has been improved.

* dd/sequencer-utf8:
  sequencer: reencode commit message for am/rebase --show-current-patch
  sequencer: reencode old merge-commit message
  sequencer: reencode squashing commit's message
  sequencer: reencode revert/cherry-pick's todo list
  sequencer: reencode to utf-8 before arrange rebase's todo list
  t3900: demonstrate git-rebase problem with multi encoding
  configure.ac: define ICONV_OMITS_BOM if necessary
  t0028: eliminate non-standard usage of printf

4 years agoMerge branch 'jk/remove-sha1-to-hex'
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)] 
Merge branch 'jk/remove-sha1-to-hex'

Code clean-up.

* jk/remove-sha1-to-hex:
  hex: drop sha1_to_hex()
  hex: drop sha1_to_hex_r()

4 years agoMerge branch 'dj/typofix-merge-strat'
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)] 
Merge branch 'dj/typofix-merge-strat'

Typofix.

* dj/typofix-merge-strat:
  merge-strategies: fix typo "reflected to" to "reflected in"

4 years agoMerge branch 'rj/bundle-ui-updates'
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)] 
Merge branch 'rj/bundle-ui-updates'

"git bundle" has been taught to use the parse options API.  "git
bundle verify" learned "--quiet" and "git bundle create" learned
options to control the progress output.

* rj/bundle-ui-updates:
  bundle-verify: add --quiet
  bundle-create: progress output control
  bundle: framework for options before bundle file

4 years agoMerge branch 'rs/skip-iprefix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)] 
Merge branch 'rs/skip-iprefix'

Code simplification.

* rs/skip-iprefix:
  convert: use skip_iprefix() in validate_encoding()
  utf8: use skip_iprefix() in same_utf_encoding()

4 years agoMerge branch 'ln/userdiff-elixir'
Junio C Hamano [Sun, 1 Dec 2019 17:04:35 +0000 (09:04 -0800)] 
Merge branch 'ln/userdiff-elixir'

The patterns to detect function boundary for Elixir language has
been added.

* ln/userdiff-elixir:
  userdiff: add Elixir to supported userdiff languages

4 years agoMerge branch 'py/shortlog-list-options-for-log'
Junio C Hamano [Sun, 1 Dec 2019 17:04:35 +0000 (09:04 -0800)] 
Merge branch 'py/shortlog-list-options-for-log'

Documentation pages for "git shortlog" now lists commit limiting
options explicitly.

* py/shortlog-list-options-for-log:
  git-shortlog.txt: include commit limiting options

4 years agoMerge branch 'en/doc-typofix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:35 +0000 (09:04 -0800)] 
Merge branch 'en/doc-typofix'

Docfix.

* en/doc-typofix:
  Fix spelling errors in no-longer-updated-from-upstream modules
  multimail: fix a few simple spelling errors
  sha1dc: fix trivial comment spelling error
  Fix spelling errors in test commands
  Fix spelling errors in messages shown to users
  Fix spelling errors in names of tests
  Fix spelling errors in comments of testcases
  Fix spelling errors in code comments
  Fix spelling errors in documentation outside of Documentation/
  Documentation: fix a bunch of typos, both old and new

4 years agoMerge branch 'ns/test-desc-typofix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:34 +0000 (09:04 -0800)] 
Merge branch 'ns/test-desc-typofix'

Typofix.

* ns/test-desc-typofix:
  t: fix typo in test descriptions

4 years agoMerge branch 'en/t6024-style'
Junio C Hamano [Sun, 1 Dec 2019 17:04:34 +0000 (09:04 -0800)] 
Merge branch 'en/t6024-style'

Test updates.

* en/t6024-style:
  t6024: modernize style

4 years agoMerge branch 'en/misc-doc-fixes'
Junio C Hamano [Sun, 1 Dec 2019 17:04:34 +0000 (09:04 -0800)] 
Merge branch 'en/misc-doc-fixes'

Misc doc fixes.

* en/misc-doc-fixes:
  name-hash.c: remove duplicate word in comment
  hashmap: fix documentation misuses of -> versus .
  git-filter-branch.txt: correct argument name typo

4 years agoMerge branch 'js/fetch-multi-lockfix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)] 
Merge branch 'js/fetch-multi-lockfix'

Fetching from multiple remotes into the same repository in parallel
had a bad interaction with the recent change to (optionally) update
the commit-graph after a fetch job finishes, as these parallel
fetches compete with each other.  Which has been corrected.

* js/fetch-multi-lockfix:
  fetch: avoid locking issues between fetch.jobs/fetch.writeCommitGraph
  fetch: add the command-line option `--write-commit-graph`

4 years agoMerge branch 'rs/trace2-dots'
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)] 
Merge branch 'rs/trace2-dots'

Code cleanup.

* rs/trace2-dots:
  trace2: add dots directly to strbuf in perf_fmt_prepare()

4 years agoMerge branch 'kw/fsmonitor-watchman-fix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)] 
Merge branch 'kw/fsmonitor-watchman-fix'

The watchman integration for fsmonitor was racy, which has been
corrected to be more conservative.

* kw/fsmonitor-watchman-fix:
  fsmonitor: fix watchman integration

4 years agoMerge branch 'cb/curl-use-xmalloc'
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)] 
Merge branch 'cb/curl-use-xmalloc'

HTTP transport had possible allocator/deallocator mismatch, which
has been corrected.

* cb/curl-use-xmalloc:
  remote-curl: unbreak http.extraHeader with custom allocators

4 years agoMerge branch 'rt/fetch-message-fix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:32 +0000 (09:04 -0800)] 
Merge branch 'rt/fetch-message-fix'

A small message update.

* rt/fetch-message-fix:
  fetch.c: fix typo in a warning message

4 years agoMerge branch 'es/myfirstcontrib-updates'
Junio C Hamano [Sun, 1 Dec 2019 17:04:32 +0000 (09:04 -0800)] 
Merge branch 'es/myfirstcontrib-updates'

Doc updates.

* es/myfirstcontrib-updates:
  myfirstcontrib: hint to find gitgitgadget allower
  myfirstcontrib: add dependency installation step
  myfirstcontrib: add 'psuh' to command-list.txt

4 years agoMerge branch 'hw/config-doc-in-header'
Junio C Hamano [Sun, 1 Dec 2019 17:04:32 +0000 (09:04 -0800)] 
Merge branch 'hw/config-doc-in-header'

Follow recent push to move API docs from Documentation/ to header
files and update config.h

* hw/config-doc-in-header:
  config: move documentation to config.h

4 years agoMerge branch 'dl/doc-diff-no-index-implies-exit-code'
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)] 
Merge branch 'dl/doc-diff-no-index-implies-exit-code'

Doc update.

* dl/doc-diff-no-index-implies-exit-code:
  git-diff.txt: document return code of `--no-index`

4 years agoMerge branch 'js/vreportf-wo-buffering'
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)] 
Merge branch 'js/vreportf-wo-buffering'

Messages from die() etc. can be mixed up from multiple processes
without even line buffering on Windows, which has been worked
around.

* js/vreportf-wo-buffering:
  vreportf(): avoid relying on stdio buffering

4 years agoMerge branch 'pb/no-recursive-reset-hard-in-worktree-add'
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)] 
Merge branch 'pb/no-recursive-reset-hard-in-worktree-add'

"git worktree add" internally calls "reset --hard" that should not
descend into submodules, even when submodule.recurse configuration
is set, but it was affected.  This has been corrected.

* pb/no-recursive-reset-hard-in-worktree-add:
  worktree: teach "add" to ignore submodule.recurse config

4 years agoMerge branch 'pb/help-list-gitsubmodules-among-guides'
Junio C Hamano [Sun, 1 Dec 2019 17:04:30 +0000 (09:04 -0800)] 
Merge branch 'pb/help-list-gitsubmodules-among-guides'

Help update.

* pb/help-list-gitsubmodules-among-guides:
  help: add gitsubmodules to the list of guides

4 years agoMerge branch 'sg/blame-indent-heuristics-is-now-the-default'
Junio C Hamano [Sun, 1 Dec 2019 17:04:30 +0000 (09:04 -0800)] 
Merge branch 'sg/blame-indent-heuristics-is-now-the-default'

Message update.

* sg/blame-indent-heuristics-is-now-the-default:
  builtin/blame.c: remove '--indent-heuristic' from usage string

4 years agoMerge branch 'mr/clone-dir-exists-to-path-exists'
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)] 
Merge branch 'mr/clone-dir-exists-to-path-exists'

Code cleanup.

* mr/clone-dir-exists-to-path-exists:
  clone: rename static function `dir_exists()`.

4 years agoMerge branch 'ma/bisect-doc-sample-update'
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)] 
Merge branch 'ma/bisect-doc-sample-update'

"git merge --no-commit" needs "--no-ff" if you do not want to move
HEAD, which has been corrected in the manual page for "git bisect".

* ma/bisect-doc-sample-update:
  Documentation/git-bisect.txt: add --no-ff to merge command

4 years agoMerge branch 'js/git-path-head-dot-lock-fix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)] 
Merge branch 'js/git-path-head-dot-lock-fix'

"git rev-parse --git-path HEAD.lock" did not give the right path
when run in a secondary worktree.

* js/git-path-head-dot-lock-fix:
  git_path(): handle `.lock` files correctly
  t1400: wrap setup code in test case

4 years agoMerge branch 'jc/log-graph-simplify'
Junio C Hamano [Sun, 1 Dec 2019 17:04:28 +0000 (09:04 -0800)] 
Merge branch 'jc/log-graph-simplify'

The implementation of "git log --graph" got refactored and then its
output got simplified.

* jc/log-graph-simplify:
  t4215: use helper function to check output
  graph: fix coloring of octopus dashes
  graph: flatten edges that fuse with their right neighbor
  graph: smooth appearance of collapsing edges on commit lines
  graph: rename `new_mapping` to `old_mapping`
  graph: commit and post-merge lines for left-skewed merges
  graph: tidy up display of left-skewed merges
  graph: example of graph output that can be simplified
  graph: extract logic for moving to GRAPH_PRE_COMMIT state
  graph: remove `mapping_idx` and `graph_update_width()`
  graph: reduce duplication in `graph_insert_into_new_columns()`
  graph: reuse `find_new_column_by_commit()`
  graph: handle line padding in `graph_next_line()`
  graph: automatically track display width of graph lines

4 years agoMerge branch 'jk/cleanup-object-parsing-and-fsck'
Junio C Hamano [Sun, 1 Dec 2019 17:04:28 +0000 (09:04 -0800)] 
Merge branch 'jk/cleanup-object-parsing-and-fsck'

Crufty code and logic accumulated over time around the object
parsing and low-level object access used in "git fsck" have been
cleaned up.

* jk/cleanup-object-parsing-and-fsck: (23 commits)
  fsck: accept an oid instead of a "struct tree" for fsck_tree()
  fsck: accept an oid instead of a "struct commit" for fsck_commit()
  fsck: accept an oid instead of a "struct tag" for fsck_tag()
  fsck: rename vague "oid" local variables
  fsck: don't require an object struct in verify_headers()
  fsck: don't require an object struct for fsck_ident()
  fsck: drop blob struct from fsck_finish()
  fsck: accept an oid instead of a "struct blob" for fsck_blob()
  fsck: don't require an object struct for report()
  fsck: only require an oid for skiplist functions
  fsck: only provide oid/type in fsck_error callback
  fsck: don't require object structs for display functions
  fsck: use oids rather than objects for object_name API
  fsck_describe_object(): build on our get_object_name() primitive
  fsck: unify object-name code
  fsck: require an actual buffer for non-blobs
  fsck: stop checking tag->tagged
  fsck: stop checking commit->parent counts
  fsck: stop checking commit->tree value
  commit, tag: don't set parsed bit for parse failures
  ...

4 years agot7004: check existence of correct tag
Martin Ågren [Wed, 13 Nov 2019 19:39:02 +0000 (20:39 +0100)] 
t7004: check existence of correct tag

We try to delete the non-existing tag "anothertag", but for the
verifications, we check that the tag "myhead" doesn't exist. "myhead"
isn't used in this test except for this checking. Comparing to the test
two tests earlier, it looks like a copy-paste mistake.

Perhaps it's overkill to check that `git tag -d` didn't decide to
*create* a tag. But since we're trying to be this careful, let's
actually check the correct tag. While we're doing this, let's use a more
descriptive tag name instead -- "nonexistingtag" should be obvious.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agostash: make sure we have a valid index before writing it
Thomas Gummerer [Wed, 13 Nov 2019 15:01:36 +0000 (15:01 +0000)] 
stash: make sure we have a valid index before writing it

In 'do_apply_stash()' we refresh the index in the end.  Since
34933d0eff ("stash: make sure to write refreshed cache", 2019-09-11),
we also write that refreshed index when --quiet is given to 'git stash
apply'.

However if '--index' is not given to 'git stash apply', we also
discard the index in the else clause just before.  We need to do so
because we use an external 'git update-index --add --stdin', which
leads to an out of date in-core index.

Later we call 'refresh_and_write_cache', which now leads to writing
the discarded index, which means we essentially write an empty index
file.  This is obviously not correct, or the behaviour the user
wanted.  We should not modify the users index without being asked to
do so.

Make sure to re-read the index after discarding the current in-core
index, to avoid dealing with outdated information.  Instead we could
also drop the 'discard_cache()' + 'read_cache()', however that would
make it easy to fall into the same trap as 34933d0eff did, so it's
better to avoid that.

We can also drop the 'refresh_and_write_cache' completely in the quiet
case.  Previously in legacy stash we relied on 'git status' to refresh
the index after calling 'git read-tree' when '--index' was passed to
'git apply'.  However the 'reset_tree()' call that replaced 'git
read-tree' always passes options that are equivalent to '-m', making
the refresh of the index unnecessary.

Reported-by: Grzegorz Rajchman <rayman17@gmail.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosend-pack: check remote ref status on pack-objects failure
Jeff King [Wed, 13 Nov 2019 02:07:19 +0000 (21:07 -0500)] 
send-pack: check remote ref status on pack-objects failure

When we're pushing a pack and our local pack-objects fails, we enter an
error code path that does a few things:

  1. Set the status of every ref to REF_STATUS_NONE

  2. Call receive_unpack_status() to try to get an error report from
     the other side

  3. Return an error to the caller

If pack-objects failed because the connection to the server dropped,
there's not much more we can do than report the hangup. And indeed, step
2 will try to read a packet from the other side, which will die() in the
packet-reading code with "the remote end hung up unexpectedly".

But if the connection _didn't_ die, then the most common issue is that
the remote index-pack or unpack-objects complained about our pack (we
could also have a local pack-objects error, but this ends up being the
same; we'd send an incomplete pack and the remote side would complain).

In that case we do report the error from the other side (because of step
2), but we fail to say anything further about the refs. The issue is
two-fold:

  - in step 1, the "NONE" status is not "we saw an error, so we have no
    status". It generally means "this ref did not match our refspecs, so
    we didn't try to push it". So when we print out the push status
    table, we won't mention any refs at all!

    But even if we had a status enum for "pack-objects error", we
    wouldn't want to blindly set it for every ref. For example, in a
    non-atomic push we might have rejected some refs already on the
    client side (e.g., REF_STATUS_REJECT_NODELETE) and we'd want to
    report that.

  - in step 2, we read just the unpack status. But receive-pack will
    also tell us about each ref (usually that it rejected them because
    of the unpacker error).

So a much better strategy is to leave the ref status fields as they are
(usually EXPECTING_REPORT) and then actually receive (and print) the
full per-ref status.

This case is actually covered in the test suite, as t5504.8, which
writes a pack that will be rejected by the remote unpack-objects. But
it's racy. Because our pack is small, most of the time pack-objects
manages to write the whole thing before the remote rejects it, and so it
returns success and we print out the errors from the remote. But very
occasionally (or when run under --stress) it goes slow enough to see a
failure in writing, and git-push reports nothing for the refs.

With this patch, the test should behave consistently.

There shouldn't be any downside to this approach. If we really did see
the connection drop, we'd already die in receive_unpack_status(), and
we'll continue to do so. If the connection drops _after_ we get the
unpack status but before we see any ref status, we'll still print the
remote unpacker error, but will now say "remote end hung up" instead of
returning the error up the call-stack. But as discussed, we weren't
showing anything more useful than that with the current code. And
anyway, that case is quite unlikely (the connection dropping at that
point would have to be unrelated to the pack-objects error, because of
the ordering of events).

In the future we might want to handle packet-read errors ourself instead
of dying, which would print a full ref status table even for hangups.
But in the meantime, this patch should be a strict improvement.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocompletion: tab-complete "git svn --recursive"
James Shubin [Wed, 13 Nov 2019 00:47:52 +0000 (00:47 +0000)] 
completion: tab-complete "git svn --recursive"

Signed-off-by: James Shubin <james@shubin.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopromisor-remote: remove fetch_if_missing=0
Jonathan Tan [Wed, 13 Nov 2019 00:34:20 +0000 (16:34 -0800)] 
promisor-remote: remove fetch_if_missing=0

Commit 6462d5eb9a ("fetch: remove fetch_if_missing=0", 2019-11-08)
strove to remove the need for fetch_if_missing=0 from the fetching
mechanism, so it is plausible to attempt removing fetch_if_missing=0
from the lazy-fetching mechanism in promisor-remote as well.

But doing so reveals a bug - when the server does not send an object
pointed to by a tag object, an infinite loop occurs: Git attempts to
fetch the missing object, which causes a deferencing of all refs (for
negotiation), which causes a lazy fetch of that missing object, and so
on. This bug is because of unnecessary use of the fetch negotiator
during lazy fetching - it is not used after initialization, but it is
still initialized (which causes the dereferencing of all refs).

Thus, when the negotiator is not used during fetching, refrain from
initializing it. Then, remove fetch_if_missing from promisor-remote.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoclone: remove fetch_if_missing=0
Jonathan Tan [Wed, 13 Nov 2019 00:34:19 +0000 (16:34 -0800)] 
clone: remove fetch_if_missing=0

Commit 6462d5eb9a ("fetch: remove fetch_if_missing=0", 2019-11-08)
strove to remove the need for fetch_if_missing=0 from the fetching
mechanism, so it is plausible to attempt removing fetch_if_missing=0
from clone as well. But doing so reveals a bug - when the server does
not send an object directly pointed to by a ref, this should be an
error, not a trigger for a lazy fetch. (This case in the fetching
mechanism was covered by a test using "git clone", not "git fetch",
which is why the aforementioned commit didn't uncover the bug.)

The bug can be fixed by suppressing lazy-fetching during the
connectivity check. Fix this bug, and remove fetch_if_missing from
clone.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoparse-options: avoid arithmetic on pointer that's potentially NULL
René Scharfe [Tue, 12 Nov 2019 21:41:34 +0000 (22:41 +0100)] 
parse-options: avoid arithmetic on pointer that's potentially NULL

parse_options_dup() counts the number of elements in the given array
without the end marker, allocates enough memory to hold all of them plus
an end marker, then copies them and terminates the new array.  The
counting part is done by advancing a pointer through the array, and the
original pointer is reconstructed using pointer subtraction before the
copy operation.

The function is also prepared to handle a NULL pointer passed to it.
None of its callers do that currently, but this feature was used by
46e91b663b ("checkout: split part of it to new command 'restore'",
2019-04-25); it seems worth keeping.

It ends up doing arithmetic on that NULL pointer, though, which is
undefined in standard C, when it tries to calculate "NULL - 0".  Better
avoid doing that by remembering the originally given pointer value.

There is another issue, though.  memcpy(3) does not support NULL
pointers, even for empty arrays.  Use COPY_ARRAY instead, which does
support such empty arrays.  Its call is also shorter and safer by
inferring the element type automatically.

Coccinelle and contrib/coccinelle/array.cocci did not propose to use
COPY_ARRAY because of the pointer subtraction and because the source is
const -- the semantic patch cautiously only considers pointers and array
references of the same type.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomingw: use COPY_ARRAY for copying array
René Scharfe [Tue, 12 Nov 2019 21:41:14 +0000 (22:41 +0100)] 
mingw: use COPY_ARRAY for copying array

Use the macro COPY_ARRAY to copy array elements.  The result is shorter
and safer, as it infers the element type automatically and does a (very)
basic type compatibility check for its first two arguments.

Coccinelle and contrib/coccinelle/array.cocci did not generate this
conversion due to the offset of 1 at both source and destination and
because the source is a const pointer; the semantic patch cautiously
handles only pure pointers and array references of the same type.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest-tool: use 'read-graph' helper
Derrick Stolee [Tue, 12 Nov 2019 16:58:20 +0000 (16:58 +0000)] 
test-tool: use 'read-graph' helper

The 'git commit-graph read' subcommand is used in test scripts to check
that the commit-graph contents match the expected data. Mostly, this
helps check the header information and the list of chunks. Users do not
need this information, so move the functionality to a test helper.

Reported-by: Bryan Turner <bturner@atlassian.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest-lib: don't check prereqs of test cases that won't be run anyway
SZEDER Gábor [Tue, 12 Nov 2019 12:24:38 +0000 (13:24 +0100)] 
test-lib: don't check prereqs of test cases that won't be run anyway

With './t1234-foo.sh -r 5,6' we can run only specific test cases in a
test script, but our test framwork still evaluates all lazy prereqs
that the excluded test cases might depend on.  This is unnecessary and
produces verbose and trace output that can be distracting.  This has
been an issue ever since the '-r|--run=' options were introduced in
0445e6f0a1 (test-lib: '--run' to run only specific tests, 2014-04-30),
because that commit added the check of the list of test cases
specified with '-r' after evaluating the prereqs.

Avoid this unnecessary prereq evaluation by checking the list of test
cases specified with '-r' before looking at the prereqs.

Note that GIT_SKIP_TESTS has always been checked before the prereqs,
so prereqs necessary for tests skipped that way were not evaluated.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4215: use helper function to check output
Denton Liu [Tue, 12 Nov 2019 18:56:22 +0000 (10:56 -0800)] 
t4215: use helper function to check output

When git commands are placed in the upstream of a pipe, their return
codes are lost. In this particular case, it is especially bad since we
are testing the intricacies of `git log --graph` behavior and if we hit
an unexpected failure or segfault, we want to know this.

Extract the common output checking logic into check_graph() where we
redirect the output of git commands upstream of pipe into a file and
have sed read from that file so that git failures are detected.

This patch is best viewed with `--color-moved`.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsmonitor: do not compare bitmap size with size of split index
Junio C Hamano [Wed, 13 Nov 2019 01:30:05 +0000 (10:30 +0900)] 
fsmonitor: do not compare bitmap size with size of split index

3444ec2e ("fsmonitor: don't fill bitmap with entries to be removed",
2019-10-11) added a handful of sanity checks that make sure that a
bit position in fsmonitor bitmap does not go beyond the end of the
index.  As each bit in the bitmap corresponds to a path in the
index, this is the right check most of the time.

Except for the case when we are in the split-index mode and looking
at a delta index that is to be overlayed on the base index but
before the base index has actually been merged in, namely in read_
and write_fsmonitor_extension().  In these codepaths, the entries in
the split/delta index is typically a small subset of the entire set
of paths (otherwise why would we be using split-index?), so the
bitmap used by the fsmonitor is almost always larger than the number
of entries in the partial index, and the incorrect comparison would
trigger the BUG().

Reported-by: Utsav Shah <ukshah2@illinois.edu>
Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
Helped-by: William Baker <William.Baker@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agohex: drop sha1_to_hex()
Jeff King [Mon, 11 Nov 2019 09:04:18 +0000 (04:04 -0500)] 
hex: drop sha1_to_hex()

There's only a single caller left of sha1_to_hex(), since everybody
that has an object name in "unsigned char[]" now uses hash_to_hex()
instead.

This case is in the sha1dc wrapper, where we print a hex sha1 when
we find a collision. This one will always be sha1, regardless of the
current hash algorithm, so we can't use hash_to_hex() here. In
practice we'd probably not be running sha1 at all if it isn't the
current algorithm, but it's possible we might still occasionally
need to compute a sha1 in a post-sha256 world.

Since sha1_to_hex() is just a wrapper for hash_to_hex_algop(), let's
call that ourselves. There's value in getting rid of the sha1-specific
wrapper to de-clutter the global namespace, and to make sure nobody uses
it (and as with sha1_to_hex_r() in the previous patch, we'll drop the
coccinelle transformations, too).

The sha1_to_hex() function is mentioned in a comment; we can easily
swap that out for oid_to_hex() to give a better example.  Also
update the comment that was left stale when we added "struct
object_id *" as a way to name an object and added functions to
convert it to hex.

The function is also mentioned in some test vectors in t4100, but
that's not runnable code, so there's no point in trying to clean it
up.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocompletion: learn to complete `git rebase --onto=`
Denton Liu [Mon, 11 Nov 2019 21:25:20 +0000 (13:25 -0800)] 
completion: learn to complete `git rebase --onto=`

In 2b9bd488ae ("completion: teach rebase to use __gitcomp_builtin",
2019-09-12), the completion script learned to complete rebase using
__gitcomp_builtin(). However, this resulted in `--onto=` being suggested
instead of `--onto `.

Before, when there was a space, we'd start a new word and, as a result,
fallback to __git_complete_refs() and `--onto` would be completed this
way. However, now we match the `--*` case which does not know how to
offer completions for refs.

Teach _git_rebase() to complete refs in the `--onto=` case so that we
fix this regression.

Reported-by: Paul Jolly <paul@myitcv.io>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopack-objects: avoid pointless oe_map_new_pack() calls
Jeff King [Mon, 11 Nov 2019 11:12:49 +0000 (06:12 -0500)] 
pack-objects: avoid pointless oe_map_new_pack() calls

This patch fixes an extreme slowdown in pack-objects when you have more
than 1023 packs. See below for numbers.

Since 43fa44fa3b (pack-objects: move in_pack out of struct object_entry,
2018-04-14), we use a complicated system to save some per-object memory.

Each object_entry structs gets a 10-bit field to store the index of the
pack it's in. We map those indices into pointers using
packing_data->in_pack_by_idx, which we initialize at the start of the
program. If we have 2^10 or more packs, then we instead create an array
of pack pointers, one per object. This is packing_data->in_pack.

So far so good. But there's one other tricky case: if a new pack arrives
after we've initialized in_pack_by_idx, it won't have an index yet. We
solve that by calling oe_map_new_pack(), which just switches on the fly
to the less-optimal in_pack mechanism, allocating the array and
back-filling it for already-seen objects.

But that logic kicks in even when we've switched to it already (whether
because we really did see a new pack, or because we had too many packs
in the first place). The result doesn't produce a wrong outcome, but
it's very slow. What happens is this:

  - imagine you have a repo with 500k objects and 2000 packs that you
    want to repack.

  - before looking at any objects, we call prepare_in_pack_by_idx(). It
    starts allocating an index for each pack. On the 1024th pack, it
    sees there are too many, so it bails, leaving in_pack_by_idx as
    NULL.

  - while actually adding objects to the packing list, we call
    oe_set_in_pack(), which checks whether the pack already has an
    index. If it's one of the packs after the first 1023, then it
    doesn't have one, and we'll call oe_map_new_pack().

    But there's no useful work for that function to do. We're already
    using in_pack, so it just uselessly walks over the complete list of
    objects, trying to backfill in_pack.

    And we end up doing this for almost 1000 packs (each of which may be
    triggered by more than one object). And each time it triggers, we
    may iterate over up to 500k objects. So in the absolute worst case,
    this is quadratic in the number of objects.

The solution is simple: we don't need to bother checking whether the
pack has an index if we've already converted to using in_pack, since by
definition we're not going to use it. So we can just push the "does the
pack have a valid index" check down into that half of the conditional,
where we know we're going to use it.

The current test in p5303 sadly doesn't notice this problem, since it
maxes out at 1000 packs. If we add a new test to it at 2000 packs, it
does show the improvement:

  Test                      HEAD^               HEAD
  ----------------------------------------------------------------------
  5303.12: repack (2000)    26.72(39.68+0.67)   15.70(28.70+0.66) -41.2%

However, these many-pack test cases are rather expensive to run, so
adding larger and larger numbers isn't appealing. Instead, we can show
it off more easily by using GIT_TEST_FULL_IN_PACK_ARRAY, which forces us
into the absolute worst case: no pack has an index, so we'll trigger
oe_map_new_pack() pointlessly for every single object, making it truly
quadratic.

Here are the numbers (on git.git) with the included change to p5303:

  Test                      HEAD^               HEAD
  ----------------------------------------------------------------------
  5303.3: rev-list (1)      2.05(1.98+0.06)     2.06(1.99+0.06) +0.5%
  5303.4: repack (1)        33.45(33.46+0.19)   2.75(2.73+0.22) -91.8%
  5303.6: rev-list (50)     2.07(2.01+0.06)     2.06(2.01+0.05) -0.5%
  5303.7: repack (50)       34.21(35.18+0.16)   3.49(4.50+0.12) -89.8%
  5303.9: rev-list (1000)   2.87(2.78+0.08)     2.88(2.80+0.07) +0.3%
  5303.10: repack (1000)    41.26(51.30+0.47)   10.75(20.75+0.44) -73.9%

Again, those improvements aren't realistic for the 1-pack case (because
in the real world, the full-array solution doesn't kick in), but it's
more useful to be testing the more-complicated code path.

While we're looking at this issue, we'll tweak one more thing: in
oe_map_new_pack(), we call REALLOC_ARRAY(pack->in_pack). But we'd never
expect to get here unless we're back-filling it for the first time, in
which case it would be NULL. So let's switch that to ALLOC_ARRAY() for
clarity, and add a BUG() to document the expectation. Unfortunately this
code isn't well-covered in the test suite because it's inherently racy
(it only kicks in if somebody else adds a new pack while we're in the
middle of repacking).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agodoc: improve readability of --rebase-merges in git-rebase
Naveen Nathan [Mon, 11 Nov 2019 23:21:37 +0000 (10:21 +1100)] 
doc: improve readability of --rebase-merges in git-rebase

When --preserve-merges was deprecated in 427c3bd28a a sentence
was introduced describing the difference between --rebase-merges and
--preserve-merges which is a little unclear and difficult to parse.
This patch improves readability while retaining original meaning.

Signed-off-by: Naveen Nathan <naveen@lastninja.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agohex: drop sha1_to_hex_r()
Jeff King [Mon, 11 Nov 2019 09:04:11 +0000 (04:04 -0500)] 
hex: drop sha1_to_hex_r()

There are no callers left; everybody uses oid_to_hex_r() or
hash_to_hex_algop_r(). This used to actually be the underlying
implementation for oid_to_hex_r(), but that's no longer the case since
47edb64997 (hex: introduce functions to print arbitrary hashes,
2018-11-14).

Let's get rid of it to de-clutter and to make sure nobody uses it.
Likewise we can drop the coccinelle rules that mention it, since the
compiler will make it quite clear that the code does not work.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosequencer: reencode commit message for am/rebase --show-current-patch
Doan Tran Cong Danh [Mon, 11 Nov 2019 06:03:41 +0000 (13:03 +0700)] 
sequencer: reencode commit message for am/rebase --show-current-patch

The message file will be used as commit message for the
git-{am,rebase} --continue.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosequencer: reencode old merge-commit message
Doan Tran Cong Danh [Mon, 11 Nov 2019 06:03:40 +0000 (13:03 +0700)] 
sequencer: reencode old merge-commit message

During rebasing, old merge's message (encoded in old encoding)
will be used as message for new merge commit (created by rebase).

In case of the value of i18n.commitencoding has been changed after the
old merge time. We will receive an unusable message for this new merge.

Correct it.

This change also notice a breakage with git-rebase label system.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobundle-verify: add --quiet
Robin H. Johnson [Sun, 10 Nov 2019 20:41:26 +0000 (12:41 -0800)] 
bundle-verify: add --quiet

Add --quiet to git-bundle verify as proposed on the mailing list [1].

Reference: https://www.mail-archive.com/git@vger.kernel.org/msg182844.html <robbat2-20190806T191156-796782357Z@orbis-terrarum.net>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobundle-create: progress output control
Robin H. Johnson [Sun, 10 Nov 2019 20:41:25 +0000 (12:41 -0800)] 
bundle-create: progress output control

Support the progress output options from pack-objects in git-bundle's
create subcommand. Most notably, this provides --quiet as requested on
the git mailing list per [1]

Reference: https://www.mail-archive.com/git@vger.kernel.org/msg182844.html <robbat2-20190806T191156-796782357Z@orbis-terrarum.net>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobundle: framework for options before bundle file
Robin H. Johnson [Sun, 10 Nov 2019 20:41:24 +0000 (12:41 -0800)] 
bundle: framework for options before bundle file

Make it possible for any of the git-bundle subcommands to include
options:
- before the sub-command
- after the sub-command, before the bundle filename

There is an immediate gain in support for help with all of the
sub-commands, where 'git bundle list-heads -h' previously returned an
error.

Downside here is an increase in code duplication that cannot be
trivially avoided short of shared global static options.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomerge-strategies: fix typo "reflected to" to "reflected in"
Dominic Jäger [Fri, 8 Nov 2019 14:47:01 +0000 (15:47 +0100)] 
merge-strategies: fix typo "reflected to" to "reflected in"

Signed-off-by: Dominic Jäger <dominic.jaeger@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosequencer: reencode squashing commit's message
Doan Tran Cong Danh [Fri, 8 Nov 2019 09:43:48 +0000 (16:43 +0700)] 
sequencer: reencode squashing commit's message

On fixup/squash-ing rebase, git will create new commit in
i18n.commitencoding, reencode the commit message to that said encode.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosequencer: reencode revert/cherry-pick's todo list
Doan Tran Cong Danh [Fri, 8 Nov 2019 09:43:47 +0000 (16:43 +0700)] 
sequencer: reencode revert/cherry-pick's todo list

Keep revert/cherry-pick's todo list in line with rebase todo list.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosequencer: reencode to utf-8 before arrange rebase's todo list
Doan Tran Cong Danh [Fri, 8 Nov 2019 09:43:46 +0000 (16:43 +0700)] 
sequencer: reencode to utf-8 before arrange rebase's todo list

On musl libc, ISO-2022-JP encoder is too eager to switch back to
1 byte encoding, musl's iconv always switch back after every combining
character. Comparing glibc and musl's output for this command
$ sed q t/t3900/ISO-2022-JP.txt| iconv -f ISO-2022-JP -t utf-8 |
iconv -f utf-8 -t ISO-2022-JP | xxd

glibc:
00000000: 1b24 4224 4f24 6c24 5224 5b24 551b 2842  .$B$O$l$R$[$U.(B
00000010: 0a                                       .

musl:
00000000: 1b24 4224 4f1b 2842 1b24 4224 6c1b 2842  .$B$O.(B.$B$l.(B
00000010: 1b24 4224 521b 2842 1b24 4224 5b1b 2842  .$B$R.(B.$B$[.(B
00000020: 1b24 4224 551b 2842 0a                   .$B$U.(B.

Although musl iconv's output isn't optimal, it's still correct.

From commit 7d509878b8, ("pretty.c: format string with truncate respects
logOutputEncoding", 2014-05-21), we're encoding the message to utf-8
first, then format it and convert the message to the actual output
encoding on git commit --squash.

Thus, t3900::test_commit_autosquash_flags is failing on musl libc.

Reencode to utf-8 before arranging rebase's todo list.

By doing this, we also remove a breakage noticed by a test added in the
previous commit.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3900: demonstrate git-rebase problem with multi encoding
Doan Tran Cong Danh [Fri, 8 Nov 2019 09:43:45 +0000 (16:43 +0700)] 
t3900: demonstrate git-rebase problem with multi encoding

We're using fixup!/squash! <subject> to mark if current commit will be
used to be fixed up or squashed to a previous commit.

However, if we're changing i18n.commitencoding after making the
original commit but before making the fixing up, we couldn't find the
original commit to do the fixup/squash.

Add a test to demonstrate that problem.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconfigure.ac: define ICONV_OMITS_BOM if necessary
Doan Tran Cong Danh [Fri, 8 Nov 2019 09:43:44 +0000 (16:43 +0700)] 
configure.ac: define ICONV_OMITS_BOM if necessary

From commit 79444c9294, ("utf8: handle systems that don't write BOM for
UTF-16", 2019-02-12), we're supporting those systems with iconv that
omits BOM with:

    make ICONV_OMITS_BOM=Yes

However, configure script wasn't taught to detect those systems.

Teach configure to do so.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe first batch post 2.24 cycle
Junio C Hamano [Sun, 10 Nov 2019 09:00:59 +0000 (18:00 +0900)] 
The first batch post 2.24 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'bc/hash-independent-tests-part-6'
Junio C Hamano [Sun, 10 Nov 2019 09:02:17 +0000 (18:02 +0900)] 
Merge branch 'bc/hash-independent-tests-part-6'

Test updates to prepare for SHA-2 transition continues.

* bc/hash-independent-tests-part-6:
  t4048: abstract away SHA-1-specific constants
  t4045: make hash-size independent
  t4044: update test to work with SHA-256
  t4039: abstract away SHA-1-specific constants
  t4038: abstract away SHA-1 specific constants
  t4034: abstract away SHA-1-specific constants
  t4027: make hash-size independent
  t4015: abstract away SHA-1-specific constants
  t4011: abstract away SHA-1-specific constants
  t4010: abstract away SHA-1-specific constants
  t3429: remove SHA1 annotation
  t1305: avoid comparing extensions
  rev-parse: add a --show-object-format option
  t/oid-info: add empty tree and empty blob values
  t/oid-info: allow looking up hash algorithm name

4 years agoMerge branch 'js/update-index-ignore-removal-for-skip-worktree'
Junio C Hamano [Sun, 10 Nov 2019 09:02:16 +0000 (18:02 +0900)] 
Merge branch 'js/update-index-ignore-removal-for-skip-worktree'

"git stash save" in a working tree that is sparsely checked out
mistakenly removed paths that are outside the area of interest.

* js/update-index-ignore-removal-for-skip-worktree:
  stash: handle staged changes in skip-worktree files correctly
  update-index: optionally leave skip-worktree entries alone

4 years agoMerge branch 'pb/pretty-email-without-domain-part'
Junio C Hamano [Sun, 10 Nov 2019 09:02:16 +0000 (18:02 +0900)] 
Merge branch 'pb/pretty-email-without-domain-part'

The custom format for "git log --format=<format>" learned the l/L
placeholder that is similar to e/E that fills in the e-mail
address, but only the local part on the left side of '@'.

* pb/pretty-email-without-domain-part:
  pretty: add "%aL" etc. to show local-part of email addresses
  t4203: use test-lib.sh definitions
  t6006: use test-lib.sh definitions

4 years agoMerge branch 'hw/remove-api-docs-placeholder'
Junio C Hamano [Sun, 10 Nov 2019 09:02:15 +0000 (18:02 +0900)] 
Merge branch 'hw/remove-api-docs-placeholder'

Docfix.

* hw/remove-api-docs-placeholder:
  documentation: remove empty doc files

4 years agoMerge branch 'sg/commit-graph-usage-fix'
Junio C Hamano [Sun, 10 Nov 2019 09:02:15 +0000 (18:02 +0900)] 
Merge branch 'sg/commit-graph-usage-fix'

Message fix.

* sg/commit-graph-usage-fix:
  builtin/commit-graph.c: remove subcommand-less usage string

4 years agoMerge branch 'dl/apply-3way-diff3'
Junio C Hamano [Sun, 10 Nov 2019 09:02:15 +0000 (18:02 +0900)] 
Merge branch 'dl/apply-3way-diff3'

"git apply --3way" learned to honor merge.conflictStyle
configuration variable, like merges would.

* dl/apply-3way-diff3:
  apply: respect merge.conflictStyle in --3way
  t4108: demonstrate bug in apply
  t4108: use `test_config` instead of `git config`
  t4108: remove git command upstream of pipe
  t4108: replace create_file with test_write_lines

4 years agoMerge branch 'sg/dir-trie-fixes'
Junio C Hamano [Sun, 10 Nov 2019 09:02:14 +0000 (18:02 +0900)] 
Merge branch 'sg/dir-trie-fixes'

Code clean-up and a bugfix in the logic used to tell worktree local
and repository global refs apart.

* sg/dir-trie-fixes:
  path.c: don't call the match function without value in trie_find()
  path.c: clarify two field names in 'struct common_dir'
  path.c: mark 'logs/HEAD' in 'common_list' as file
  path.c: clarify trie_find()'s in-code comment
  Documentation: mention more worktree-specific exceptions

4 years agoMerge branch 'jc/am-show-current-patch-docfix'
Junio C Hamano [Sun, 10 Nov 2019 09:02:14 +0000 (18:02 +0900)] 
Merge branch 'jc/am-show-current-patch-docfix'

Doc update.

* jc/am-show-current-patch-docfix:
  doc: am --show-current-patch gives an entire e-mail message

4 years agoMerge branch 'wb/midx-progress'
Junio C Hamano [Sun, 10 Nov 2019 09:02:14 +0000 (18:02 +0900)] 
Merge branch 'wb/midx-progress'

The code to generate multi-pack index learned to show (or not to
show) progress indicators.

* wb/midx-progress:
  multi-pack-index: add [--[no-]progress] option.
  midx: honor the MIDX_PROGRESS flag in midx_repack
  midx: honor the MIDX_PROGRESS flag in verify_midx_file
  midx: add progress to expire_midx_packs
  midx: add progress to write_midx_file
  midx: add MIDX_PROGRESS flag

4 years agoMerge branch 'en/merge-recursive-directory-rename-fixes'
Junio C Hamano [Sun, 10 Nov 2019 09:02:13 +0000 (18:02 +0900)] 
Merge branch 'en/merge-recursive-directory-rename-fixes'

When all files from some subdirectory were renamed to the root
directory, the directory rename heuristics would fail to detect that
as a rename/merge of the subdirectory to the root directory, which has
been corrected.

* en/merge-recursive-directory-rename-fixes:
  t604[236]: do not run setup in separate tests
  merge-recursive: fix merging a subdirectory into the root directory
  merge-recursive: clean up get_renamed_dir_portion()

4 years agoMerge branch 'js/rebase-deprecate-preserve-merges'
Junio C Hamano [Sun, 10 Nov 2019 09:02:13 +0000 (18:02 +0900)] 
Merge branch 'js/rebase-deprecate-preserve-merges'

"git rebase --preserve-merges" has been marked as deprecated; this
release stops advertising it in the "git rebase -h" output.

* js/rebase-deprecate-preserve-merges:
  rebase: hide --preserve-merges option

4 years agoMerge branch 'hv/bitshift-constants-in-blame'
Junio C Hamano [Sun, 10 Nov 2019 09:02:12 +0000 (18:02 +0900)] 
Merge branch 'hv/bitshift-constants-in-blame'

Move the definition of a set of bitmask constants from 0ctal
literal to (1U<<count) notation.

* hv/bitshift-constants-in-blame:
  builtin/blame.c: constants into bit shift format

4 years agoMerge branch 'dd/notes-copy-default-dst-to-head'
Junio C Hamano [Sun, 10 Nov 2019 09:02:12 +0000 (18:02 +0900)] 
Merge branch 'dd/notes-copy-default-dst-to-head'

"git notes copy $original" ought to copy the notes attached to the
original object to HEAD, but a mistaken tightening to command line
parameter validation made earlier disabled that feature by mistake.

* dd/notes-copy-default-dst-to-head:
  notes: fix minimum number of parameters to "copy" subcommand
  t3301: test diagnose messages for too few/many paramters

4 years agoMerge branch 'pw/post-commit-from-sequencer'
Junio C Hamano [Sun, 10 Nov 2019 09:02:12 +0000 (18:02 +0900)] 
Merge branch 'pw/post-commit-from-sequencer'

"rebase -i" ceased to run post-commit hook by mistake in an earlier
update, which has been corrected.

* pw/post-commit-from-sequencer:
  sequencer: run post-commit hook
  move run_commit_hook() to libgit and use it there
  sequencer.h fix placement of #endif
  t3404: remove uneeded calls to set_fake_editor
  t3404: set $EDITOR in subshell
  t3404: remove unnecessary subshell

4 years agoMerge branch 'dl/format-patch-cover-from-desc'
Junio C Hamano [Sun, 10 Nov 2019 09:02:11 +0000 (18:02 +0900)] 
Merge branch 'dl/format-patch-cover-from-desc'

The branch description ("git branch --edit-description") has been
used to fill the body of the cover letters by the format-patch
command; this has been enhanced so that the subject can also be
filled.

* dl/format-patch-cover-from-desc:
  format-patch: teach --cover-from-description option
  format-patch: use enum variables
  format-patch: replace erroneous and condition

4 years agoMerge branch 'es/walken-tutorial'
Junio C Hamano [Sun, 10 Nov 2019 09:02:11 +0000 (18:02 +0900)] 
Merge branch 'es/walken-tutorial'

A tutorial on object enumeration.

* es/walken-tutorial:
  documentation: add tutorial for object walking

4 years agoMerge branch 'jt/fetch-pack-record-refs-in-the-dot-promisor'
Junio C Hamano [Sun, 10 Nov 2019 09:02:10 +0000 (18:02 +0900)] 
Merge branch 'jt/fetch-pack-record-refs-in-the-dot-promisor'

Debugging support for lazy cloning has been a bit improved.

* jt/fetch-pack-record-refs-in-the-dot-promisor:
  fetch-pack: write fetched refs to .promisor

4 years agoconvert: use skip_iprefix() in validate_encoding()
René Scharfe [Fri, 8 Nov 2019 20:27:34 +0000 (21:27 +0100)] 
convert: use skip_iprefix() in validate_encoding()

Use skip_iprefix() to parse "UTF" case-insensitively instead of checking
with istarts_with(), building an upper-case version and then using
skip_prefix() on it.  This gets rid of duplicate code and of a small
allocation.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoutf8: use skip_iprefix() in same_utf_encoding()
René Scharfe [Fri, 8 Nov 2019 20:25:21 +0000 (21:25 +0100)] 
utf8: use skip_iprefix() in same_utf_encoding()

Get rid of magic numbers by using skip_iprefix() and skip_prefix() for
parsing the leading "[uU][tT][fF]-?" of both strings instead of checking
with istarts_with() and an explicit comparison.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoFix spelling errors in no-longer-updated-from-upstream modules
Elijah Newren [Tue, 5 Nov 2019 17:07:30 +0000 (17:07 +0000)] 
Fix spelling errors in no-longer-updated-from-upstream modules

We have several modules originally taken from some upstream source,
and which as far as I can tell we no longer update from the upstream
anymore.  As such, I have not submitted these spelling fixes to any
external projects but just include them directly here.

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomultimail: fix a few simple spelling errors
Elijah Newren [Tue, 5 Nov 2019 17:07:29 +0000 (17:07 +0000)] 
multimail: fix a few simple spelling errors

Also submitted upstream as:
  https://github.com/git-multimail/git-multimail/pull/208

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agosha1dc: fix trivial comment spelling error
Elijah Newren [Tue, 5 Nov 2019 17:07:28 +0000 (17:07 +0000)] 
sha1dc: fix trivial comment spelling error

Also submitted upstream at:
  https://github.com/cr-marcstevens/sha1collisiondetection/pull/52

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoFix spelling errors in test commands
Elijah Newren [Tue, 5 Nov 2019 17:07:27 +0000 (17:07 +0000)] 
Fix spelling errors in test commands

Apply several spelling fixes that technically change what the tests are
executing, but do so in a way that is not tested and does not affect results
(e.g. modify the commit message to remove a typo, remove spelling mistakes
from refnames, etc.)

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoFix spelling errors in messages shown to users
Elijah Newren [Tue, 5 Nov 2019 17:07:26 +0000 (17:07 +0000)] 
Fix spelling errors in messages shown to users

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoFix spelling errors in names of tests
Elijah Newren [Tue, 5 Nov 2019 17:07:25 +0000 (17:07 +0000)] 
Fix spelling errors in names of tests

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoFix spelling errors in comments of testcases
Elijah Newren [Tue, 5 Nov 2019 17:07:24 +0000 (17:07 +0000)] 
Fix spelling errors in comments of testcases

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoFix spelling errors in code comments
Elijah Newren [Tue, 5 Nov 2019 17:07:23 +0000 (17:07 +0000)] 
Fix spelling errors in code comments

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agouserdiff: add Elixir to supported userdiff languages
Łukasz Niemier [Fri, 8 Nov 2019 21:38:24 +0000 (22:38 +0100)] 
userdiff: add Elixir to supported userdiff languages

Adds support for xfuncref in Elixir[1] language which is Ruby-like
language that runs on Erlang[3] Virtual Machine (BEAM).

[1]: https://elixir-lang.org
[2]: https://www.erlang.org

Signed-off-by: Łukasz Niemier <lukasz@niemier.pl>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogit-shortlog.txt: include commit limiting options
Pratyush Yadav [Fri, 8 Nov 2019 19:26:27 +0000 (00:56 +0530)] 
git-shortlog.txt: include commit limiting options

git-shortlog, like git-log, supports options to filter what commits are
used to generate the log. These options come from git-rev-list, and are
documented in Documentation/rev-list-options.txt. Include those options
in shortlog's documentation.

But since rev-list-options.txt contains some other options that don't
really apply in the context of shortlog (like diff formatting, commit
ordering, etc), add a switch in rev-list-options.txt that excludes those
sections from the shortlog documentation. To be more specific, include
only the "Commit Limiting" and "History Simplification" sections.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofetch: remove fetch_if_missing=0
Jonathan Tan [Tue, 5 Nov 2019 18:56:19 +0000 (10:56 -0800)] 
fetch: remove fetch_if_missing=0

In fetch_pack() (and all functions it calls), pass
OBJECT_INFO_SKIP_FETCH_OBJECT whenever we query an object that could be
a tree or blob that we do not want to be lazy-fetched even if it is
absent. Thus, the only lazy-fetches occurring for trees and blobs are
when resolving deltas.

Thus, we can remove fetch_if_missing=0 from builtin/fetch.c. Remove
this, and also add a test ensuring that such objects are not
lazy-fetched. (We might be able to remove fetch_if_missing=0 from other
places too, but I have limited myself to builtin/fetch.c in this commit
because I have not written tests for the other commands yet.)

Note that commits and tags may still be lazy-fetched. I limited myself
to objects that could be trees or blobs here because Git does not
support creating such commit- and tag-excluding clones yet, and even if
such a clone were manually created, Git does not have good support for
fetching a single commit (when fetching a commit, it and all its
ancestors would be sent).

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