]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agocommit-graph: fix progress of reachable commits
SZEDER Gábor [Thu, 9 Jul 2020 16:54:32 +0000 (18:54 +0200)] 
commit-graph: fix progress of reachable commits

To display a progress line while iterating over all refs,
d335ce8f24 (commit-graph.c: show progress of finding reachable
commits, 2020-05-13) should have added a pair of
start_delayed_progress() and stop_progress() calls around a
for_each_ref() invocation.  Alas, the stop_progress() call ended up at
the wrong place, after write_commit_graph(), which does all the
commit-graph computation and writing, and has several progress lines
of its own.  Consequently, that new

  Collecting referenced commits: 123

progress line is overwritten by the first progress line shown by
write_commit_graph(), and its final "done" line is shown last, after
everything is finished:

  Expanding reachable commits in commit graph: 344786, done.
  Computing commit changed paths Bloom filters: 100% (344786/344786), done.
  Collecting referenced commits: 154, done.

Move that stop_progress() call to the right place.

While at it, drop the unnecessary 'if (data.progress)' condition
protecting the stop_progress() call, because that function is prepared
to handle a NULL progress struct.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: drop COMMIT_GRAPH_WRITE_CHECK_OIDS flag
Taylor Blau [Wed, 13 May 2020 21:59:55 +0000 (15:59 -0600)] 
commit-graph: drop COMMIT_GRAPH_WRITE_CHECK_OIDS flag

Since 7c5c9b9c57 (commit-graph: error out on invalid commit oids in
'write --stdin-commits', 2019-08-05), the commit-graph builtin dies on
receiving non-commit OIDs as input to '--stdin-commits'.

This behavior can be cumbersome to work around in, say, the case of
piping 'git for-each-ref' to 'git commit-graph write --stdin-commits' if
the caller does not want to cull out non-commits themselves. In this
situation, it would be ideal if 'git commit-graph write' wrote the graph
containing the inputs that did pertain to commits, and silently ignored
the remainder of the input.

Some options have been proposed to the effect of '--[no-]check-oids'
which would allow callers to have the commit-graph builtin do just that.
After some discussion, it is difficult to imagine a caller who wouldn't
want to pass '--no-check-oids', suggesting that we should get rid of the
behavior of complaining about non-commit inputs altogether.

If callers do wish to retain this behavior, they can easily work around
this change by doing the following:

     git for-each-ref --format='%(objectname) %(objecttype) %(*objecttype)' |
     awk '
       !/commit/ { print "not-a-commit:"$1 }
        /commit/ { print $1 }
     ' |
     git commit-graph write --stdin-commits

To make it so that valid OIDs that refer to non-existent objects are
indeed an error after loosening the error handling, perform an extra
lookup to make sure that object indeed exists before sending it to the
commit-graph internals.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5318: reorder test below 'graph_read_expect'
Taylor Blau [Wed, 13 May 2020 21:59:51 +0000 (15:59 -0600)] 
t5318: reorder test below 'graph_read_expect'

In the subsequent commit, we will introduce a dependency on
'graph_read_expect' from t5318.7. Preemptively move it below
'graph_read_expect()'s definition so that the test can call it.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph.c: simplify 'fill_oids_from_commits'
Taylor Blau [Wed, 13 May 2020 21:59:47 +0000 (15:59 -0600)] 
commit-graph.c: simplify 'fill_oids_from_commits'

In the previous handful of commits, both 'git commit-graph write
--reachable' and '--stdin-commits' learned to peel tags down to the
commits which they refer to before passing them into the commit-graph
internals.

This makes the call to 'lookup_commit_reference_gently()' inside of
'fill_oids_from_commits()' a noop, since all OIDs are commits by that
point.

As such, remove the call entirely, as well as the progress meter, which
has been split and moved out to the callers in the aforementioned
earlier commits.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/commit-graph.c: dereference tags in builtin
Taylor Blau [Wed, 13 May 2020 21:59:44 +0000 (15:59 -0600)] 
builtin/commit-graph.c: dereference tags in builtin

When given a list of commits, the commit-graph machinery calls
'lookup_commit_reference_gently()' on each element in the set and treats
the resulting set of OIDs as the base over which to close for
reachability.

In an earlier collection of commits, the 'git commit-graph write
--reachable' case made the inner-most call to
'lookup_commit_reference_gently()' by peeling references before they
were passed over to the commit-graph internals.

Do the analog for 'git commit-graph write --stdin-commits' by calling
'lookup_commit_reference_gently()' outside of the commit-graph
machinery, making the inner-most call a noop.

Since this may incur additional processing time, surround
'read_one_commit' with a progress meter to provide output to the caller.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/commit-graph.c: extract 'read_one_commit()'
Taylor Blau [Mon, 18 May 2020 19:27:09 +0000 (13:27 -0600)] 
builtin/commit-graph.c: extract 'read_one_commit()'

With either '--stdin-commits' or '--stdin-packs', the commit-graph
builtin will read line-delimited input, and interpret it either as a
series of commit OIDs, or pack names.

In a subsequent commit, we will begin handling '--stdin-commits'
differently by processing each line as it comes in, instead of in one
shot at the end. To make adequate room for this additional logic, split
the '--stdin-commits' case from '--stdin-packs' by only storing the
input when '--stdin-packs' is given.

In the case of '--stdin-commits', feed each line to a new
'read_one_commit' helper, which (for now) will merely call
'parse_oid_hex'.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph.c: peel refs in 'add_ref_to_set'
Taylor Blau [Wed, 13 May 2020 21:59:37 +0000 (15:59 -0600)] 
commit-graph.c: peel refs in 'add_ref_to_set'

While iterating references (to discover the set of commits to write to
the commit-graph with 'git commit-graph write --reachable'),
'add_ref_to_set' can save 'fill_oids_from_commits()' some time by
peeling the references beforehand.

Move peeling out of 'fill_oids_from_commits()' and into
'add_ref_to_set()' to use 'peel_ref()' instead of 'deref_tag()'. Doing
so allows the commit-graph machinery to use the peeled value from
'$GIT_DIR/packed-refs' instead of having to load and parse tags.

While we're at it, discard non-commit objects reachable from ref tips.
This would be done automatically by 'fill_oids_from_commits()', but such
functionality will be removed in a subsequent patch after the call to
'lookup_commit_reference_gently' is dropped (at which point a non-commit
object in the commits oidset will become an error).

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph.c: show progress of finding reachable commits
Taylor Blau [Wed, 13 May 2020 21:59:33 +0000 (15:59 -0600)] 
commit-graph.c: show progress of finding reachable commits

When 'git commit-graph write --reachable' is invoked, the commit-graph
machinery calls 'for_each_ref()' to discover the set of reachable
commits.

Right now the 'add_ref_to_set' callback is not doing anything other than
adding an OID to the set of known-reachable OIDs. In a subsequent
commit, 'add_ref_to_set' will presumptively peel references. This
operation should be fast for repositories with an up-to-date
'$GIT_DIR/packed-refs', but may be slow in the general case.

So that it doesn't appear that 'git commit-graph write' is idling with
'--reachable' in the slow case, add a progress meter to provide some
output in the meantime.

In general, we don't expect a progress meter to appear at all, since
peeling references with a 'packed-refs' file is quick. If it's slow and
we do show a progress meter, the subsequent 'fill_oids_from_commits()'
will be fast, since all of the calls to
'lookup_commit_reference_gently()' will be no-ops.

Both progress meters are delayed, so it is unlikely that more than one
will appear. In either case, this intermediate state will go away in a
handful of patches, at which point there will be at most one progress
meter.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocommit-graph.c: extract 'refs_cb_data'
Taylor Blau [Tue, 5 May 2020 01:13:35 +0000 (19:13 -0600)] 
commit-graph.c: extract 'refs_cb_data'

In subsequent patches, we are going to update a progress meter when
'add_ref_to_set()' is called, and need a convenient way to pass a
'struct progress *' in from the caller.

Introduce 'refs_cb_data' as a catch-all for parameters that
'add_ref_to_set' may need, and wrap the existing single parameter in
that struct.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
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 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 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 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>
4 years agofetch-pack: in protocol v2, in_vain only after ACK
Jonathan Tan [Tue, 28 Apr 2020 00:01:09 +0000 (17:01 -0700)] 
fetch-pack: in protocol v2, in_vain only after ACK

When fetching, Git stops negotiation when it has sent at least
MAX_IN_VAIN (which is 256) "have" lines without having any of them
ACK-ed. But this is supposed to trigger only after the first ACK, as
pack-protocol.txt says:

  However, the 256 limit *only* turns on in the canonical client
  implementation if we have received at least one "ACK %s continue"
  during a prior round.  This helps to ensure that at least one common
  ancestor is found before we give up entirely.

The code path for protocol v0 observes this, but not protocol v2,
resulting in shorter negotiation rounds but significantly larger
packfiles. Teach the code path for protocol v2 to check this criterion
only after at least one ACK was received.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofetch-pack: return enum from process_acks()
Jonathan Tan [Tue, 28 Apr 2020 00:01:08 +0000 (17:01 -0700)] 
fetch-pack: return enum from process_acks()

process_acks() returns 0, 1, or 2, depending on whether "ready" was
received and if not, whether at least one commit was found to be common.
Replace these magic numbers with a documented enum.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobugreport: drop extraneous includes
Emily Shaffer [Mon, 27 Apr 2020 23:42:31 +0000 (16:42 -0700)] 
bugreport: drop extraneous includes

In the generic parts of the source files, system headers like
<time.h> and <stdio.h> are supposed to be included indirectly
by including "git-compat-util.h", which manages portability issues.

Drop our explicit inclusions and rely on "cache.h", which includes
"git-compat-util.h".

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agorebase: display an error if --root and --fork-point are both provided
Elijah Newren [Mon, 27 Apr 2020 17:59:49 +0000 (17:59 +0000)] 
rebase: display an error if --root and --fork-point are both provided

--root implies we want to rebase all commits since the beginning of
history.  --fork-point means we want to use the reflog of the specified
upstream to find the best common ancestor between <upstream> and
<branch> and only rebase commits since that common ancestor.  These
options are clearly contradictory, so throw an error (instead of
segfaulting on a NULL pointer) if both are specified.

Reported-by: Alexander Berg <alexander.berg@atos.net>
Documentation-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomacOS/brew: let the build find gettext headers/libraries/msgfmt
Johannes Schindelin [Sun, 26 Apr 2020 20:09:32 +0000 (22:09 +0200)] 
macOS/brew: let the build find gettext headers/libraries/msgfmt

Apparently a recent Homebrew update now installs `gettext` into the
subdirectory /usr/local/opt/gettext/[lib/include].

Sometimes the ci job succeeds:
 brew link --force gettext
 Linking /usr/local/Cellar/gettext/0.20.1... 179 symlinks created

And sometimes installing the package "gettext" with force-link fails:
 brew link --force gettext
 Warning: Refusing to link macOS provided/shadowed software: gettext
 If you need to have gettext first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile

(And the is not the final word either, since macOS itself says:
 The default interactive shell is now zsh.)

Anyway, The latter requires CFLAGS to include /usr/local/opt/gettext/include
and LDFLAGS to include /usr/local/opt/gettext/lib.

Likewise, the `msgfmt` tool is no longer in the `PATH`.

While it is unclear which change is responsible for this breakage (that
most notably only occurs on CI build agents that updated very recently),
https://github.com/Homebrew/homebrew-core/pull/53489 has fixed it.

Nevertheless, let's work around this issue, as there are still quite a
few build agents out there that need some help in this regard: we
explicitly do not call `brew update` in our CI/PR builds anymore.

Helped-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoprogress.c: silence cgcc suggestion about internal linkage
Đoàn Trần Công Danh [Mon, 27 Apr 2020 14:22:37 +0000 (21:22 +0700)] 
progress.c: silence cgcc suggestion about internal linkage

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agograph.c: limit linkage of internal variable
Đoàn Trần Công Danh [Mon, 27 Apr 2020 14:22:36 +0000 (21:22 +0700)] 
graph.c: limit linkage of internal variable

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocompat/regex: move stdlib.h up in inclusion chain
Đoàn Trần Công Danh [Mon, 27 Apr 2020 14:22:35 +0000 (21:22 +0700)] 
compat/regex: move stdlib.h up in inclusion chain

In Linux with musl libc, we have this inclusion chain:

compat/regex/regex.c:69
`-> compat/regex/regex_internal.h
   `-> /usr/include/stdlib.h
      `-> /usr/include/features.h
      `-> /usr/include/alloca.h

In that inclusion chain, `<features.h>` claims it's _BSD_SOURCE
compatible when it's NOT asked to be either
{_POSIX,_GNU,_XOPEN,_BSD}_SOURCE, or __STRICT_ANSI__.
And, `<stdlib.h>` will include `<alloca.h>` to be compatible with
software written for GNU and BSD. Thus, redefine `alloca` macro,
which was defined before at compat/regex/regex.c:66.

Considering this is only compat code, we've taken from other project,
it's not our business to decide which source should we adhere to.

Include `<stdlib.h>` early to prevent the redefinition of alloca.
This also remove a potential warning about alloca not defined on:
#undef alloca

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest-parse-pathspec-file.c: s/0/NULL/ for pointer type
Đoàn Trần Công Danh [Mon, 27 Apr 2020 14:22:34 +0000 (21:22 +0700)] 
test-parse-pathspec-file.c: s/0/NULL/ for pointer type

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Reviewed-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocommit-graph: close descriptors after mmap
Jeff King [Thu, 23 Apr 2020 21:41:13 +0000 (15:41 -0600)] 
commit-graph: close descriptors after mmap

We don't ever refer to the descriptor after mmap-ing it. And keeping it
open means we can run out of descriptors in degenerate cases (e.g.,
thousands of split chain files). Let's close it as soon as possible.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogitweb: Recognize *-to and Closes/Fixes trailers
Emma Brooks [Sat, 25 Apr 2020 02:17:23 +0000 (02:17 +0000)] 
gitweb: Recognize *-to and Closes/Fixes trailers

Commit trailers like "Thanks-to:", "Fixes:", and "Closes:" are fairly
common, but gitweb didn't highlight them like other trailers.

Signed-off-by: Emma Brooks <me@pluvano.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconfig doc: fix reference to config.worktree info
Matheus Tavares [Sat, 25 Apr 2020 01:05:38 +0000 (22:05 -0300)] 
config doc: fix reference to config.worktree info

356aea6 ("doc: move extensions.worktreeConfig to the right place",
2018-11-14) moved the explanation of extension.worktreeConfig from
config.txt to technical/repository-version.txt. However, the former
still contains a reference to the removed paragraph. We could fix it
referencing the gitrepository-layout man page, which contains the moved
explanation. But the git-worktree man page has additional information
and recommendations for the worktree config file, so let's reference it
instead.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoshallow.c: use '{commit,rollback}_shallow_file'
Taylor Blau [Thu, 23 Apr 2020 00:25:45 +0000 (18:25 -0600)] 
shallow.c: use '{commit,rollback}_shallow_file'

In bd0b42aed3 (fetch-pack: do not take shallow lock unnecessarily,
2019-01-10), the author noted that 'is_repository_shallow' produces
visible side-effect(s) by setting 'is_shallow' and 'shallow_stat'.

This is a problem for e.g., fetching with '--update-shallow' in a
shallow repository with 'fetch.writeCommitGraph' enabled, since the
update to '.git/shallow' will cause Git to think that the repository
isn't shallow when it is, thereby circumventing the commit-graph
compatibility check.

This causes problems in shallow repositories with at least shallow refs
that have at least one ancestor (since the client won't have those
objects, and therefore can't take the reachability closure over commits
when writing a commit-graph).

Address this by introducing thin wrappers over 'commit_lock_file' and
'rollback_lock_file' for use specifically when the lock is held over
'.git/shallow'. These wrappers (appropriately called
'commit_shallow_file' and 'rollback_shallow_file') call into their
respective functions in 'lockfile.h', but additionally reset validity
checks used by the shallow machinery.

Replace each instance of 'commit_lock_file' and 'rollback_lock_file'
with 'commit_shallow_file' and 'rollback_shallow_file' when the lock
being held is over the '.git/shallow' file.

As a result, 'prune_shallow' can now only be called once (since
'check_shallow_file_for_update' will die after calling
'reset_repository_shallow'). But, this is OK since we only call
'prune_shallow' at most once per process.

Helped-by: Jonathan Tan <jonathantanmy@google.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5537: use test_write_lines and indented heredocs for readability
Taylor Blau [Fri, 24 Apr 2020 17:11:39 +0000 (11:11 -0600)] 
t5537: use test_write_lines and indented heredocs for readability

A number of spots in t5537 use the non-indented heredoc '<<EOF' when
they would benefit from instead using '<<-EOF' or simply
test_write_lines.

In preparation for adding new tests in a good style and being consistent
with the surrounding code, update the existing tests to improve their
readability.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomulti-pack-index: close file descriptor after mmap
Derrick Stolee [Fri, 24 Apr 2020 13:17:16 +0000 (09:17 -0400)] 
multi-pack-index: close file descriptor after mmap

The multi-pack-index subsystem was not closing its file descriptor
after memory-mapping the file contents. After this mmap() succeeds,
there is no need to keep the file descriptor open.  In fact, there
is signficant reason to close it so we do not run out of
descriptors.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest-bloom: check that we have expected arguments
Jeff King [Thu, 23 Apr 2020 20:59:14 +0000 (16:59 -0400)] 
test-bloom: check that we have expected arguments

If "test-tool bloom" is not fed a command, or if arguments are missing
for some commands, it will just segfault. Let's check argc and write a
friendlier usage message.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotest-bloom: fix some whitespace issues
Jeff King [Thu, 23 Apr 2020 20:59:07 +0000 (16:59 -0400)] 
test-bloom: fix some whitespace issues

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocommit-graph.c: gracefully handle file descriptor exhaustion
Taylor Blau [Thu, 23 Apr 2020 21:41:09 +0000 (15:41 -0600)] 
commit-graph.c: gracefully handle file descriptor exhaustion

When writing a layered commit-graph, the commit-graph machinery uses
'commit_graph_filenames_after' and 'commit_graph_hash_after' to keep
track of the layers in the chain that we are in the process of writing.

When the number of commit-graph layers shrinks, we initialize all
entries in the aforementioned arrays, because we know the structure of
the new commit-graph chain immediately (since there are no new layers,
there are no unknown hash values).

But when the number of commit-graph layers grows (i.e., that
'num_commit_graphs_after > num_commit_graphs_before'), then we leave
some entries in the filenames and hashes arrays as uninitialized,
because we will fill them in later as those values become available.

For instance, we rely on 'write_commit_graph_file's to store the
filename and hash of the last layer in the new chain, which is the one
that it is responsible for writing. But, it's possible that
'write_commit_graph_file' may fail, e.g., from file descriptor
exhaustion. In this case it is possible that 'git_mkstemp_mode' will
fail, and that function will return early *before* setting the values
for the last commit-graph layer's filename and hash.

This causes a number of upleasant side-effects. For instance, trying to
'free()' each entry in 'ctx->commit_graph_filenames_after' (and
similarly for the hashes array) causes us to 'free()' uninitialized
memory, since the area is allocated with 'malloc()' and is therefore
subject to contain garbage (which is left alone when
'write_commit_graph_file' returns early).

This can manifest in other issues, like a general protection fault,
and/or leaving a stray 'commit-graph-chain.lock' around after the
process dies. (The reasoning for this is still a mystery to me, since
we'd otherwise usually expect the kernel to run tempfile.c's 'atexit()'
handlers in the case of a normal death...)

To resolve this, initialize the memory with 'CALLOC_ARRAY' so that
uninitialized entries are filled with zeros, and can thus be 'free()'d
as a noop instead of causing a fault.

Helped-by: Jeff King <peff@peff.net>
Helped-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot/test-lib.sh: make ULIMIT_FILE_DESCRIPTORS available to tests
Taylor Blau [Thu, 23 Apr 2020 21:41:06 +0000 (15:41 -0600)] 
t/test-lib.sh: make ULIMIT_FILE_DESCRIPTORS available to tests

In t1400 the prerequisite 'ULIMIT_FILE_DESCRIPTORS' is defined and used
to effectively guard the helper function 'run_with_limited_open_files'
from being used on systems that do not satisfy this prerequisite.

In the subsequent patch, we will introduce another test outside of t1400
that would benefit from using this prerequisite. So, move it to
'test-lib.sh' instead so that it can be used by multiple tests.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocommit-graph.c: don't use discarded graph_name in error
Taylor Blau [Thu, 23 Apr 2020 21:41:02 +0000 (15:41 -0600)] 
commit-graph.c: don't use discarded graph_name in error

When writing a commit-graph layer, we do so in a temporary file which is
renamed into place. If we fail to create a temporary file, for e.g.,
because we have too many open files, then 'git_mkstemp_mode' sets the
pattern to the empty string, in which case we get an error something
along the lines of:

  error: unable to create ''

It's not useful to show the pattern here at all, since we (1) know the
pattern is well-formed, and (2) would have already shown the dirname
when trying to create the leading directories. So, replace this error
with something friendlier.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoblame: drop unused parameter from maybe_changed_path
Jeff King [Thu, 23 Apr 2020 21:03:03 +0000 (17:03 -0400)] 
blame: drop unused parameter from maybe_changed_path

We don't use the "parent" parameter at all (probably because the bloom
filter for a commit is always defined against a single parent anyway).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomailinfo: disallow NUL character in mail's header
Đoàn Trần Công Danh [Mon, 20 Apr 2020 23:54:36 +0000 (06:54 +0700)] 
mailinfo: disallow NUL character in mail's header

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomailinfo.c: avoid strlen on strings that can contains NUL
Đoàn Trần Công Danh [Mon, 20 Apr 2020 23:54:35 +0000 (06:54 +0700)] 
mailinfo.c: avoid strlen on strings that can contains NUL

We're passing buffer from strbuf to reencode_string,
which will call strlen(3) on that buffer,
and discard the length of newly created buffer.
Then, we compute the length of the return buffer to attach to strbuf.

During this process, we introduce a discrimination between mail
originally written in utf-8 and other encoding.

* if the email was written in utf-8, we leave it as is. If there is
  a NUL character in that line, we complains loudly:

   error: a NUL byte in commit log message not allowed.

* if the email was written in other encoding, we truncate the data as
  the NUL character in that line, then we used the truncated line for
  the metadata.

We can do better by reusing all the available information,
and call the underlying lower level function that will be called
indirectly by reencode_string. By doing this, we will also postpone
the NUL character processing to the commit step, which will
complains about the faulty metadata.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4254: merge 2 steps of a single test
Đoàn Trần Công Danh [Mon, 20 Apr 2020 23:54:34 +0000 (06:54 +0700)] 
t4254: merge 2 steps of a single test

While we are at it, make sure we run a clean up after testing.
In a later patch, we will test for more corrupted patch.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe third batch
Junio C Hamano [Wed, 22 Apr 2020 20:42:29 +0000 (13:42 -0700)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'jk/credential-parsing-end-of-host-in-URL'
Junio C Hamano [Wed, 22 Apr 2020 20:43:01 +0000 (13:43 -0700)] 
Merge branch 'jk/credential-parsing-end-of-host-in-URL'

Parsing of URL for the credential helper has been corrected.

* jk/credential-parsing-end-of-host-in-URL:
  credential: treat "?" and "#" in URLs as end of host

4 years agoMerge branch 'jt/rebase-allow-duplicate'
Junio C Hamano [Wed, 22 Apr 2020 20:43:00 +0000 (13:43 -0700)] 
Merge branch 'jt/rebase-allow-duplicate'

Allow "git rebase" to reapply all local commits, even if the may be
already in the upstream, without checking first.

* jt/rebase-allow-duplicate:
  rebase --merge: optionally skip upstreamed commits

4 years agoMerge branch 'en/rebase-no-keep-empty'
Junio C Hamano [Wed, 22 Apr 2020 20:43:00 +0000 (13:43 -0700)] 
Merge branch 'en/rebase-no-keep-empty'

"git rebase" (again) learns to honor "--no-keep-empty", which lets
the user to discard commits that are empty from the beginning (as
opposed to the ones that become empty because of rebasing).  The
interactive rebase also marks commits that are empty in the todo.

* en/rebase-no-keep-empty:
  rebase: fix an incompatible-options error message
  rebase: reinstate --no-keep-empty
  rebase -i: mark commits that begin empty in todo editor

4 years agoMerge branch 'js/mingw-is-hidden-test-fix'
Junio C Hamano [Wed, 22 Apr 2020 20:42:59 +0000 (13:42 -0700)] 
Merge branch 'js/mingw-is-hidden-test-fix'

A Windows-specific test element has been made more robust against
misuse from both user's environment and programmer's errors.

* js/mingw-is-hidden-test-fix:
  t: restrict `is_hidden` to be called only on Windows
  mingw: make test_path_is_hidden more robust
  t: consolidate the `is_hidden` functions

4 years agoMerge branch 'js/mingw-isilon-nfs'
Junio C Hamano [Wed, 22 Apr 2020 20:42:58 +0000 (13:42 -0700)] 
Merge branch 'js/mingw-isilon-nfs'

* js/mingw-isilon-nfs:
  mingw: cope with the Isilon network file system

4 years agoMerge branch 'js/flush-prompt-before-interative-input'
Junio C Hamano [Wed, 22 Apr 2020 20:42:58 +0000 (13:42 -0700)] 
Merge branch 'js/flush-prompt-before-interative-input'

The interactive input from various codepaths are consolidated and
any prompt possibly issued earlier are fflush()ed before we read.

* js/flush-prompt-before-interative-input:
  interactive: explicitly `fflush` stdout before expecting input
  interactive: refactor code asking the user for interactive input

4 years agoMerge branch 'ds/revision-show-pulls'
Junio C Hamano [Wed, 22 Apr 2020 20:42:57 +0000 (13:42 -0700)] 
Merge branch 'ds/revision-show-pulls'

"git log" learned "--show-pulls" that helps pathspec limited
history views; a merge commit that takes the whole change from a
side branch, which is normally omitted from the output, is shown
in addition to the commits that introduce real changes.

* ds/revision-show-pulls:
  revision: --show-pulls adds helpful merges

4 years agoMerge branch 'ma/simplify-merge-config-parsing'
Junio C Hamano [Wed, 22 Apr 2020 20:42:56 +0000 (13:42 -0700)] 
Merge branch 'ma/simplify-merge-config-parsing'

Code simplification.

* ma/simplify-merge-config-parsing:
  merge: use skip_prefix to parse config key