]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoMerge branch 'dl/doc-stash-remove-mention-of-reflog'
Junio C Hamano [Fri, 8 May 2020 21:25:09 +0000 (14:25 -0700)] 
Merge branch 'dl/doc-stash-remove-mention-of-reflog'

Doc update.

* dl/doc-stash-remove-mention-of-reflog:
  Doc: reference the "stash list" in autostash docs

3 years agoMerge branch 'cb/avoid-colliding-with-netbsd-hmac'
Junio C Hamano [Fri, 8 May 2020 21:25:09 +0000 (14:25 -0700)] 
Merge branch 'cb/avoid-colliding-with-netbsd-hmac'

The <stdlib.h> header on NetBSD brings in its own definition of
hmac() function (eek), which conflicts with our own and unrelated
function with the same name.  Our function has been renamed to work
around the issue.

* cb/avoid-colliding-with-netbsd-hmac:
  builtin/receive-pack: avoid generic function name hmac()

3 years agoMerge branch 'es/restore-staged-from-head-by-default'
Junio C Hamano [Fri, 8 May 2020 21:25:08 +0000 (14:25 -0700)] 
Merge branch 'es/restore-staged-from-head-by-default'

"git restore --staged --worktree" now defaults to take the contents
out of "HEAD", instead of erring out.

* es/restore-staged-from-head-by-default:
  restore: default to HEAD when combining --staged and --worktree

3 years agoMerge branch 'jk/arith-expansion-coding-guidelines'
Junio C Hamano [Fri, 8 May 2020 21:25:07 +0000 (14:25 -0700)] 
Merge branch 'jk/arith-expansion-coding-guidelines'

The coding guideline for shell scripts instructed to refer to a
variable with dollar-sign inside arithmetic expansion to work
around a bug in old versions of dash, which is a thing of the past.
Now we are not forbidden from writing $((var+1)).

* jk/arith-expansion-coding-guidelines:
  CodingGuidelines: drop arithmetic expansion advice to use "$x"

3 years agoMerge branch 'ds/sparse-allow-empty-working-tree'
Junio C Hamano [Fri, 8 May 2020 21:25:06 +0000 (14:25 -0700)] 
Merge branch 'ds/sparse-allow-empty-working-tree'

The sparse-checkout patterns have been forbidden from excluding all
paths, leaving an empty working tree, for a long time.  This
limitation has been lifted.

* ds/sparse-allow-empty-working-tree:
  sparse-checkout: stop blocking empty workdirs

3 years agoMerge branch 'jt/commit-graph-plug-memleak'
Junio C Hamano [Fri, 8 May 2020 21:25:05 +0000 (14:25 -0700)] 
Merge branch 'jt/commit-graph-plug-memleak'

Fix a leak noticed by fuzzer.

* jt/commit-graph-plug-memleak:
  commit-graph: avoid memory leaks

3 years agoMerge branch 'jk/for-each-ref-multi-key-sort-fix'
Junio C Hamano [Fri, 8 May 2020 21:25:04 +0000 (14:25 -0700)] 
Merge branch 'jk/for-each-ref-multi-key-sort-fix'

"git branch" and other "for-each-ref" variants accepted multiple
--sort=<key> options in the increasing order of precedence, but it
had a few breakages around "--ignore-case" handling, and tie-breaking
with the refname, which have been fixed.

* jk/for-each-ref-multi-key-sort-fix:
  ref-filter: apply fallback refname sort only after all user sorts
  ref-filter: apply --ignore-case to all sorting keys

3 years agoMerge branch 'jk/credential-sample-update'
Junio C Hamano [Fri, 8 May 2020 21:25:02 +0000 (14:25 -0700)] 
Merge branch 'jk/credential-sample-update'

The samples in the credential documentation has been updated to
make it clear that we depict what would appear in the .git/config
file, by adding appropriate quotes as needed..

* jk/credential-sample-update:
  gitcredentials(7): make shell-snippet example more realistic
  gitcredentials(7): clarify quoting of helper examples

3 years agoMerge branch 'ah/userdiff-markdown'
Junio C Hamano [Fri, 8 May 2020 21:25:01 +0000 (14:25 -0700)] 
Merge branch 'ah/userdiff-markdown'

The userdiff patterns for Markdown documents have been added.

* ah/userdiff-markdown:
  userdiff: support Markdown

3 years agoMerge branch 'cb/credential-store-ignore-bogus-lines'
Junio C Hamano [Fri, 8 May 2020 21:25:01 +0000 (14:25 -0700)] 
Merge branch 'cb/credential-store-ignore-bogus-lines'

With the recent tightening of the code that is used to parse
various parts of a URL for use in the credential subsystem, a
hand-edited credential-store file causes the credential helper to
die, which is a bit too harsh to the users.  Demote the error
behaviour to just ignore and keep using well-formed lines instead.

* cb/credential-store-ignore-bogus-lines:
  credential-store: ignore bogus lines from store file
  credential-store: document the file format a bit more

3 years agoMerge branch 'dl/switch-c-option-in-error-message'
Junio C Hamano [Fri, 8 May 2020 21:25:00 +0000 (14:25 -0700)] 
Merge branch 'dl/switch-c-option-in-error-message'

In error messages that "git switch" mentions its option to create a
new branch, "-b/-B" options were shown, where "-c/-C" options
should be, which has been corrected.

* dl/switch-c-option-in-error-message:
  switch: fix errors and comments related to -c and -C

3 years agoDoc: reference the "stash list" in autostash docs
Denton Liu [Tue, 5 May 2020 13:00:59 +0000 (09:00 -0400)] 
Doc: reference the "stash list" in autostash docs

In documentation pertaining to autostash behavior, we refer to the
"stash reflog". This description is too low-level as the reflog refers
to an implementation detail of how the stash works and, for end-users,
they do not need to be aware of this at all.

Change references of "stash reflog" to "stash list", which should
provide more accessible terminology for end-users.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe seventh batch
Junio C Hamano [Tue, 5 May 2020 21:51:29 +0000 (14:51 -0700)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/partial-urlmatch'
Junio C Hamano [Tue, 5 May 2020 21:54:29 +0000 (14:54 -0700)] 
Merge branch 'js/partial-urlmatch'

The same as js/partial-urlmatch-2.17, built on more recent codebase
to avoid unnecessary merge conflicts.

* js/partial-urlmatch:
  credential: handle `credential.<partial-URL>.<key>` again
  credential: optionally allow partial URLs in credential_from_url_gently()

3 years agoMerge branch 'js/partial-urlmatch-2.17'
Junio C Hamano [Tue, 5 May 2020 21:54:29 +0000 (14:54 -0700)] 
Merge branch 'js/partial-urlmatch-2.17'

Recent updates broke parsing of "credential.<url>.<key>" where
<url> is not a full URL (e.g. [credential "https://"] helper = ...)
stopped working, which has been corrected.

* js/partial-urlmatch-2.17:
  credential: handle `credential.<partial-URL>.<key>` again
  credential: optionally allow partial URLs in credential_from_url_gently()
  credential: fix grammar

3 years agoMerge branch 'tb/commit-graph-perm-bits'
Junio C Hamano [Tue, 5 May 2020 21:54:28 +0000 (14:54 -0700)] 
Merge branch 'tb/commit-graph-perm-bits'

Some of the files commit-graph subsystem keeps on disk did not
correctly honor the core.sharedRepository settings and some were
left read-write.

* tb/commit-graph-perm-bits:
  commit-graph.c: make 'commit-graph-chain's read-only
  commit-graph.c: ensure graph layers respect core.sharedRepository
  commit-graph.c: write non-split graphs as read-only
  lockfile.c: introduce 'hold_lock_file_for_update_mode'
  tempfile.c: introduce 'create_tempfile_mode'

3 years agoMerge branch 'dl/push-recurse-submodules-fix'
Junio C Hamano [Tue, 5 May 2020 21:54:28 +0000 (14:54 -0700)] 
Merge branch 'dl/push-recurse-submodules-fix'

Code cleanup.

* dl/push-recurse-submodules-fix:
  push: unset PARSE_OPT_OPTARG for --recurse-submodules

3 years agoMerge branch 'dl/opt-callback-cleanup'
Junio C Hamano [Tue, 5 May 2020 21:54:27 +0000 (14:54 -0700)] 
Merge branch 'dl/opt-callback-cleanup'

Code cleanup.

* dl/opt-callback-cleanup:
  Use OPT_CALLBACK and OPT_CALLBACK_F

3 years agoMerge branch 'jk/test-fail-prereqs-fix'
Junio C Hamano [Tue, 5 May 2020 21:54:27 +0000 (14:54 -0700)] 
Merge branch 'jk/test-fail-prereqs-fix'

Test update.

* jk/test-fail-prereqs-fix:
  t0000: disable GIT_TEST_FAIL_PREREQS in sub-tests

3 years agoMerge branch 'dd/iso-8601-updates'
Junio C Hamano [Tue, 5 May 2020 21:54:26 +0000 (14:54 -0700)] 
Merge branch 'dd/iso-8601-updates'

The approxidate parser learns to parse seconds with fraction.

* dd/iso-8601-updates:
  date.c: allow compact version of ISO-8601 datetime
  date.c: skip fractional second part of ISO-8601
  date.c: validate and set time in a helper function
  date.c: s/is_date/set_date/

3 years agoMerge branch 'bc/wildcard-credential'
Junio C Hamano [Tue, 5 May 2020 21:54:26 +0000 (14:54 -0700)] 
Merge branch 'bc/wildcard-credential'

Update the parser used for credential.<URL>.<variable>
configuration, to handle <URL>s with '/' in them correctly.

* bc/wildcard-credential:
  credential: fix matching URLs with multiple levels in path

3 years agorestore: default to HEAD when combining --staged and --worktree
Eric Sunshine [Tue, 5 May 2020 07:17:16 +0000 (03:17 -0400)] 
restore: default to HEAD when combining --staged and --worktree

By default, files are restored from the index for --worktree, and from
HEAD for --staged. When --worktree and --staged are combined, --source
must be specified to disambiguate the restore source[1], thus making it
cumbersome to restore a file in both the worktree and the index.

However, HEAD is also a reasonable default for --worktree when combined
with --staged, so make it the default anytime --staged is used (whether
combined with --worktree or not).

[1]: Due to an oversight, the --source requirement, though documented,
is not actually enforced.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/receive-pack: avoid generic function name hmac()
Carlo Marcelo Arenas Belón [Tue, 5 May 2020 09:53:26 +0000 (02:53 -0700)] 
builtin/receive-pack: avoid generic function name hmac()

fabec2c5c3 (builtin/receive-pack: switch to use the_hash_algo, 2019-08-18)
renames hmac_sha1 to hmac, as it was updated to use the hash function used
by git (which won't be sha1 in the future).

hmac() is provided by NetBSD >= 8 libc and therefore conflicts as shown by :

builtin/receive-pack.c:421:13: error: conflicting types for 'hmac'
 static void hmac(unsigned char *out,
             ^~~~
In file included from ./git-compat-util.h:172:0,
                 from ./builtin.h:4,
                 from builtin/receive-pack.c:1:
/usr/include/stdlib.h:305:10: note: previous declaration of 'hmac' was here
 ssize_t  hmac(const char *, const void *, size_t, const void *, size_t, void *,
          ^~~~

Rename it again to hmac_hash to reflect it will use the git's defined hash
function and avoid the conflict, while at it update a comment to better
describe the HMAC function that was used.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: avoid memory leaks
Jonathan Tan [Mon, 4 May 2020 19:13:24 +0000 (12:13 -0700)] 
commit-graph: avoid memory leaks

A fuzzer running on the entry point provided by fuzz-commit-graph.c
revealed a memory leak when parse_commit_graph() creates a struct
bloom_filter_settings and then returns early due to error. Fix that
error by always freeing that struct first (if it exists) before
returning early due to error.

While making that change, I also noticed another possible memory leak -
when the BLOOMDATA chunk is provided but not BLOOMINDEXES. Also fix that
error.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: apply fallback refname sort only after all user sorts
Jeff King [Sun, 3 May 2020 09:13:09 +0000 (05:13 -0400)] 
ref-filter: apply fallback refname sort only after all user sorts

Commit 9e468334b4 (ref-filter: fallback on alphabetical comparison,
2015-10-30) taught ref-filter's sort to fallback to comparing refnames.
But it did it at the wrong level, overriding the comparison result for a
single "--sort" key from the user, rather than after all sort keys have
been exhausted.

This worked correctly for a single "--sort" option, but not for multiple
ones. We'd break any ties in the first key with the refname and never
evaluate the second key at all.

To make matters even more interesting, we only applied this fallback
sometimes! For a field like "taggeremail" which requires a string
comparison, we'd truly return the result of strcmp(), even if it was 0.
But for numerical "value" fields like "taggerdate", we did apply the
fallback. And that's why our multiple-sort test missed this: it uses
taggeremail as the main comparison.

So let's start by adding a much more rigorous test. We'll have a set of
commits expressing every combination of two tagger emails, dates, and
refnames. Then we can confirm that our sort is applied with the correct
precedence, and we'll be hitting both the string and value comparators.

That does show the bug, and the fix is simple: moving the fallback to
the outer compare_refs() function, after all ref_sorting keys have been
exhausted.

Note that in the outer function we don't have an "ignore_case" flag, as
it's part of each individual ref_sorting element. It's debatable what
such a fallback should do, since we didn't use the user's keys to match.
But until now we have been trying to respect that flag, so the
least-invasive thing is to try to continue to do so. Since all callers
in the current code either set the flag for all keys or for none, we can
just pull the flag from the first key. In a hypothetical world where the
user really can flip the case-insensitivity of keys separately, we may
want to extend the code to distinguish that case from a blanket
"--ignore-case".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: apply --ignore-case to all sorting keys
Jeff King [Sun, 3 May 2020 09:11:57 +0000 (05:11 -0400)] 
ref-filter: apply --ignore-case to all sorting keys

All of the ref-filter users (for-each-ref, branch, and tag) take an
--ignore-case option which makes filtering and sorting case-insensitive.
However, this option was applied only to the first element of the
ref_sorting list. So:

  git for-each-ref --ignore-case --sort=refname

would do what you expect, but:

  git for-each-ref --ignore-case --sort=refname --sort=taggername

would sort the primary key (taggername) case-insensitively, but sort the
refname case-sensitively. We have two options here:

  - teach callers to set ignore_case on the whole list

  - replace the ref_sorting list with a struct that contains both the
    list of sorting keys, as well as options that apply to _all_
    keys

I went with the first one here, as it gives more flexibility if we later
want to let the users set the flag per-key (presumably through some
special syntax when defining the key; for now it's all or nothing
through --ignore-case).

The new test covers this by sorting on both tagger and subject
case-insensitively, which should compare "a" and "A" identically, but
still sort them before "b" and "B". We'll break ties by sorting on the
refname to give ourselves a stable output (this is actually supposed to
be done automatically, but there's another bug which will be fixed in
the next commit).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosparse-checkout: stop blocking empty workdirs
Derrick Stolee [Mon, 4 May 2020 18:27:43 +0000 (18:27 +0000)] 
sparse-checkout: stop blocking empty workdirs

Remove the error condition when updating the sparse-checkout leaves
an empty working directory.

This behavior was added in 9e1afb167 (sparse checkout: inhibit empty
worktree, 2009-08-20). The comment was added in a7bc906f2 (Add
explanation why we do not allow to sparse checkout to empty working
tree, 2011-09-22) in response to a "dubious" comment in 84563a624
(unpack-trees.c: cosmetic fix, 2010-12-22).

With the recent "cone mode" and "git sparse-checkout init [--cone]"
command, it is common to set a reasonable sparse-checkout pattern
set of

/*
!/*/

which matches only files at root. If the repository has no such files,
then their "git sparse-checkout init" command will fail.

Now that we expect this to be a common pattern, we should not have the
commands fail on an empty working directory. If it is a confusing
result, then the user can recover with "git sparse-checkout disable"
or "git sparse-checkout set". This is especially simple when using cone
mode.

Reported-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoCodingGuidelines: drop arithmetic expansion advice to use "$x"
Jeff King [Mon, 4 May 2020 16:07:09 +0000 (12:07 -0400)] 
CodingGuidelines: drop arithmetic expansion advice to use "$x"

The advice to use "$x" rather than "x" in arithmetric expansion was
working around a dash bug fixed in 0.5.4. Even Debian oldstable has
0.5.8 these days. And in the meantime, we've added almost two dozen
instances of the "x" form which you can find with:

  git grep '$(([a-z]'

and nobody seems to have complained. Let's declare this workaround
obsolete and simplify our style guide.

Helped-by: Danh Doan <congdanhqx@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential-store: ignore bogus lines from store file
Carlo Marcelo Arenas Belón [Sat, 2 May 2020 22:34:47 +0000 (15:34 -0700)] 
credential-store: ignore bogus lines from store file

With the added checks for invalid URLs in credentials, any locally
modified store files which might have empty lines or even comments
were reported[1] failing to parse as valid credentials.

Instead of doing a hard check for credentials, do a soft one and
therefore avoid the reported fatal error.

While at it add tests for all known corruptions that are currently
ignored to keep track of them and avoid the risk of regressions.

[1] https://stackoverflow.com/a/61420852/5005936

Reported-by: Dirk <dirk@ed4u.de>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Based-on-patch-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agouserdiff: support Markdown
Ash Holland [Sat, 2 May 2020 13:15:43 +0000 (14:15 +0100)] 
userdiff: support Markdown

It's typical to find Markdown documentation alongside source code, and
having better context for documentation changes is useful; see also
commit 69f9c87d4 (userdiff: add support for Fountain documents,
2015-07-21).

The pattern is based on the CommonMark specification 0.29, section 4.2
<https://spec.commonmark.org/> but doesn't match empty headings, as
seeing them in a hunk header is unlikely to be useful.

Only ATX headings are supported, as detecting setext headings would
require printing the line before a pattern matches, or matching a
multiline pattern. The word-diff pattern is the same as the pattern for
HTML, because many Markdown parsers accept inline HTML.

Signed-off-by: Ash Holland <ash@sorrel.sh>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe sixth batch
Junio C Hamano [Fri, 1 May 2020 20:37:35 +0000 (13:37 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'jt/v2-fetch-nego-fix'
Junio C Hamano [Fri, 1 May 2020 20:40:00 +0000 (13:40 -0700)] 
Merge branch 'jt/v2-fetch-nego-fix'

The upload-pack protocol v2 gave up too early before finding a
common ancestor, resulting in a wasteful fetch from a fork of a
project.  This has been corrected to match the behaviour of v0
protocol.

* jt/v2-fetch-nego-fix:
  fetch-pack: in protocol v2, reset in_vain upon ACK
  fetch-pack: in protocol v2, in_vain only after ACK
  fetch-pack: return enum from process_acks()

4 years agoMerge branch 'js/anonymise-push-url-in-errors'
Junio C Hamano [Fri, 1 May 2020 20:39:59 +0000 (13:39 -0700)] 
Merge branch 'js/anonymise-push-url-in-errors'

Error and verbose trace messages from "git push" did not redact
credential material embedded in URLs.

* js/anonymise-push-url-in-errors:
  push: anonymize URLs in error messages and warnings

4 years agoMerge branch 'es/bugreport'
Junio C Hamano [Fri, 1 May 2020 20:39:58 +0000 (13:39 -0700)] 
Merge branch 'es/bugreport'

The "bugreport" tool.

* es/bugreport:
  bugreport: drop extraneous includes
  bugreport: add compiler info
  bugreport: add uname info
  bugreport: gather git version and build info
  bugreport: add tool to generate debugging info
  help: move list_config_help to builtin/help

4 years agoMerge branch 'en/rebase-root-and-fork-point-are-incompatible'
Junio C Hamano [Fri, 1 May 2020 20:39:58 +0000 (13:39 -0700)] 
Merge branch 'en/rebase-root-and-fork-point-are-incompatible'

Incompatible options "--root" and "--fork-point" of "git rebase"
have been marked and documented as being incompatible.

* en/rebase-root-and-fork-point-are-incompatible:
  rebase: display an error if --root and --fork-point are both provided

4 years agoMerge branch 'ds/build-homebrew-gettext-fix'
Junio C Hamano [Fri, 1 May 2020 20:39:57 +0000 (13:39 -0700)] 
Merge branch 'ds/build-homebrew-gettext-fix'

Recent update to Homebrew used by macOS folks breaks build by
moving gettext library and necessary headers.

* ds/build-homebrew-gettext-fix:
  macOS/brew: let the build find gettext headers/libraries/msgfmt

4 years agoMerge branch 'dd/sparse-fixes'
Junio C Hamano [Fri, 1 May 2020 20:39:56 +0000 (13:39 -0700)] 
Merge branch 'dd/sparse-fixes'

Compilation fix.

* dd/sparse-fixes:
  progress.c: silence cgcc suggestion about internal linkage
  graph.c: limit linkage of internal variable
  compat/regex: move stdlib.h up in inclusion chain
  test-parse-pathspec-file.c: s/0/NULL/ for pointer type

4 years agoMerge branch 'mt/doc-worktree-ref'
Junio C Hamano [Fri, 1 May 2020 20:39:56 +0000 (13:39 -0700)] 
Merge branch 'mt/doc-worktree-ref'

Docfix.

* mt/doc-worktree-ref:
  config doc: fix reference to config.worktree info

4 years agoMerge branch 'eb/gitweb-more-trailers'
Junio C Hamano [Fri, 1 May 2020 20:39:55 +0000 (13:39 -0700)] 
Merge branch 'eb/gitweb-more-trailers'

Gitweb updates.

* eb/gitweb-more-trailers:
  gitweb: Recognize *-to and Closes/Fixes trailers

4 years agoMerge branch 'ds/multi-pack-index'
Junio C Hamano [Fri, 1 May 2020 20:39:55 +0000 (13:39 -0700)] 
Merge branch 'ds/multi-pack-index'

The multi-pack-index left mmapped file descriptors open when it
does not have to.

* ds/multi-pack-index:
  multi-pack-index: close file descriptor after mmap

4 years agoMerge branch 'ds/blame-on-bloom'
Junio C Hamano [Fri, 1 May 2020 20:39:54 +0000 (13:39 -0700)] 
Merge branch 'ds/blame-on-bloom'

"git blame" learns to take advantage of the "changed-paths" Bloom
filter stored in the commit-graph file.

* ds/blame-on-bloom:
  test-bloom: check that we have expected arguments
  test-bloom: fix some whitespace issues
  blame: drop unused parameter from maybe_changed_path
  blame: use changed-path Bloom filters
  tests: write commit-graph with Bloom filters
  revision: complicated pathspecs disable filters

4 years agoMerge branch 'gs/commit-graph-path-filter'
Junio C Hamano [Fri, 1 May 2020 20:39:53 +0000 (13:39 -0700)] 
Merge branch 'gs/commit-graph-path-filter'

Introduce an extension to the commit-graph to make it efficient to
check for the paths that were modified at each commit using Bloom
filters.

* gs/commit-graph-path-filter:
  bloom: ignore renames when computing changed paths
  commit-graph: add GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS test flag
  t4216: add end to end tests for git log with Bloom filters
  revision.c: add trace2 stats around Bloom filter usage
  revision.c: use Bloom filters to speed up path based revision walks
  commit-graph: add --changed-paths option to write subcommand
  commit-graph: reuse existing Bloom filters during write
  commit-graph: write Bloom filters to commit graph file
  commit-graph: examine commits by generation number
  commit-graph: examine changed-path objects in pack order
  commit-graph: compute Bloom filters for changed paths
  diff: halt tree-diff early after max_changes
  bloom.c: core Bloom filter implementation for changed paths.
  bloom.c: introduce core Bloom filter constructs
  bloom.c: add the murmur3 hash implementation
  commit-graph: define and use MAX_NUM_CHUNKS

4 years agoMerge branch 'tb/commit-graph-fd-exhaustion-fix'
Junio C Hamano [Fri, 1 May 2020 20:39:53 +0000 (13:39 -0700)] 
Merge branch 'tb/commit-graph-fd-exhaustion-fix'

The commit-graph code exhausted file descriptors easily when it
does not have to.

* tb/commit-graph-fd-exhaustion-fix:
  commit-graph: close descriptors after mmap
  commit-graph.c: gracefully handle file descriptor exhaustion
  t/test-lib.sh: make ULIMIT_FILE_DESCRIPTORS available to tests
  commit-graph.c: don't use discarded graph_name in error

4 years agoMerge branch 'tb/commit-graph-split-strategy'
Junio C Hamano [Fri, 1 May 2020 20:39:52 +0000 (13:39 -0700)] 
Merge branch 'tb/commit-graph-split-strategy'

"git commit-graph write" learned different ways to write out split
files.

* tb/commit-graph-split-strategy:
  Revert "commit-graph.c: introduce '--[no-]check-oids'"
  commit-graph.c: introduce '--[no-]check-oids'
  commit-graph.h: replace 'commit_hex' with 'commits'
  oidset: introduce 'oidset_size'
  builtin/commit-graph.c: introduce split strategy 'replace'
  builtin/commit-graph.c: introduce split strategy 'no-merge'
  builtin/commit-graph.c: support for '--split[=<strategy>]'
  t/helper/test-read-graph.c: support commit-graph chains

4 years agoMerge branch 'tb/reset-shallow'
Junio C Hamano [Fri, 1 May 2020 20:39:51 +0000 (13:39 -0700)] 
Merge branch 'tb/reset-shallow'

Fix in-core inconsistency after fetching into a shallow repository
that broke the code to write out commit-graph.

* tb/reset-shallow:
  shallow.c: use '{commit,rollback}_shallow_file'
  t5537: use test_write_lines and indented heredocs for readability

4 years agoMerge branch 'dd/mailinfo-with-nul'
Junio C Hamano [Fri, 1 May 2020 20:39:51 +0000 (13:39 -0700)] 
Merge branch 'dd/mailinfo-with-nul'

Tighten "git mailinfo" to notice and error out when decoded result
contains NUL in it.

* dd/mailinfo-with-nul:
  mailinfo: disallow NUL character in mail's header
  mailinfo.c: avoid strlen on strings that can contains NUL
  t4254: merge 2 steps of a single test

4 years agoMerge branch 'dl/test-must-fail-fixes-4'
Junio C Hamano [Fri, 1 May 2020 20:39:50 +0000 (13:39 -0700)] 
Merge branch 'dl/test-must-fail-fixes-4'

Test clean-up.

* dl/test-must-fail-fixes-4:
  t9819: don't use test_must_fail with p4
  t9164: use test_must_fail only on git commands
  t9160: use test_path_is_missing()
  t9141: use test_path_is_missing()
  t7508: don't use `test_must_fail test_cmp`
  t7408: replace incorrect uses of test_must_fail
  t6030: use test_path_is_missing()

4 years agoMerge branch 'jk/build-with-right-curl'
Junio C Hamano [Fri, 1 May 2020 20:39:49 +0000 (13:39 -0700)] 
Merge branch 'jk/build-with-right-curl'

The build procedure did not use the libcurl library and its include
files correctly for a custom-built installation.

* jk/build-with-right-curl:
  Makefile: avoid running curl-config unnecessarily
  Makefile: use curl-config --cflags
  Makefile: avoid running curl-config multiple times

4 years agogitcredentials(7): make shell-snippet example more realistic
Jeff King [Fri, 1 May 2020 07:33:11 +0000 (03:33 -0400)] 
gitcredentials(7): make shell-snippet example more realistic

There's an example of using your own bit of shell to act as a credential
helper, but it's not very realistic:

 - It's stupid to hand out your secret password to _every_ host. In the
   real world you'd use the config-matcher to limit it to a particular
   host.

 - We never provided a username. We can easily do that in another config
   option (you can do it in the helper, too, but this is much more
   readable).

 - We were sending the secret even for store/erase operations. This
   is OK because Git would just ignore it, but a real system would
   probably be unlocking a password store, which you wouldn't want to do
   more than necessary.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogitcredentials(7): clarify quoting of helper examples
Jeff King [Fri, 1 May 2020 07:33:05 +0000 (03:33 -0400)] 
gitcredentials(7): clarify quoting of helper examples

We give several helper config examples, but don't make clear that these
are raw values. It's up to the user to add the appropriate quoting to
put them into a config file (either by running with "git config" and
quoting against the shell, or by adding double-quotes as appropriate
within the git-config file).

Let's flesh them out as full config blocks, which makes the syntax more
clear (and makes it possible for people to just cut-and-paste them as a
starting point). I added double-quotes to any values larger than a
single word. That isn't strictly necessary in all cases, but it
sidesteps explaining the rules about exactly when you need to quote a
value.

The existing quotes can be converted to single-quotes in one instance,
and backslash-esccaped in the other. I also swapped out backticks for
our preferred $().

Reported-by: douglas.fuller@gmail.com
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoswitch: fix errors and comments related to -c and -C
Denton Liu [Thu, 30 Apr 2020 11:54:57 +0000 (07:54 -0400)] 
switch: fix errors and comments related to -c and -C

In d787d311db (checkout: split part of it to new command 'switch',
2019-03-29), the `git switch` command was created by extracting the
common functionality of cmd_checkout() in checkout_main(). However, in
b7b5fce270 (switch: better names for -b and -B, 2019-03-29), the branch
creation and force creation options for 'switch' were changed to -c and
-C, respectively. As a result of this, error messages and comments that
previously referred to `-b` and `-B` became invalid for `git switch`.

For error messages that refer to `-b` and `-B`, use a format string
instead so that `-c` and `-C` can be printed when `git switch` is
invoked.

Reported-by: Robert Simpson
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe fifth batch
Junio C Hamano [Wed, 29 Apr 2020 23:15:42 +0000 (16:15 -0700)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ps/transactional-update-ref-stdin'
Junio C Hamano [Wed, 29 Apr 2020 23:15:31 +0000 (16:15 -0700)] 
Merge branch 'ps/transactional-update-ref-stdin'

"git update-ref --stdin" learned a handful of new verbs to let the
user control ref update transactions more explicitly, which helps
as an ingredient to implement two-phase commit-style atomic
ref-updates across multiple repositories.

* ps/transactional-update-ref-stdin:
  update-ref: implement interactive transaction handling
  update-ref: read commands in a line-wise fashion
  update-ref: move transaction handling into `update_refs_stdin()`
  update-ref: pass end pointer instead of strbuf
  update-ref: drop unused argument for `parse_refname`
  update-ref: organize commands in an array
  strbuf: provide function to append whole lines
  git-update-ref.txt: add missing word
  refs: fix segfault when aborting empty transaction

4 years agoMerge branch 'en/fill-directory-exponential'
Junio C Hamano [Wed, 29 Apr 2020 23:15:30 +0000 (16:15 -0700)] 
Merge branch 'en/fill-directory-exponential'

The directory traversal code had redundant recursive calls which
made its performance characteristics exponential with respect to
the depth of the tree, which was corrected.

* en/fill-directory-exponential:
  completion: fix 'git add' on paths under an untracked directory
  Fix error-prone fill_directory() API; make it only return matches
  dir: replace double pathspec matching with single in treat_directory()
  dir: include DIR_KEEP_UNTRACKED_CONTENTS handling in treat_directory()
  dir: replace exponential algorithm with a linear one
  dir: refactor treat_directory to clarify control flow
  dir: fix confusion based on variable tense
  dir: fix broken comment
  dir: consolidate treat_path() and treat_one_path()
  dir: fix simple typo in comment
  t3000: add more testcases testing a variety of ls-files issues
  t7063: more thorough status checking

4 years agoMerge branch 'en/sparse-checkout'
Junio C Hamano [Wed, 29 Apr 2020 23:15:30 +0000 (16:15 -0700)] 
Merge branch 'en/sparse-checkout'

"sparse-checkout" UI improvements.

* en/sparse-checkout:
  sparse-checkout: provide a new reapply subcommand
  unpack-trees: failure to set SKIP_WORKTREE bits always just a warning
  unpack-trees: provide warnings on sparse updates for unmerged paths too
  unpack-trees: make sparse path messages sound like warnings
  unpack-trees: split display_error_msgs() into two
  unpack-trees: rename ERROR_* fields meant for warnings to WARNING_*
  unpack-trees: move ERROR_WOULD_LOSE_SUBMODULE earlier
  sparse-checkout: use improved unpack_trees porcelain messages
  sparse-checkout: use new update_sparsity() function
  unpack-trees: add a new update_sparsity() function
  unpack-trees: pull sparse-checkout pattern reading into a new function
  unpack-trees: do not mark a dirty path with SKIP_WORKTREE
  unpack-trees: allow check_updates() to work on a different index
  t1091: make some tests a little more defensive against failures
  unpack-trees: simplify pattern_list freeing
  unpack-trees: simplify verify_absent_sparse()
  unpack-trees: remove unused error type
  unpack-trees: fix minor typo in comment

4 years agoMerge branch 'dd/ci-swap-azure-pipelines-with-github-actions'
Junio C Hamano [Wed, 29 Apr 2020 23:15:29 +0000 (16:15 -0700)] 
Merge branch 'dd/ci-swap-azure-pipelines-with-github-actions'

Update the CI configuration to use GitHub Actions, retiring the one
based on Azure Pipelines.

* dd/ci-swap-azure-pipelines-with-github-actions:
  ci: let GitHub Actions upload failed tests' directories
  ci: add a problem matcher for GitHub Actions
  tests: when run in Bash, annotate test failures with file name/line number
  ci: retire the Azure Pipelines definition
  README: add a build badge for the GitHub Actions runs
  ci: configure GitHub Actions for CI/PR
  ci: run gem with sudo to install asciidoctor
  ci: explicit install all required packages
  ci: fix the `jobname` of the `GETTEXT_POISON` job
  ci/lib: set TERM environment variable if not exist
  ci/lib: allow running in GitHub Actions
  ci/lib: if CI type is unknown, show the environment variables

4 years agoMerge branch 'dd/ci-musl-libc'
Junio C Hamano [Wed, 29 Apr 2020 23:15:28 +0000 (16:15 -0700)] 
Merge branch 'dd/ci-musl-libc'

A new CI job to build and run test suite on linux with musl libc
has been added.

* dd/ci-musl-libc:
  travis: build and test on Linux with musl libc and busybox
  ci/linux32: libify install-dependencies step
  ci: refactor docker runner script
  ci/linux32: parameterise command to switch arch
  ci/lib-docker: preserve required environment variables
  ci: make MAKEFLAGS available inside the Docker container in the Linux32 job

4 years agoMerge branch 'dl/merge-autostash-rebase-quit-fix'
Junio C Hamano [Wed, 29 Apr 2020 23:15:27 +0000 (16:15 -0700)] 
Merge branch 'dl/merge-autostash-rebase-quit-fix'

The stash entry created by "git rebase --autosquash" to keep the
initial dirty state were discarded by mistake upon "git rebase
--quit", which has been corrected.

* dl/merge-autostash-rebase-quit-fix:
  rebase: save autostash entry into stash reflog on --quit

4 years agoMerge branch 'dl/merge-autostash'
Junio C Hamano [Wed, 29 Apr 2020 23:15:27 +0000 (16:15 -0700)] 
Merge branch 'dl/merge-autostash'

"git merge" learns the "--autostash" option.

* dl/merge-autostash: (22 commits)
  pull: pass --autostash to merge
  t5520: make test_pull_autostash() accept expect_parent_num
  merge: teach --autostash option
  sequencer: implement apply_autostash_oid()
  sequencer: implement save_autostash()
  sequencer: unlink autostash in apply_autostash()
  sequencer: extract perform_autostash() from rebase
  rebase: generify create_autostash()
  rebase: extract create_autostash()
  reset: extract reset_head() from rebase
  rebase: generify reset_head()
  rebase: use apply_autostash() from sequencer.c
  sequencer: rename stash_sha1 to stash_oid
  sequencer: make apply_autostash() accept a path
  rebase: use read_oneliner()
  sequencer: make read_oneliner() extern
  sequencer: configurably warn on non-existent files
  sequencer: make read_oneliner() accept flags
  sequencer: make file exists check more efficient
  sequencer: stop leaking buf
  ...

4 years agoRevert "commit-graph.c: introduce '--[no-]check-oids'"
Junio C Hamano [Wed, 29 Apr 2020 19:44:40 +0000 (12:44 -0700)] 
Revert "commit-graph.c: introduce '--[no-]check-oids'"

This reverts commit 7a9ce0269bc0f4ef230f930b3910b70ac3142552,
which has not yet gained consensus.

4 years agocommit-graph.c: make 'commit-graph-chain's read-only
Taylor Blau [Wed, 29 Apr 2020 17:36:46 +0000 (11:36 -0600)] 
commit-graph.c: make 'commit-graph-chain's read-only

In a previous commit, we made incremental graph layers read-only by
using 'git_mkstemp_mode' with permissions '0444'.

There is no reason that 'commit-graph-chain's should be modifiable by
the user, since they are generated at a temporary location and then
atomically renamed into place.

To ensure that these files are read-only, too, use
'hold_lock_file_for_update_mode' with the same read-only permission
bits, and let the umask and 'adjust_shared_perm' take care of the rest.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocommit-graph.c: ensure graph layers respect core.sharedRepository
Taylor Blau [Wed, 29 Apr 2020 17:36:42 +0000 (11:36 -0600)] 
commit-graph.c: ensure graph layers respect core.sharedRepository

Non-layered commit-graphs use 'adjust_shared_perm' to make the
commit-graph file readable (or not) to a combination of the user, group,
and others.

Call 'adjust_shared_perm' for split-graph layers to make sure that these
also respect 'core.sharedRepository'. The 'commit-graph-chain' file
already respects this configuration since it uses
'hold_lock_file_for_update' (which calls 'adjust_shared_perm' eventually
in 'create_tempfile_mode').

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocommit-graph.c: write non-split graphs as read-only
Taylor Blau [Wed, 29 Apr 2020 17:36:38 +0000 (11:36 -0600)] 
commit-graph.c: write non-split graphs as read-only

In the previous commit, Git learned 'hold_lock_file_for_update_mode' to
allow the caller to specify the permission bits (prior to further
adjustment by the umask and shared repository permissions) used when
acquiring a temporary file.

Use this in the commit-graph machinery for writing a non-split graph to
acquire an opened temporary file with permissions read-only permissions
to match the split behavior. (In the split case, Git uses
git_mkstemp_mode' for each of the commit-graph layers with permission
bits '0444').

One can notice this discrepancy when moving a non-split graph to be part
of a new chain. This causes a commit-graph chain where all layers have
read-only permission bits, except for the base layer, which is writable
for the current user.

Resolve this discrepancy by using the new
'hold_lock_file_for_update_mode' and passing the desired permission
bits.

Doing so causes some test fallout in t5318 and t6600. In t5318, this
occurs in tests that corrupt a commit-graph file by writing into it. For
these, 'chmod u+w'-ing the file beforehand resolves the issue. The
additional spot in 'corrupt_graph_verify' is necessary because of the
extra 'git commit-graph write' beforehand (which *does* rewrite the
commit-graph file). In t6600, this is caused by copying a read-only
commit-graph file into place and then trying to replace it. For these,
make these files writable.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoSync with js/partial-urlmatch-2.17
Junio C Hamano [Wed, 29 Apr 2020 15:39:06 +0000 (08:39 -0700)] 
Sync with js/partial-urlmatch-2.17

4 years agocredential: handle `credential.<partial-URL>.<key>` again
Johannes Schindelin [Fri, 24 Apr 2020 11:49:52 +0000 (11:49 +0000)] 
credential: handle `credential.<partial-URL>.<key>` again

In the patches for CVE-2020-11008, the ability to specify credential
settings in the config for partial URLs got lost. For example, it used
to be possible to specify a credential helper for a specific protocol:

[credential "https://"]
helper = my-https-helper

Likewise, it used to be possible to configure settings for a specific
host, e.g.:

[credential "dev.azure.com"]
useHTTPPath = true

Let's reinstate this behavior.

While at it, increase the test coverage to document and verify the
behavior with a couple other categories of partial URLs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocredential-store: document the file format a bit more
Junio C Hamano [Tue, 28 Apr 2020 18:15:15 +0000 (11:15 -0700)] 
credential-store: document the file format a bit more

Reading a malformed credential URL line and silently ignoring it
does not mean that we support empty lines and/or "# commented" lines
forever.  We should document it to avoid confusion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe fourth batch
Junio C Hamano [Tue, 28 Apr 2020 22:50:33 +0000 (15:50 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'jn/demote-proto2-from-default'
Junio C Hamano [Tue, 28 Apr 2020 22:50:11 +0000 (15:50 -0700)] 
Merge branch 'jn/demote-proto2-from-default'

Those fetching over protocol v2 from linux-next and other kernel
repositories are reporting that v2 often fetches way too much than
needed.

* jn/demote-proto2-from-default:
  Revert "fetch: default to protocol version 2"

4 years agoMerge branch 'jc/gnu-hurd-lets-fread-read-dirs'
Junio C Hamano [Tue, 28 Apr 2020 22:50:11 +0000 (15:50 -0700)] 
Merge branch 'jc/gnu-hurd-lets-fread-read-dirs'

GNU/Hurd is also among the ones that need the fopen() wrapper.

* jc/gnu-hurd-lets-fread-read-dirs:
  config.mak.uname: Define FREAD_READS_DIRECTORIES for GNU/Hurd

4 years agoMerge branch 'ms/doc-revision-illustration-fix'
Junio C Hamano [Tue, 28 Apr 2020 22:50:10 +0000 (15:50 -0700)] 
Merge branch 'ms/doc-revision-illustration-fix'

Docfix.

* ms/doc-revision-illustration-fix:
  docs: fix minor glitch in illustration

4 years agoMerge branch 'tm/zsh-complete-switch-restore'
Junio C Hamano [Tue, 28 Apr 2020 22:50:09 +0000 (15:50 -0700)] 
Merge branch 'tm/zsh-complete-switch-restore'

zsh command line completion (in contrib/) update.

* tm/zsh-complete-switch-restore:
  complete: zsh: add missing sub cmd completion candidates

4 years agoMerge branch 'mt/grep-cquote-path'
Junio C Hamano [Tue, 28 Apr 2020 22:50:09 +0000 (15:50 -0700)] 
Merge branch 'mt/grep-cquote-path'

"git grep" did not quote a path with unusual character like other
commands (like "git diff", "git status") do, but did quote when run
from a subdirectory, both of which has been corrected.

* mt/grep-cquote-path:
  grep: follow conventions for printing paths w/ unusual chars

4 years agoMerge branch 'ds/log-exclude-decoration-config'
Junio C Hamano [Tue, 28 Apr 2020 22:50:08 +0000 (15:50 -0700)] 
Merge branch 'ds/log-exclude-decoration-config'

The "--decorate-refs" and "--decorate-refs-exclude" options "git
log" takes have learned a companion configuration variable
log.excludeDecoration that sits at the lowest priority in the
family.

* ds/log-exclude-decoration-config:
  log: add log.excludeDecoration config option
  log-tree: make ref_filter_match() a helper method

4 years agoMerge branch 'vd/range-diff-with-custom-pretty-format-fix'
Junio C Hamano [Tue, 28 Apr 2020 22:50:07 +0000 (15:50 -0700)] 
Merge branch 'vd/range-diff-with-custom-pretty-format-fix'

"git range-diff" fixes.

* vd/range-diff-with-custom-pretty-format-fix:
  range-diff: avoid negative string precision
  range-diff: fix a crash in parsing git-log output

4 years agoMerge branch 'tb/diff-tree-with-notes'
Junio C Hamano [Tue, 28 Apr 2020 22:50:07 +0000 (15:50 -0700)] 
Merge branch 'tb/diff-tree-with-notes'

"git diff-tree --pretty --notes" used to hit an assertion failure,
as it forgot to initialize the notes subsystem.

* tb/diff-tree-with-notes:
  diff-tree.c: load notes machinery when required

4 years agoMerge branch 'eb/mboxrd-doc'
Junio C Hamano [Tue, 28 Apr 2020 22:50:06 +0000 (15:50 -0700)] 
Merge branch 'eb/mboxrd-doc'

Doc update.

* eb/mboxrd-doc:
  Documentation: explain "mboxrd" pretty format

4 years agoMerge branch 'js/stash-p-fix'
Junio C Hamano [Tue, 28 Apr 2020 22:50:06 +0000 (15:50 -0700)] 
Merge branch 'js/stash-p-fix'

Allowing the user to split a patch hunk while "git stash -p" does
not work well; a band-aid has been added to make this (partially)
work better.

* js/stash-p-fix:
  stash -p: (partially) fix bug concerning split hunks
  t3904: fix incorrect demonstration of a bug

4 years agoMerge branch 'dl/libify-a-few'
Junio C Hamano [Tue, 28 Apr 2020 22:50:05 +0000 (15:50 -0700)] 
Merge branch 'dl/libify-a-few'

Code in builtin/*, i.e. those can only be called from within
built-in subcommands, that implements bulk of a couple of
subcommands have been moved to libgit.a so that they could be used
by others.

* dl/libify-a-few:
  Lib-ify prune-packed
  Lib-ify fmt-merge-msg

4 years agoMerge branch 'jx/atomic-push'
Junio C Hamano [Tue, 28 Apr 2020 22:50:04 +0000 (15:50 -0700)] 
Merge branch 'jx/atomic-push'

"git push --atomic" used to show failures for refs that weren't
even pushed, which has been corrected.

* jx/atomic-push:
  transport-helper: new method reject_atomic_push()
  transport-helper: mark failure for atomic push
  send-pack: mark failure of atomic push properly
  t5543: never report what we do not push
  send-pack: fix inconsistent porcelain output

4 years agoMerge branch 'jt/avoid-prefetch-when-able-in-diff'
Junio C Hamano [Tue, 28 Apr 2020 22:50:04 +0000 (15:50 -0700)] 
Merge branch 'jt/avoid-prefetch-when-able-in-diff'

"git diff" in a partial clone learned to avoid lazy loading blob
objects in more casese when they are not needed.

* jt/avoid-prefetch-when-able-in-diff:
  diff: restrict when prefetching occurs
  diff: refactor object read
  diff: make diff_populate_filespec_options struct
  promisor-remote: accept 0 as oid_nr in function

4 years agoMerge branch 'js/subtree-doc-update-to-asciidoctor-2'
Junio C Hamano [Tue, 28 Apr 2020 22:50:03 +0000 (15:50 -0700)] 
Merge branch 'js/subtree-doc-update-to-asciidoctor-2'

Doc markup update.

* js/subtree-doc-update-to-asciidoctor-2:
  subtree: fix build with AsciiDoctor 2

4 years agoMerge branch 'ds/t5319-touch-fix'
Junio C Hamano [Tue, 28 Apr 2020 22:50:02 +0000 (15:50 -0700)] 
Merge branch 'ds/t5319-touch-fix'

Tests update to use "test-chmtime" instead of "touch -t".

* ds/t5319-touch-fix:
  t5319: replace 'touch -m' with 'test-tool chmtime'

4 years agoMerge branch 'ds/commit-graph-expiry-fix'
Junio C Hamano [Tue, 28 Apr 2020 22:50:02 +0000 (15:50 -0700)] 
Merge branch 'ds/commit-graph-expiry-fix'

"git commit-graph write --expire-time=<timestamp>" did not use the
given timestamp correctly, which has been corrected.

* ds/commit-graph-expiry-fix:
  commit-graph: fix buggy --expire-time option

4 years agoMerge branch 'dr/doc-recurse-submodules'
Junio C Hamano [Tue, 28 Apr 2020 22:50:01 +0000 (15:50 -0700)] 
Merge branch 'dr/doc-recurse-submodules'

Documentation updates around the "--recurse-submodules" option.

* dr/doc-recurse-submodules:
  doc: --recurse-submodules mostly applies to active submodules
  doc: be more precise on (fetch|push).recurseSubmodules
  doc: explain how to deactivate submodule.recurse completely
  doc: document --recurse-submodules for reset and restore
  doc: list all commands affected by submodule.recurse

4 years agoMerge branch 'jc/log-no-mailmap'
Junio C Hamano [Tue, 28 Apr 2020 22:50:00 +0000 (15:50 -0700)] 
Merge branch 'jc/log-no-mailmap'

"git log" learns "--[no-]mailmap" as a synonym to "--[no-]use-mailmap"

* jc/log-no-mailmap:
  log: give --[no-]use-mailmap a more sensible synonym --[no-]mailmap
  clone: reorder --recursive/--recurse-submodules
  parse-options: teach "git cmd -h" to show alias as alias

4 years agoMerge branch 'ma/doc-discard-docbook-xsl-1.73'
Junio C Hamano [Tue, 28 Apr 2020 22:50:00 +0000 (15:50 -0700)] 
Merge branch 'ma/doc-discard-docbook-xsl-1.73'

Raise the minimum required version of docbook-xsl package to 1.74,
as 1.74.0 was from late 2008, which is more than 10 years old, and
drop compatibility cruft from our documentation suite.

* ma/doc-discard-docbook-xsl-1.73:
  user-manual.conf: don't specify [listingblock]
  INSTALL: drop support for docbook-xsl before 1.74
  manpage-normal.xsl: fold in manpage-base.xsl
  manpage-bold-literal.xsl: stop using git.docbook.backslash
  Doc: drop support for docbook-xsl before 1.73.0
  Doc: drop support for docbook-xsl before 1.72.0
  Doc: drop support for docbook-xsl before 1.71.1

4 years agoMerge branch 'lx/submodule-clear-variables'
Junio C Hamano [Tue, 28 Apr 2020 22:49:59 +0000 (15:49 -0700)] 
Merge branch 'lx/submodule-clear-variables'

The "git submodule" command did not initialize a few variables it
internally uses and was affected by variable settings leaked from
the environment.

* lx/submodule-clear-variables:
  git-submodule.sh: setup uninitialized variables

4 years agoMerge branch 'jk/fast-import-use-hashmap'
Junio C Hamano [Tue, 28 Apr 2020 22:49:58 +0000 (15:49 -0700)] 
Merge branch 'jk/fast-import-use-hashmap'

The custom hash function used by "git fast-import" has been
replaced with the one from hashmap.c, which gave us a nice
performance boost.

* jk/fast-import-use-hashmap:
  fast-import: replace custom hash with hashmap.c

4 years agoMerge branch 'jk/config-use-size-t'
Junio C Hamano [Tue, 28 Apr 2020 22:49:58 +0000 (15:49 -0700)] 
Merge branch 'jk/config-use-size-t'

The config API made mixed uses of int and size_t types to represent
length of various pieces of text it parsed, which has been updated
to use the correct type (i.e. size_t) throughout.

* jk/config-use-size-t:
  config: reject parsing of files over INT_MAX
  config: use size_t to store parsed variable baselen
  git_config_parse_key(): return baselen as size_t
  config: drop useless length variable in write_pair()
  parse_config_key(): return subsection len as size_t
  remote: drop auto-strlen behavior of make_branch() and make_rewrite()

4 years agoMerge branch 'bc/constant-memequal'
Junio C Hamano [Tue, 28 Apr 2020 22:49:57 +0000 (15:49 -0700)] 
Merge branch 'bc/constant-memequal'

Validation of push certificate has been made more robust against
timing attacks.

* bc/constant-memequal:
  receive-pack: compilation fix
  builtin/receive-pack: use constant-time comparison for HMAC value

4 years agoMerge branch 'lr/freshen-file-fix'
Junio C Hamano [Tue, 28 Apr 2020 22:49:56 +0000 (15:49 -0700)] 
Merge branch 'lr/freshen-file-fix'

The code that refreshes the last access and modified time of
on-disk packfiles and loose object files have been updated.

* lr/freshen-file-fix:
  freshen_file(): use NULL `times' for implicit current-time

4 years agoMerge branch 'en/rebase-doc-hooks-called-by-accident'
Junio C Hamano [Tue, 28 Apr 2020 22:49:56 +0000 (15:49 -0700)] 
Merge branch 'en/rebase-doc-hooks-called-by-accident'

"git rebase" happens to call some hooks meant for "checkout" and
"commit" by this was not a designed behaviour than historical
accident.  This has been documented.

* en/rebase-doc-hooks-called-by-accident:
  git-rebase.txt: add another hook to the hooks section, and explain more

4 years agoMerge branch 'jc/doc-test-leaving-early'
Junio C Hamano [Tue, 28 Apr 2020 22:49:55 +0000 (15:49 -0700)] 
Merge branch 'jc/doc-test-leaving-early'

Document the recommended way to abort a failing test early (e.g. by
exiting a loop), which is to say "return 1".

* jc/doc-test-leaving-early:
  t/README: suggest how to leave test early with failure

4 years agoMerge branch 'dd/test-with-busybox'
Junio C Hamano [Tue, 28 Apr 2020 22:49:54 +0000 (15:49 -0700)] 
Merge branch 'dd/test-with-busybox'

Various tests have been updated to work around issues found with
shell utilities that come with busybox etc.

* dd/test-with-busybox:
  t5703: feed raw data into test-tool unpack-sideband
  t4124: tweak test so that non-compliant diff(1) can also be used
  t7063: drop non-POSIX argument "-ls" from find(1)
  t5616: use rev-parse instead to get HEAD's object_id
  t5003: skip conversion test if unzip -a is unavailable
  t5003: drop the subshell in test_lazy_prereq
  test-lib-functions: test_cmp: eval $GIT_TEST_CMP
  t4061: use POSIX compliant regex(7)

4 years agopush: anonymize URLs in error messages and warnings
Johannes Schindelin [Fri, 24 Apr 2020 14:20:08 +0000 (14:20 +0000)] 
push: anonymize URLs in error messages and warnings

Just like 47abd85ba0 (fetch: Strip usernames from url's before storing
them, 2009-04-17) and later 882d49ca5c (push: anonymize URL in status
output, 2016-07-13), and even later c1284b21f243 (curl: anonymize URLs
in error messages and warnings, 2019-03-04) this change anonymizes URLs
(read: strips them of user names and especially passwords) in
user-facing error messages and warnings.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase: save autostash entry into stash reflog on --quit
Denton Liu [Tue, 28 Apr 2020 09:31:31 +0000 (05:31 -0400)] 
rebase: save autostash entry into stash reflog on --quit

In a03b55530a (merge: teach --autostash option, 2020-04-07), the
--autostash option was introduced for `git merge`. Notably, when
`git merge --quit` is run with an autostash entry present, it is saved
into the stash reflog. This is contrasted with the current behaviour of
`git rebase --quit` where the autostash entry is simply just dropped out
of existence.

Adopt the behaviour of `git merge --quit` in `git rebase --quit` and
save the autostash entry into the stash reflog instead of just deleting
it.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopush: unset PARSE_OPT_OPTARG for --recurse-submodules
Denton Liu [Mon, 27 Apr 2020 06:44:08 +0000 (02:44 -0400)] 
push: unset PARSE_OPT_OPTARG for --recurse-submodules

When the usage for `git push` is shown, it includes the following
lines

--recurse-submodules[=(check|on-demand|no)]
      control recursive pushing of submodules

which seem to indicate that the argument for --recurse-submodules is
optional. However, we cannot actually run that optiion without an
argument:

$ git push --recurse-submodules
fatal: recurse-submodules missing parameter

Unset PARSE_OPT_OPTARG so that it is clear that this option requires an
argument. Since the parse-options machinery guarantees that an argument
is present now, assume that `arg` is set in the else of
option_parse_recurse_submodules().

Reported-by: Andrew White <andrew.white@audinate.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoUse OPT_CALLBACK and OPT_CALLBACK_F
Denton Liu [Tue, 28 Apr 2020 08:36:28 +0000 (04:36 -0400)] 
Use OPT_CALLBACK and OPT_CALLBACK_F

In the codebase, there are many options which use OPTION_CALLBACK in a
plain ol' struct definition. However, we have the OPT_CALLBACK and
OPT_CALLBACK_F macros which are meant to abstract these plain struct
definitions away. These macros are useful as they semantically signal to
developers that these are just normal callback option with nothing fancy
happening.

Replace plain struct definitions of OPTION_CALLBACK with OPT_CALLBACK or
OPT_CALLBACK_F where applicable. The heavy lifting was done using the
following (disgusting) shell script:

#!/bin/sh

do_replacement () {
tr '\n' '\r' |
sed -e 's/{\s*OPTION_CALLBACK,\s*\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\s*0,\(\s*[^[:space:]}]*\)\s*}/OPT_CALLBACK(\1,\2,\3,\4,\5,\6)/g' |
sed -e 's/{\s*OPTION_CALLBACK,\s*\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\(\s*[^[:space:]}]*\)\s*}/OPT_CALLBACK_F(\1,\2,\3,\4,\5,\6,\7)/g' |
tr '\r' '\n'
}

for f in $(git ls-files \*.c)
do
do_replacement <"$f" >"$f.tmp"
mv "$f.tmp" "$f"
done

The result was manually inspected and then reformatted to match the
style of the surrounding code. Finally, using
`git grep OPTION_CALLBACK \*.c`, leftover results which were not handled
by the script were manually transformed.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot0000: disable GIT_TEST_FAIL_PREREQS in sub-tests
Jeff King [Tue, 28 Apr 2020 08:14:21 +0000 (04:14 -0400)] 
t0000: disable GIT_TEST_FAIL_PREREQS in sub-tests

The test added by 477dcaddb6 (tests: do not let lazy prereqs inside
`test_expect_*` turn off tracing, 2020-03-26) runs a sub-test script
that traces a test with a lazy prereq, like:

  test_have_prereq LAZY && echo trace

That won't work if GIT_TEST_FAIL_PREREQS is set in the environment,
because our have_prereq will report failure, and we won't run the echo
at all.

We could work around this by avoiding the &&-chain, but we can
fix this and any future tests at once by unsetting that variable for our
sub-tests. These are meant to be controlled environments where we test
the test-suite itself; the outer test snippet should be in charge of the
sub-test environment, not whatever mode the user happens to be running
in.

Reported-by: Son Luong Ngoc <sluongng@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofetch-pack: in protocol v2, reset in_vain upon ACK
Jonathan Tan [Tue, 28 Apr 2020 00:01:10 +0000 (17:01 -0700)] 
fetch-pack: in protocol v2, reset in_vain upon ACK

In the function process_acks() in fetch-pack.c, the variable
received_ack is meant to track that an ACK was received, but it was
never set. This results in negotiation terminating prematurely through
the in_vain counter, when the counter should have been reset upon every
ACK.

Therefore, reset the in_vain counter upon every ACK.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>