]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agorefs-internal.h: move DO_FOR_EACH_* flags next to each other
Jeff King [Fri, 24 Sep 2021 18:37:58 +0000 (14:37 -0400)] 
refs-internal.h: move DO_FOR_EACH_* flags next to each other

There are currently two DO_FOR_EACH_* flags, which must not have their
bits overlap. Yet they're defined hundreds of lines apart. Let's move
them next to each other to make it clear that they are related and are a
complete set (which matters if you are adding a new flag and would like
to know what the next available bit is).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5312: be more assertive about command failure
Jeff King [Fri, 24 Sep 2021 18:37:11 +0000 (14:37 -0400)] 
t5312: be more assertive about command failure

When repacking or pruning in a corrupted repository, our tests in t5312
argue that it is OK to complete the operation or bail, as long as we
don't actually delete the objects pointed to by the corruption.

This isn't a wrong line of reasoning, but the tests are a bit permissive
by using test_might_fail. The fact is that we _do_ bail currently, and
if we ever stopped doing so, that would be worthy of a human
investigating. So let's switch these to test_must_fail.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5312: test non-destructive repack
Jeff King [Fri, 24 Sep 2021 18:36:42 +0000 (14:36 -0400)] 
t5312: test non-destructive repack

In t5312, we create a state with a broken ref, and then make sure that
destructive repacks don't silently ignore the breakage (where a
destructive repack is one that might drop objects). But we don't check
the behavior of non-destructive repacks at all (i.e., ones where we'd
keep unreachable objects).

So let's add a test to confirm the current behavior, which is that
they are allowed (i.e., ignoring the breakage and considering any
objects it points to as unreachable). This may change in the future, but
we'd like for the test suite to alert us to that fact.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5312: create bogus ref as necessary
Jeff King [Fri, 24 Sep 2021 18:36:18 +0000 (14:36 -0400)] 
t5312: create bogus ref as necessary

Some tests in t5312 create an illegally-named ref, and then see how
various operations handle it. But between those operations, we also do
some more setup (e.g., repacking), and we are subtly depending on how
those setup steps react to the illegal ref.

To future-proof us against those behaviors changing, let's instead
create and clean up our bogus ref on demand in the tests that need it.

This has two small extra advantages:

 - the tests are more stand-alone; we do not need an extra test to clean
   up the ref before moving on to other parts of the script

 - the creation and cleanup is together in one helper function. Because
   these depend on touching the refs in the filesystem directly, they
   may need to be tweaked for a world with alternate backends (they have
   not been noticed so far in the reftable work because with a non-file
   backend the tests don't fail; they simply become uninteresting noops
   because the broken ref isn't read at all).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5312: drop "verbose" helper
Jeff King [Fri, 24 Sep 2021 18:35:29 +0000 (14:35 -0400)] 
t5312: drop "verbose" helper

t5312 has several uses of the "verbose" helper, as described in
8ad1652418 (t5304: use helper to report failure of "test foo = bar",
2014-10-10). Back then the "-x" trace option for tests was new, and was
not as pleasant to use (e.g., some tests failed under "-x", we did not
support BASH_XTRACEFD, etc).

These days it is clear that "-x" is the preferred way to get extra
output, and we don't need to mark up individual tests. Let's get rid of
the uses of "verbose" here, as one step toward eradicating it totally.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5600: provide detached HEAD for corruption failures
Jeff King [Fri, 24 Sep 2021 18:34:04 +0000 (14:34 -0400)] 
t5600: provide detached HEAD for corruption failures

When checking how git-clone behaves when it fails, we stimulate some
failures by trying to do a clone from a local repository whose objects
have been removed. Because these clones use local optimizations, there's
a subtle dependency in how the corruption is handled on the sending
side.

If upload-pack does not show us the broken refs (which it does not
currently), then we see only HEAD (which is itself broken), and clone
that as a detached HEAD. When we try to write the ref, we notice that we
never got the object and bail.

But if upload-pack _does_ show us the broken refs (which it may in a
future patch), then we'll realize that HEAD is a symref and just write
that. You'd think we'd fail when writing out the refs themselves, but we
don't; we do a bulk write and skip the connectivity check because of our
--local optimizations. For the non-bare case, we do notice the problem
when we try to checkout. But for a bare repository, we unexpectedly
complete the clone successfully!

At first glance this may seem like a bug. But the whole point of those
local optimizations is to give up some safety for speed. If you want to
be careful, you should be using "--no-local", which would notice that
the pack did not transfer sufficient objects. We could do that in these
tests, but part of the point is for them to fail at specific moments
(and indeed, we have a later test that checks for transport failure).

However, we can make this less subtle and future-proof it against
changes on the upload-pack side by just having an explicit detached
HEAD in the corrupted repo. Now we'll fail as expected during the ref
write if any ref _or_ HEAD is corrupt, whether we're --bare or not.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5516: don't use HEAD ref for invalid ref-deletion tests
Jeff King [Fri, 24 Sep 2021 18:33:00 +0000 (14:33 -0400)] 
t5516: don't use HEAD ref for invalid ref-deletion tests

A few tests in t5516 want to assert that we can delete a corrupted ref
whose pointed-to object is missing. They do so by using the "main"
branch, which is also pointed to by HEAD.

This does work, but only because of a subtle assumption about the
implementation. We do not block the deletion because of the invalid ref,
but we _also_ do not notice that the deleted branch is pointed to by
HEAD. And so the safety rule of "do not allow HEAD to be deleted in a
non-bare repository" does not kick in, and the test passes.

Let's instead use a non-HEAD branch. That still tests what we care about
here (deleting a corrupt ref), but without implicitly depending on our
failure to notice that we're deleting HEAD. That will future proof the
test against that behavior changing.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot7900: clean up some more broken refs
Jeff King [Fri, 24 Sep 2021 18:32:17 +0000 (14:32 -0400)] 
t7900: clean up some more broken refs

The "incremental-repack task" test replaces the object directory with a
known state. As a result, some of our refs point to objects that are not
included in that state.

Commit 3cf5f221be (t7900: clean up some broken refs, 2021-01-19) cleaned
up some of those (that were causing warnings to stderr from the
maintenance process). But there are a few more that were missed. These
aren't hurting anything for now, but it's certainly an unexpected state
to leave the test repository in, and it will become a problem if repack
ever gets more picky about broken refs.

Let's clean up those additional refs (which are all in refs/remotes,
with nothing there that isn't broken), and add an extra "for-each-ref"
call to assert that we've got everything.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe eighth batch
Junio C Hamano [Thu, 23 Sep 2021 20:45:03 +0000 (13:45 -0700)] 
The eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'rs/use-xopen-in-index-pack'
Junio C Hamano [Thu, 23 Sep 2021 20:44:50 +0000 (13:44 -0700)] 
Merge branch 'rs/use-xopen-in-index-pack'

Code clean-up.

* rs/use-xopen-in-index-pack:
  index-pack: use xopen in init_thread

2 years agoMerge branch 'kz/revindex-comment-fix'
Junio C Hamano [Thu, 23 Sep 2021 20:44:49 +0000 (13:44 -0700)] 
Merge branch 'kz/revindex-comment-fix'

Header comment fix.

* kz/revindex-comment-fix:
  pack-revindex.h: correct the time complexity descriptions

2 years agoMerge branch 'cb/plug-leaks-in-alloca-emu-users'
Junio C Hamano [Thu, 23 Sep 2021 20:44:49 +0000 (13:44 -0700)] 
Merge branch 'cb/plug-leaks-in-alloca-emu-users'

Leakfix.

* cb/plug-leaks-in-alloca-emu-users:
  t0000: avoid masking git exit value through pipes
  tree-diff: fix leak when not HAVE_ALLOCA_H

2 years agoMerge branch 'jt/submodule-name-to-gitdir'
Junio C Hamano [Thu, 23 Sep 2021 20:44:49 +0000 (13:44 -0700)] 
Merge branch 'jt/submodule-name-to-gitdir'

Code refactoring.

* jt/submodule-name-to-gitdir:
  submodule: extract path to submodule gitdir func

2 years agoMerge branch 'ma/doc-git-version'
Junio C Hamano [Thu, 23 Sep 2021 20:44:49 +0000 (13:44 -0700)] 
Merge branch 'ma/doc-git-version'

Doc update.

* ma/doc-git-version:
  documentation: add documentation for 'git version'

2 years agoMerge branch 'ma/help-w-check-for-requested-page'
Junio C Hamano [Thu, 23 Sep 2021 20:44:48 +0000 (13:44 -0700)] 
Merge branch 'ma/help-w-check-for-requested-page'

The error in "git help no-such-git-command" is handled better.

* ma/help-w-check-for-requested-page:
  help: make sure local html page exists before calling external processes

2 years agoMerge branch 'cb/unix-sockets-with-windows'
Junio C Hamano [Thu, 23 Sep 2021 20:44:48 +0000 (13:44 -0700)] 
Merge branch 'cb/unix-sockets-with-windows'

Adjust credential-cache helper to Windows.

* cb/unix-sockets-with-windows:
  git-compat-util: include declaration for unix sockets in windows
  credential-cache: check for windows specific errors
  t0301: fixes for windows compatibility

2 years agoMerge branch 'ab/retire-option-argument'
Junio C Hamano [Thu, 23 Sep 2021 20:44:48 +0000 (13:44 -0700)] 
Merge branch 'ab/retire-option-argument'

An oddball OPTION_ARGUMENT feature has been removed from the
parse-options API.

* ab/retire-option-argument:
  parse-options API: remove OPTION_ARGUMENT feature
  difftool: use run_command() API in run_file_diff()
  difftool: prepare "diff" cmdline in cmd_difftool()
  difftool: prepare "struct child_process" in cmd_difftool()

2 years agoMerge branch 'mr/bisect-in-c-4'
Junio C Hamano [Thu, 23 Sep 2021 20:44:48 +0000 (13:44 -0700)] 
Merge branch 'mr/bisect-in-c-4'

Rewrite of "git bisect" in C continues.

* mr/bisect-in-c-4:
  bisect--helper: retire `--bisect-next-check` subcommand
  bisect--helper: reimplement `bisect_run` shell function in C
  bisect--helper: reimplement `bisect_visualize()` shell function in C
  run-command: make `exists_in_PATH()` non-static
  t6030-bisect-porcelain: add test for bisect visualize
  t6030-bisect-porcelain: add tests to control bisect run exit cases

2 years agoMerge branch 'ab/unused-script-helpers'
Junio C Hamano [Thu, 23 Sep 2021 20:44:47 +0000 (13:44 -0700)] 
Merge branch 'ab/unused-script-helpers'

Code clean-up.

* ab/unused-script-helpers:
  test-lib: remove unused $_x40 and $_z40 variables
  git-bisect: remove unused SHA-1 $x40 shell variable
  git-sh-setup: remove unused "pull with rebase" message
  git-submodule: remove unused is_zero_oid() function

2 years agoMerge branch 'ab/http-drop-old-curl-plus'
Junio C Hamano [Thu, 23 Sep 2021 20:44:47 +0000 (13:44 -0700)] 
Merge branch 'ab/http-drop-old-curl-plus'

Conditional compilation around versions of libcURL has been
straightened out.

* ab/http-drop-old-curl-plus:
  http: don't hardcode the value of CURL_SOCKOPT_OK
  http: centralize the accounting of libcurl dependencies
  http: correct curl version check for CURLOPT_PINNEDPUBLICKEY
  http: correct version check for CURL_HTTP_VERSION_2
  http: drop support for curl < 7.18.0 (again)
  Makefile: drop support for curl < 7.9.8 (again)
  INSTALL: mention that we need libcurl 7.19.4 or newer to build
  INSTALL: reword and copy-edit the "libcurl" section
  INSTALL: don't mention the "curl" executable at all

2 years agoMerge branch 'po/git-config-doc-mentions-help-c'
Junio C Hamano [Thu, 23 Sep 2021 20:44:47 +0000 (13:44 -0700)] 
Merge branch 'po/git-config-doc-mentions-help-c'

Doc update.

* po/git-config-doc-mentions-help-c:
  doc: config, tell readers of `git help --config`

2 years agoMerge branch 'jk/http-server-protocol-versions'
Junio C Hamano [Thu, 23 Sep 2021 20:44:47 +0000 (13:44 -0700)] 
Merge branch 'jk/http-server-protocol-versions'

Taking advantage of the CGI interface, http-backend has been
updated to enable protocol v2 automatically when the other side
asks for it.

* jk/http-server-protocol-versions:
  docs/protocol-v2: point readers transport config discussion
  docs/git: discuss server-side config for GIT_PROTOCOL
  docs/http-backend: mention v2 protocol
  http-backend: handle HTTP_GIT_PROTOCOL CGI variable
  t5551: test v2-to-v0 http protocol fallback

2 years agoMerge branch 'ab/gc-remove-unused-call'
Junio C Hamano [Thu, 23 Sep 2021 20:44:46 +0000 (13:44 -0700)] 
Merge branch 'ab/gc-remove-unused-call'

Code clean-up.

* ab/gc-remove-unused-call:
  gc: remove unused launchctl_get_uid() call

2 years agoMerge branch 'ab/test-tool-run-command-cleanup'
Junio C Hamano [Thu, 23 Sep 2021 20:44:46 +0000 (13:44 -0700)] 
Merge branch 'ab/test-tool-run-command-cleanup'

Code clean-up.

* ab/test-tool-run-command-cleanup:
  test-tool run-command: fix flip-flop init pattern

2 years agoMerge branch 'en/tests-cleanup-leftover-untracked'
Junio C Hamano [Thu, 23 Sep 2021 20:44:46 +0000 (13:44 -0700)] 
Merge branch 'en/tests-cleanup-leftover-untracked'

Test clean-up.

* en/tests-cleanup-leftover-untracked:
  tests: remove leftover untracked files

2 years agoMerge branch 'jk/strvec-typefix'
Junio C Hamano [Thu, 23 Sep 2021 20:44:46 +0000 (13:44 -0700)] 
Merge branch 'jk/strvec-typefix'

Correct nr and alloc members of strvec struct to be of type size_t.

* jk/strvec-typefix:
  strvec: use size_t to store nr and alloc

2 years agoMerge branch 'rs/drop-core-compression-vars'
Junio C Hamano [Thu, 23 Sep 2021 20:44:46 +0000 (13:44 -0700)] 
Merge branch 'rs/drop-core-compression-vars'

Code clean-up.

* rs/drop-core-compression-vars:
  compression: drop write-only core_compression_* variables

2 years agoMerge branch 'rs/packfile-bad-object-list-in-oidset'
Junio C Hamano [Thu, 23 Sep 2021 20:44:45 +0000 (13:44 -0700)] 
Merge branch 'rs/packfile-bad-object-list-in-oidset'

Replace a handcrafted data structure used to keep track of bad
objects in the packfile API by an oidset.

* rs/packfile-bad-object-list-in-oidset:
  packfile: use oidset for bad objects
  packfile: convert has_packed_and_bad() to object_id
  packfile: convert mark_bad_packed_object() to object_id
  midx: inline nth_midxed_pack_entry()
  oidset: make oidset_size() an inline function

2 years agoMerge branch 'en/am-abort-fix'
Junio C Hamano [Thu, 23 Sep 2021 20:44:45 +0000 (13:44 -0700)] 
Merge branch 'en/am-abort-fix'

When "git am --abort" fails to abort correctly, it still exited
with exit status of 0, which has been corrected.

* en/am-abort-fix:
  am: fix incorrect exit status on am fail to abort
  t4151: add a few am --abort tests
  git-am.txt: clarify --abort behavior

2 years agoMerge branch 'ps/update-ref-batch-flush'
Junio C Hamano [Thu, 23 Sep 2021 20:44:45 +0000 (13:44 -0700)] 
Merge branch 'ps/update-ref-batch-flush'

"git update-ref --stdin" failed to flush its output as needed,
which potentially led the conversation to a deadlock.

* ps/update-ref-batch-flush:
  t1400: avoid SIGPIPE race condition on fifo
  update-ref: fix streaming of status updates

2 years agoThe seventh batch
Junio C Hamano [Mon, 20 Sep 2021 22:09:44 +0000 (15:09 -0700)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jk/t5562-racefix'
Junio C Hamano [Mon, 20 Sep 2021 22:20:46 +0000 (15:20 -0700)] 
Merge branch 'jk/t5562-racefix'

Test update.

* jk/t5562-racefix:
  t5562: use alarm() to interrupt timed child-wait

2 years agoMerge branch 'rs/no-mode-to-open-when-appending'
Junio C Hamano [Mon, 20 Sep 2021 22:20:45 +0000 (15:20 -0700)] 
Merge branch 'rs/no-mode-to-open-when-appending'

The "mode" word is useless in a call to open(2) that does not
create a new file.  Such a call in the files backend of the ref
subsystem has been cleaned up.

* rs/no-mode-to-open-when-appending:
  refs/files-backend: remove unused open mode parameter

2 years agoMerge branch 'rs/setup-use-xopen-and-xdup'
Junio C Hamano [Mon, 20 Sep 2021 22:20:45 +0000 (15:20 -0700)] 
Merge branch 'rs/setup-use-xopen-and-xdup'

Code clean-up.

* rs/setup-use-xopen-and-xdup:
  setup: use xopen and xdup in sanitize_stdfds

2 years agoMerge branch 'js/run-command-close-packs'
Junio C Hamano [Mon, 20 Sep 2021 22:20:45 +0000 (15:20 -0700)] 
Merge branch 'js/run-command-close-packs'

The run-command API has been updated so that the callers can easily
ask the file descriptors open for packfiles to be closed immediately
before spawning commands that may trigger auto-gc.

* js/run-command-close-packs:
  Close object store closer to spawning child processes
  run_auto_maintenance(): implicitly close the object store
  run-command: offer to close the object store before running
  run-command: prettify the `RUN_COMMAND_*` flags
  pull: release packs before fetching
  commit-graph: when closing the graph, also release the slab

2 years agoMerge branch 'ds/mergies-with-sparse-index'
Junio C Hamano [Mon, 20 Sep 2021 22:20:44 +0000 (15:20 -0700)] 
Merge branch 'ds/mergies-with-sparse-index'

Various mergy operations have been prepared to work efficiently
with the sparse index.

* ds/mergies-with-sparse-index:
  sparse-index: integrate with cherry-pick and rebase
  sequencer: ensure full index if not ORT strategy
  t1092: add cherry-pick, rebase tests
  merge-ort: expand only for out-of-cone conflicts
  merge: make sparse-aware with ORT
  diff: ignore sparse paths in diffstat

2 years agoMerge branch 'ds/sparse-index-ignored-files'
Junio C Hamano [Mon, 20 Sep 2021 22:20:44 +0000 (15:20 -0700)] 
Merge branch 'ds/sparse-index-ignored-files'

In cone mode, the sparse-index code path learned to remove ignored
files (like build artifacts) outside the sparse cone, allowing the
entire directory outside the sparse cone to be removed, which is
especially useful when the sparse patterns change.

* ds/sparse-index-ignored-files:
  sparse-checkout: clear tracked sparse dirs
  sparse-index: add SPARSE_INDEX_MEMORY_ONLY flag
  attr: be careful about sparse directories
  sparse-checkout: create helper methods
  sparse-index: use WRITE_TREE_MISSING_OK
  sparse-index: silently return when cache tree fails
  unpack-trees: fix nested sparse-dir search
  sparse-index: silently return when not using cone-mode patterns
  t7519: rewrite sparse index test

2 years agoMerge branch 'ar/submodule-run-update-procedure'
Junio C Hamano [Mon, 20 Sep 2021 22:20:44 +0000 (15:20 -0700)] 
Merge branch 'ar/submodule-run-update-procedure'

Reimplementation of parts of "git submodule" in C continues.

* ar/submodule-run-update-procedure:
  submodule--helper: run update procedures from C

2 years agoMerge branch 'ab/make-tags-cleanup'
Junio C Hamano [Mon, 20 Sep 2021 22:20:43 +0000 (15:20 -0700)] 
Merge branch 'ab/make-tags-cleanup'

Build clean-up for "make tags" and friends.

* ab/make-tags-cleanup:
  Makefile: normalize clobbering & xargs for tags targets
  Makefile: remove "cscope.out", not "cscope*" in cscope.out target
  Makefile: don't use "FORCE" for tags targets
  Makefile: add QUIET_GEN to "cscope" target
  Makefile: move ".PHONY: cscope" near its target

2 years agoMerge branch 'ab/serve-cleanup'
Junio C Hamano [Mon, 20 Sep 2021 22:20:43 +0000 (15:20 -0700)] 
Merge branch 'ab/serve-cleanup'

Code clean-up around "git serve".

* ab/serve-cleanup:
  upload-pack: document and rename --advertise-refs
  serve.[ch]: remove "serve_options", split up --advertise-refs code
  {upload,receive}-pack tests: add --advertise-refs tests
  serve.c: move version line to advertise_capabilities()
  serve: move transfer.advertiseSID check into session_id_advertise()
  serve.[ch]: don't pass "struct strvec *keys" to commands
  serve: use designated initializers
  transport: use designated initializers
  transport: rename "fetch" in transport_vtable to "fetch_refs"
  serve: mark has_capability() as static

2 years agoMerge branch 'ar/submodule-add-more'
Junio C Hamano [Mon, 20 Sep 2021 22:20:43 +0000 (15:20 -0700)] 
Merge branch 'ar/submodule-add-more'

More parts of "git submodule add" has been rewritten in C.

* ar/submodule-add-more:
  submodule--helper: rename compute_submodule_clone_url()
  submodule--helper: remove resolve-relative-url subcommand
  submodule--helper: remove add-config subcommand
  submodule--helper: remove add-clone subcommand
  submodule--helper: convert the bulk of cmd_add() to C
  dir: libify and export helper functions from clone.c
  submodule--helper: remove repeated code in sync_submodule()
  submodule--helper: refactor resolve_relative_url() helper
  submodule--helper: add options for compute_submodule_clone_url()

2 years agoMerge branch 'ar/submodule-add-config'
Junio C Hamano [Mon, 20 Sep 2021 22:20:42 +0000 (15:20 -0700)] 
Merge branch 'ar/submodule-add-config'

Large part of "git submodule add" gets rewritten in C.

* ar/submodule-add-config:
  submodule--helper: introduce add-config subcommand

2 years agoMerge branch 'ab/unbundle-progress'
Junio C Hamano [Mon, 20 Sep 2021 22:20:42 +0000 (15:20 -0700)] 
Merge branch 'ab/unbundle-progress'

Add progress display to "git bundle unbundle".

* ab/unbundle-progress:
  bundle: show progress on "unbundle"
  index-pack: add --progress-title option
  bundle API: change "flags" to be "extra_index_pack_args"
  bundle API: start writing API documentation

2 years agoMerge branch 'tb/pack-finalize-ordering'
Junio C Hamano [Mon, 20 Sep 2021 22:20:42 +0000 (15:20 -0700)] 
Merge branch 'tb/pack-finalize-ordering'

The order in which various files that make up a single (conceptual)
packfile has been reevaluated and straightened up.  This matters in
correctness, as an incomplete set of files must not be shown to a
running Git.

* tb/pack-finalize-ordering:
  pack-objects: rename .idx files into place after .bitmap files
  pack-write: split up finish_tmp_packfile() function
  builtin/index-pack.c: move `.idx` files into place last
  index-pack: refactor renaming in final()
  builtin/repack.c: move `.idx` files into place last
  pack-write.c: rename `.idx` files after `*.rev`
  pack-write: refactor renaming in finish_tmp_packfile()
  bulk-checkin.c: store checksum directly
  pack.h: line-wrap the definition of finish_tmp_packfile()

2 years agoMerge branch 'cb/pedantic-build-for-developers'
Junio C Hamano [Mon, 20 Sep 2021 22:20:41 +0000 (15:20 -0700)] 
Merge branch 'cb/pedantic-build-for-developers'

Update the build procedure to use the "-pedantic" build when
DEVELOPER makefile macro is in effect.

* cb/pedantic-build-for-developers:
  developer: enable pedantic by default
  win32: allow building with pedantic mode enabled
  gettext: remove optional non-standard parens in N_() definition

2 years agoMerge branch 'ab/progress-users-adjust-counters'
Junio C Hamano [Mon, 20 Sep 2021 22:20:41 +0000 (15:20 -0700)] 
Merge branch 'ab/progress-users-adjust-counters'

The code to show progress indicator in a few code paths did not
cover between 0-100%, which has been corrected.

* ab/progress-users-adjust-counters:
  entry: show finer-grained counter in "Filtering content" progress line
  commit-graph: fix bogus counter in "Scanning merged commits" progress line

2 years agoMerge branch 'dt/submodule-diff-fixes'
Junio C Hamano [Mon, 20 Sep 2021 22:20:41 +0000 (15:20 -0700)] 
Merge branch 'dt/submodule-diff-fixes'

"git diff --submodule=diff" showed failure from run_command() when
trying to run diff inside a submodule, when the user manually
removes the submodule directory.

* dt/submodule-diff-fixes:
  diff --submodule=diff: don't print failure message twice
  diff --submodule=diff: do not fail on ever-initialied deleted submodules
  t4060: remove unused variable

2 years agoMerge branch 'jv/pkt-line-batch'
Junio C Hamano [Mon, 20 Sep 2021 22:20:40 +0000 (15:20 -0700)] 
Merge branch 'jv/pkt-line-batch'

Reduce number of write(2) system calls while sending the
ref advertisement.

* jv/pkt-line-batch:
  upload-pack: use stdio in send_ref callbacks
  pkt-line: add stdio packet write functions

2 years agoMerge branch 'lh/systemd-timers'
Junio C Hamano [Mon, 20 Sep 2021 22:20:40 +0000 (15:20 -0700)] 
Merge branch 'lh/systemd-timers'

"git maintenance" scheduler learned to use systemd timers as a
possible backend.

* lh/systemd-timers:
  maintenance: add support for systemd timers on Linux
  maintenance: `git maintenance run` learned `--scheduler=<scheduler>`
  cache.h: Introduce a generic "xdg_config_home_for(…)" function

2 years agoMerge branch 'ab/tr2-leaks-and-fixes'
Junio C Hamano [Mon, 20 Sep 2021 22:20:40 +0000 (15:20 -0700)] 
Merge branch 'ab/tr2-leaks-and-fixes'

The tracing of process ancestry information has been enhanced.

* ab/tr2-leaks-and-fixes:
  tr2: log N parent process names on Linux
  tr2: do compiler enum check in trace2_collect_process_info()
  tr2: leave the parent list empty upon failure & don't leak memory
  tr2: stop leaking "thread_name" memory
  tr2: clarify TRACE2_PROCESS_INFO_EXIT comment under Linux
  tr2: remove NEEDSWORK comment for "non-procfs" implementations

2 years agoMerge branch 'jt/grep-wo-submodule-odb-as-alternate'
Junio C Hamano [Mon, 20 Sep 2021 22:20:39 +0000 (15:20 -0700)] 
Merge branch 'jt/grep-wo-submodule-odb-as-alternate'

The code to make "git grep" recurse into submodules has been
updated to migrate away from the "add submodule's object store as
an alternate object store" mechanism (which is suboptimal).

* jt/grep-wo-submodule-odb-as-alternate:
  t7814: show lack of alternate ODB-adding
  submodule-config: pass repo upon blob config read
  grep: add repository to OID grep sources
  grep: allocate subrepos on heap
  grep: read submodule entry with explicit repo
  grep: typesafe versions of grep_source_init
  grep: use submodule-ODB-as-alternate lazy-addition
  submodule: lazily add submodule ODBs as alternates

2 years agoMerge branch 'tb/multi-pack-bitmaps'
Junio C Hamano [Mon, 20 Sep 2021 22:20:39 +0000 (15:20 -0700)] 
Merge branch 'tb/multi-pack-bitmaps'

The reachability bitmap file used to be generated only for a single
pack, but now we've learned to generate bitmaps for history that
span across multiple packfiles.

* tb/multi-pack-bitmaps: (29 commits)
  pack-bitmap: drop bitmap_index argument from try_partial_reuse()
  pack-bitmap: drop repository argument from prepare_midx_bitmap_git()
  p5326: perf tests for MIDX bitmaps
  p5310: extract full and partial bitmap tests
  midx: respect 'GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP'
  t7700: update to work with MIDX bitmap test knob
  t5319: don't write MIDX bitmaps in t5319
  t5310: disable GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP
  t0410: disable GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP
  t5326: test multi-pack bitmap behavior
  t/helper/test-read-midx.c: add --checksum mode
  t5310: move some tests to lib-bitmap.sh
  pack-bitmap: write multi-pack bitmaps
  pack-bitmap: read multi-pack bitmaps
  pack-bitmap.c: avoid redundant calls to try_partial_reuse
  pack-bitmap.c: introduce 'bitmap_is_preferred_refname()'
  pack-bitmap.c: introduce 'nth_bitmap_object_oid()'
  pack-bitmap.c: introduce 'bitmap_num_objects()'
  midx: avoid opening multiple MIDXs when writing
  midx: close linked MIDXs, avoid leaking memory
  ...

2 years agoMerge branch 'ps/fetch-optim'
Junio C Hamano [Mon, 20 Sep 2021 22:20:39 +0000 (15:20 -0700)] 
Merge branch 'ps/fetch-optim'

Optimize code that handles large number of refs in the "git fetch"
code path.

* ps/fetch-optim:
  fetch: avoid second connectivity check if we already have all objects
  fetch: merge fetching and consuming refs
  fetch: refactor fetch refs to be more extendable
  fetch-pack: optimize loading of refs via commit graph
  connected: refactor iterator to return next object ID directly
  fetch: avoid unpacking headers in object existence check
  fetch: speed up lookup of want refs via commit-graph

2 years agot0000: avoid masking git exit value through pipes
Carlo Marcelo Arenas Belón [Thu, 16 Sep 2021 08:55:23 +0000 (01:55 -0700)] 
t0000: avoid masking git exit value through pipes

9af0b8dbe2 (t0000-basic: more commit-tree tests., 2006-04-26) adds
tests for commit-tree that mask the return exit from git as described
in a378fee5b07 (Documentation: add shell guidelines, 2018-10-05).

Fix the tests, to avoid pipes by using a temporary file instead.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotree-diff: fix leak when not HAVE_ALLOCA_H
Carlo Marcelo Arenas Belón [Thu, 16 Sep 2021 08:55:22 +0000 (01:55 -0700)] 
tree-diff: fix leak when not HAVE_ALLOCA_H

b8ba412bf7 (tree-diff: avoid alloca for large allocations, 2016-06-07)
adds a way to route some bigger allocations out of the stack and free
them through the addition of two conveniently named macros, but leaves
the calls to free the xalloca part, which could be also in the heap,
if the system doesn't HAVE_ALLOCA_H (ex: macOS and other BSD).

Add the missing free call, xalloca_free(), which is a noop if we
allocated memory in the stack frame, but a real free() if we
allocated in the heap instead, and while at it, change the expression
to match in both macros for ease of readability.

This avoids a leak reported by LSAN while running t0000 but that
wouldn't fail the test (which is fixed in the next patch):

  SUMMARY: LeakSanitizer: 1034 byte(s) leaked in 15 allocation(s).

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopack-revindex.h: correct the time complexity descriptions
Kyle Zhao [Wed, 15 Sep 2021 09:09:23 +0000 (09:09 +0000)] 
pack-revindex.h: correct the time complexity descriptions

Time complexities for pack_pos_to_midx and midx_to_pack_pos are swapped,
correct it.

Signed-off-by: Kyle Zhao <kylezhao@tencent.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe sixth batch
Junio C Hamano [Wed, 15 Sep 2021 20:15:09 +0000 (13:15 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/prefix-filename-allocates'
Junio C Hamano [Wed, 15 Sep 2021 20:15:28 +0000 (13:15 -0700)] 
Merge branch 'jc/prefix-filename-allocates'

Leakfix.

* jc/prefix-filename-allocates:
  hash-object: prefix_filename() returns allocated memory these days

2 years agoMerge branch 'rs/range-diff-avoid-segfault-with-I'
Junio C Hamano [Wed, 15 Sep 2021 20:15:27 +0000 (13:15 -0700)] 
Merge branch 'rs/range-diff-avoid-segfault-with-I'

"git range-diff -I... <range> <range>" segfaulted, which has been
corrected.

* rs/range-diff-avoid-segfault-with-I:
  range-diff: avoid segfault with -I

2 years agoMerge branch 'ab/reverse-midx-optim'
Junio C Hamano [Wed, 15 Sep 2021 20:15:27 +0000 (13:15 -0700)] 
Merge branch 'ab/reverse-midx-optim'

The code that optionally creates the *.rev reverse index file has
been optimized to avoid needless computation when it is not writing
the file out.

* ab/reverse-midx-optim:
  pack-write: skip *.rev work when not writing *.rev

2 years agoMerge branch 'bs/install-strip'
Junio C Hamano [Wed, 15 Sep 2021 20:15:26 +0000 (13:15 -0700)] 
Merge branch 'bs/install-strip'

"make INSTALL_STRIP=-s install" allows the installation step to use
"install -s" to strip the binaries as they get installed.

* bs/install-strip:
  make: add INSTALL_STRIP option variable

2 years agoMerge branch 'pb/test-use-user-env'
Junio C Hamano [Wed, 15 Sep 2021 20:15:26 +0000 (13:15 -0700)] 
Merge branch 'pb/test-use-user-env'

Teach "test_pause" and "debug" helpers to allow using the HOME and
TERM environment variables the user usually uses.

* pb/test-use-user-env:
  test-lib-functions: keep user's debugger config files and TERM in 'debug'
  test-lib-functions: optionally keep HOME, TERM and SHELL in 'test_pause'
  test-lib-functions: use 'TEST_SHELL_PATH' in 'test_pause'

2 years agoMerge branch 'jc/trivial-threeway-binary-merge'
Junio C Hamano [Wed, 15 Sep 2021 20:15:26 +0000 (13:15 -0700)] 
Merge branch 'jc/trivial-threeway-binary-merge'

The "git apply -3" code path learned not to bother the lower level
merge machinery when the three-way merge can be trivially resolved
without the content level merge.

* jc/trivial-threeway-binary-merge:
  apply: resolve trivial merge without hitting ll-merge with "--3way"

2 years agoMerge branch 'bs/doc-bugreport-outdir'
Junio C Hamano [Wed, 15 Sep 2021 20:15:25 +0000 (13:15 -0700)] 
Merge branch 'bs/doc-bugreport-outdir'

Docfix.

* bs/doc-bugreport-outdir:
  Documentation: fix default directory of git bugreport -o

2 years agoMerge branch 'ab/no-more-check-bindir'
Junio C Hamano [Wed, 15 Sep 2021 20:15:25 +0000 (13:15 -0700)] 
Merge branch 'ab/no-more-check-bindir'

Build simplification.

* ab/no-more-check-bindir:
  Makefile: remove the check_bindir script

2 years agoMerge branch 'ab/send-email-config-fix'
Junio C Hamano [Wed, 15 Sep 2021 20:15:24 +0000 (13:15 -0700)] 
Merge branch 'ab/send-email-config-fix'

Regression fix.

* ab/send-email-config-fix:
  send-email: fix a "first config key wins" regression in v2.33.0

2 years agoMerge branch 'so/diff-index-regression-fix'
Junio C Hamano [Wed, 15 Sep 2021 20:15:24 +0000 (13:15 -0700)] 
Merge branch 'so/diff-index-regression-fix'

Recent "diff -m" changes broke "gitk", which has been corrected.

* so/diff-index-regression-fix:
  diff-index: restore -c/--cc options handling

2 years agot1400: avoid SIGPIPE race condition on fifo
Jeff King [Wed, 15 Sep 2021 17:24:52 +0000 (13:24 -0400)] 
t1400: avoid SIGPIPE race condition on fifo

t1400.190 sometimes fails or even hangs because of the way it uses
fifos. Our goal is to interactively read and write lines from
update-ref, so we have two fifos, in and out. We open a descriptor
connected to "in" and redirect output to that, so that update-ref does
not see EOF as it would if we opened and closed it for each "echo" call.

But we don't do the same for the output. This leads to a race where our
"read response <out" has not yet opened the fifo, but update-ref tries
to write to it and gets SIGPIPE. This can result in the test failing, or
worse, hanging as we wait forever for somebody to write to the pipe.

This is the same proble we fixed in 4783e7ea83 (t0008: avoid SIGPIPE
race condition on fifo, 2013-07-12), and we can fix it the same way, by
opening a second long-running descriptor.

Before this patch, running:

  ./t1400-update-ref.sh --run=1,190 --stress

failed or hung within a few dozen iterations. After it, I ran it for
several hundred without problems.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosubmodule: extract path to submodule gitdir func
Jonathan Tan [Wed, 15 Sep 2021 18:59:19 +0000 (11:59 -0700)] 
submodule: extract path to submodule gitdir func

We currently store each submodule gitdir in ".git/modules/<name>", but
this has problems with some submodule naming schemes, as described in a
comment in submodule_name_to_gitdir() in this patch.

Extract the determination of the location of a submodule's gitdir into
its own function submodule_name_to_gitdir(). For now, the problem
remains unsolved, but this puts us in a better position for finding a
solution.

This was motivated, at $DAYJOB, by a part of Android's repo hierarchy
[1]. In particular, there is a repo "build", and several repos of the
form "build/<name>".

This is based on earlier work by Brandon Williams [2].

[1] https://android.googlesource.com/platform/
[2] https://lore.kernel.org/git/20180808223323.79989-2-bmwill@google.com/

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodocumentation: add documentation for 'git version'
Matthias Aßhauer [Tue, 14 Sep 2021 13:27:18 +0000 (13:27 +0000)] 
documentation: add documentation for 'git version'

While 'git version' is probably the least complex git command,
it is a non-experimental user-facing builtin command. As such
it should have a help page.

Both `git help` and `git version` can be called as options
(`--help`/`--version`) that internally get converted to the
corresponding command. Add a small paragraph to
Documentation/git.txt describing how these two options
interact with each other and link to this help page for the
sub-options that `--version` can take. Well, currently there
is only one sub-option, but that could potentially increase
in future versions of Git.

Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohelp: make sure local html page exists before calling external processes
Matthias Aßhauer [Tue, 14 Sep 2021 13:27:17 +0000 (13:27 +0000)] 
help: make sure local html page exists before calling external processes

We check that git.html exists, regardless of the page the user wants to open.
Checking whether the requested page exists instead gives us a smoother user
experience in two use cases:

1) The requested page doesn't exist

When calling a git command and there is an error, most users reasonably expect
git to produce an error message on the standard error stream, but in this case
we pass the filepath to git web--browse which passes it on to a browser (or a
helper program like xdg-open or start that should in turn open a browser)
without any error and many GUI based browsers or helpers won't output such a
message onto the standard error stream.

Especially the helper programs tend to show the corresponding error message in
a message box and wait for user input before exiting. This leaves users in
interactive console sessions without an error message in their console,
without a console prompt and without the help page they expected.

2) git.html is missing for some reason, but the user asked for some other page

We currently refuse to show any local html help page when we can't find
git.html. Even if the requested help page exists. If we check for the requested
page instead, we can show the user all available pages and only error out on
those that don't exist.

Signed-off-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-compat-util: include declaration for unix sockets in windows
Carlo Marcelo Arenas Belón [Tue, 14 Sep 2021 07:26:00 +0000 (00:26 -0700)] 
git-compat-util: include declaration for unix sockets in windows

Available since Windows 10 release 1803 and Windows Server 2019.

NO_UNIX_SOCKETS is still the default for Windows builds, as they need
to keep backward compatibility with releases up to Windows 7, but allow
including the header otherwise.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocredential-cache: check for windows specific errors
Carlo Marcelo Arenas Belón [Tue, 14 Sep 2021 07:25:59 +0000 (00:25 -0700)] 
credential-cache: check for windows specific errors

Connect and reset errors aren't what will be expected by POSIX but
are instead compatible with the ones used by WinSock.

To avoid any possibility of confusion with other systems, checks
for disconnection and availability had been abstracted into helper
functions that are platform specific.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot0301: fixes for windows compatibility
Carlo Marcelo Arenas Belón [Tue, 14 Sep 2021 07:25:58 +0000 (00:25 -0700)] 
t0301: fixes for windows compatibility

In preparation for a future patch that will allow building with
Unix Sockets in Windows, workaround a couple of issues from the
Mingw-W64 compatibility layer.

test -S is not able to detect that a file is a socket, so use
test -e instead (through a library function).

`mkdir -m` can't represent a valid ACL directly and fails with
permission problems, so instead call mkdir followed by chmod, which
has been enhanced to do so.

The last invocation of mkdir would likely need the same treatment
but SYMLINK is unlikely to be enabled on Windows so it has been
punted for now.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodoc: config, tell readers of `git help --config`
Philip Oakley [Mon, 13 Sep 2021 21:23:05 +0000 (22:23 +0100)] 
doc: config, tell readers of `git help --config`

The `git help` command gained the ability to list config variables in
3ac68a93fd (help: add --config to list all available config, 2018-05-26)
but failed to tell readers of the config documenation itself.

Provide that cross reference.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobisect--helper: retire `--bisect-next-check` subcommand
Miriam Rubio [Mon, 13 Sep 2021 17:39:04 +0000 (19:39 +0200)] 
bisect--helper: retire `--bisect-next-check` subcommand

After reimplementation of `git bisect run` in C,
`--bisect-next-check` subcommand is not needed anymore.

Let's remove it from options list and code.

Mentored by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Miriam Rubio <mirucam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobisect--helper: reimplement `bisect_run` shell function in C
Tanushree Tumane [Mon, 13 Sep 2021 17:39:03 +0000 (19:39 +0200)] 
bisect--helper: reimplement `bisect_run` shell function in C

Reimplement the `bisect_run()` shell function
in C and also add `--bisect-run` subcommand to
`git bisect--helper` to call it from git-bisect.sh.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
Signed-off-by: Miriam Rubio <mirucam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobisect--helper: reimplement `bisect_visualize()` shell function in C
Pranit Bauva [Mon, 13 Sep 2021 17:39:02 +0000 (19:39 +0200)] 
bisect--helper: reimplement `bisect_visualize()` shell function in C

Reimplement the `bisect_visualize()` shell function
in C and also add `--bisect-visualize` subcommand to
`git bisect--helper` to call it from git-bisect.sh.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
Signed-off-by: Miriam Rubio <mirucam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorun-command: make `exists_in_PATH()` non-static
Pranit Bauva [Mon, 13 Sep 2021 17:39:01 +0000 (19:39 +0200)] 
run-command: make `exists_in_PATH()` non-static

Remove the `static` keyword from `exists_in_PATH()` function
and declare the function in `run-command.h` file.
The function will be used in bisect_visualize() in a later
commit.

Mentored by: Christian Couder <chriscool@tuxfamily.org>
Mentored by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
Signed-off-by: Miriam Rubio <mirucam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot6030-bisect-porcelain: add test for bisect visualize
Miriam Rubio [Mon, 13 Sep 2021 17:39:00 +0000 (19:39 +0200)] 
t6030-bisect-porcelain: add test for bisect visualize

Add a test to control breakages in bisect visualize command.

Signed-off-by: Miriam Rubio <mirucam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot6030-bisect-porcelain: add tests to control bisect run exit cases
Miriam Rubio [Mon, 13 Sep 2021 17:38:59 +0000 (19:38 +0200)] 
t6030-bisect-porcelain: add tests to control bisect run exit cases

There is a gap on bisect run test coverage related with error exits.
Add two tests to control these error cases.

Signed-off-by: Miriam Rubio <mirucam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp: don't hardcode the value of CURL_SOCKOPT_OK
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:29 +0000 (16:51 +0200)] 
http: don't hardcode the value of CURL_SOCKOPT_OK

Use the new git-curl-compat.h header to define CURL_SOCKOPT_OK to its
known value if we're on an older curl version that doesn't have it. It
was hardcoded in http.c in a15d069a198 (http: enable keepalive on TCP
sockets, 2013-10-12).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp: centralize the accounting of libcurl dependencies
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:28 +0000 (16:51 +0200)] 
http: centralize the accounting of libcurl dependencies

As discussed in 644de29e220 (http: drop support for curl < 7.19.4,
2021-07-30) checking against LIBCURL_VERSION_NUM isn't as reliable as
checking specific symbols present in curl, as some distros have been
known to backport features.

However, while some of the curl_easy_setopt() arguments we rely on are
macros, others are enum, and we can't assume that those that are
macros won't change into enums in the future.

So we're still going to have to check LIBCURL_VERSION_NUM, but by
doing that in one central place and using a macro definition of our
own, anyone who's backporting features can define it themselves, and
thus have access to more modern curl features that they backported,
even if they didn't bump the LIBCURL_VERSION_NUM.

More importantly, as shown in a preceding commit doing these version
checks makes for hard to read and possibly buggy code, as shown by the
bug fixed there where we were conflating base 10 for base 16 when
comparing the version.

By doing them all in one place we'll hopefully reduce the chances of
such future mistakes, furthermore it now becomes easier to see at a
glance what the oldest supported version is, which makes it easier to
reason about any future deprecation similar to the recent
e48a623dea0 (Merge branch 'ab/http-drop-old-curl', 2021-08-24).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp: correct curl version check for CURLOPT_PINNEDPUBLICKEY
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:27 +0000 (16:51 +0200)] 
http: correct curl version check for CURLOPT_PINNEDPUBLICKEY

In aeff8a61216 (http: implement public key pinning, 2016-02-15) a
dependency and warning() was added if curl older than 7.44.0 was used,
but the relevant code depended on CURLOPT_PINNEDPUBLICKEY, introduced
in 7.39.0.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp: correct version check for CURL_HTTP_VERSION_2
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:26 +0000 (16:51 +0200)] 
http: correct version check for CURL_HTTP_VERSION_2

In d73019feb44 (http: add support selecting http version, 2018-11-08)
a dependency was added on CURL_HTTP_VERSION_2, but this feature was
introduced in curl version 7.43.0, not 7.47.0, as the incorrect
version check led us to believe.

As looking through the history of that commit on the mailing list will
reveal[1], the reason for this is that an earlier version of it
depended on CURL_HTTP_VERSION_2TLS, which was introduced in libcurl
7.47.0.

But the version that made it in in d73019feb44 had dropped the
dependency on CURL_HTTP_VERSION_2TLS, but the corresponding version
check was not corrected.

The newest symbol we depend on is CURL_HTTP_VERSION_2. It was added in
7.33.0, but the CURL_HTTP_VERSION_2 alias we used was added in
7.47.0. So we could support an even older version here, but let's just
correct the checked version.

1. https://lore.kernel.org/git/pull.69.git.gitgitgadget@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp: drop support for curl < 7.18.0 (again)
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:25 +0000 (16:51 +0200)] 
http: drop support for curl < 7.18.0 (again)

In 644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30) we
dropped support for curl < 7.19.4, so we can drop support for this
non-obvious dependency on curl < 7.18.0.

It's non-obvious because in curl's hex version notation 0x071800 is
version 7.24.0, *not* 7.18.0, so at a glance this patch looks
incorrect.

But it's correct, because the existing version check being removed
here is wrong. The check guards use of the following curl defines:

    CURLPROXY_SOCKS4                7.10
    CURLPROXY_SOCKS4A               7.18.0
    CURLPROXY_SOCKS5                7.10
    CURLPROXY_SOCKS5_HOSTNAME       7.18.0

I.e. the oldest version that has these is in fact 7.18.0, not
7.24.0. That we were checking 7.24.0 is just an mistake in
6d7afe07f29 (remote-http(s): support SOCKS proxies, 2015-10-26),
i.e. its author confusing base 10 and base 16.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: drop support for curl < 7.9.8 (again)
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:24 +0000 (16:51 +0200)] 
Makefile: drop support for curl < 7.9.8 (again)

In 1119a15b5c8 (http: drop support for curl < 7.11.1, 2021-07-30)
support for curl versions older than 7.11.1 was removed, and we
currently require at least version 7.19.4, see 644de29e220 (http: drop
support for curl < 7.19.4, 2021-07-30).

In those changes this Makefile-specific check added in
0890098780f (Decide whether to build http-push in the Makefile,
2005-11-18) was missed, now that we're never going to use such an
ancient curl version we don't need to check that we have at least
7.9.8 here. I have no idea what in http-push.c broke on versions older
than that.

This does not impact "NO_CURL" setups, as this is in the "else" branch
after that check.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoINSTALL: mention that we need libcurl 7.19.4 or newer to build
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 14:51:23 +0000 (16:51 +0200)] 
INSTALL: mention that we need libcurl 7.19.4 or newer to build

Without NO_CURL=Y we require at least version "7.19.4" of libcurl, see
644de29e220 (http: drop support for curl < 7.19.4, 2021-07-30). Let's
document this in the "INSTALL" document.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoparse-options API: remove OPTION_ARGUMENT feature
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 03:35:40 +0000 (05:35 +0200)] 
parse-options API: remove OPTION_ARGUMENT feature

As was noted in 1a85b49b87a (parse-options: make OPT_ARGUMENT() more
useful, 2019-03-14) there's only ever been one user of the
OPT_ARGUMENT(), that user was added in 20de316e334 (difftool: allow
running outside Git worktrees with --no-index, 2019-03-14).

The OPT_ARGUMENT() feature itself was added way back in
580d5bffdea (parse-options: new option type to treat an option-like
parameter as an argument., 2008-03-02), but as discussed in
1a85b49b87a wasn't used until 20de316e334 in 2019.

Now that the preceding commit has migrated this code over to using
"struct strvec" to manage the "args" member of a "struct
child_process", we can just use that directly instead of relying on
OPT_ARGUMENT.

This has a minor change in behavior in that if we'll pass --no-index
we'll now always pass it as the first argument, before we'd pass it in
whatever position the caller did. Preserving this was the real value
of OPT_ARGUMENT(), but as it turns out we didn't need that either. We
can always inject it as the first argument, the other end will parse
it just the same.

Note that we cannot remove the "out" and "cpidx" members of "struct
parse_opt_ctx_t" added in 580d5bffdea, while they were introduced with
OPT_ARGUMENT() we since used them for other things.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodifftool: use run_command() API in run_file_diff()
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 03:35:39 +0000 (05:35 +0200)] 
difftool: use run_command() API in run_file_diff()

Change the run_file_diff() function to use the run_command() API
directly, instead of invoking the run_command_v_opt_cd_env() wrapper.

This allows it, like run_dir_diff(), to use the "args" from "struct
strvec", instead of the "const char **argv" passed into
cmd_difftool(). This will be used in the subsequent commit to get rid
of OPT_ARGUMENT() from cmd_difftool().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodifftool: prepare "diff" cmdline in cmd_difftool()
Jeff King [Mon, 13 Sep 2021 03:35:38 +0000 (05:35 +0200)] 
difftool: prepare "diff" cmdline in cmd_difftool()

We call into either run_dir_diff() or run_file_diff(), each of which
sets up a child argv starting with "diff" and some hard-coded options
(depending on which mode we're using). Let's extract that logic into the
caller, which will make it easier to modify the options for cases which
affect both functions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodifftool: prepare "struct child_process" in cmd_difftool()
Ævar Arnfjörð Bjarmason [Mon, 13 Sep 2021 03:35:37 +0000 (05:35 +0200)] 
difftool: prepare "struct child_process" in cmd_difftool()

Move the preparation of the "struct child_process" from run_dir_diff()
to its only caller, cmd_difftool(). This is in preparation for
migrating run_file_diff() to using the run_command() API directly, and
to move more of the shared setup of the two to cmd_difftool().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogc: remove unused launchctl_get_uid() call
Ævar Arnfjörð Bjarmason [Sun, 12 Sep 2021 00:24:40 +0000 (02:24 +0200)] 
gc: remove unused launchctl_get_uid() call

When the launchctl_boot_plist() function was added in
a16eb6b1ff3 (maintenance: skip bootout/bootstrap when plist is
registered, 2021-08-24), an unused call to launchctl_get_uid() was
added along with it. That call appears to have been copy/pasted from
launchctl_boot_plist().

Since we can remove that, we can also get rid of the "result"
variable, whose only purpose was allow for the free() between its
assignment and the return. That pattern also appears to have been
copy/pasted from launchctl_boot_plist().

As the patch shows the returned value from launchctl_get_uid() wasn't
used at all in this function. The launchctl_get_uid() function itself
just calls xstrfmt() and getuid(), neither of which have any subtle
global side-effects, so this removal is safe.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-tool run-command: fix flip-flop init pattern
Ævar Arnfjörð Bjarmason [Sat, 11 Sep 2021 18:26:41 +0000 (20:26 +0200)] 
test-tool run-command: fix flip-flop init pattern

In be5d88e1128 (test-tool run-command: learn to run (parts of) the
testsuite, 2019-10-04) an init pattern was added that would use
TESTSUITE_INIT, but then promptly memset() everything back to 0. We'd
then set the "dup" on the two string lists.

Our setting of "next" to "-1" thus did nothing, we'd reset it to "0"
before using it. Let's set it to "0" instead, and trust the
"STRING_LIST_INIT_DUP" to set "strdup_strings" appropriately for us.

Note that while we compile this code, there's no in-tree user for the
"testsuite" target being modified here anymore, see the discussion at
and around <nycvar.QRO.7.76.6.2109091323150.59@tvgsbejvaqbjf.bet>[1].

1. https://lore.kernel.org/git/nycvar.QRO.7.76.6.2109091323150.59@tvgsbejvaqbjf.bet/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotests: remove leftover untracked files
Elijah Newren [Sat, 11 Sep 2021 17:08:42 +0000 (17:08 +0000)] 
tests: remove leftover untracked files

Remove untracked files that are unwanted after they are done being used.

While the set of cases in this patch is certainly far from
comprehensive, it was motivated by some work to see what the fallout
would be if we were to make the removal of untracked files as a side
effect of other commands into an error.  Some cases were a bit more
involved than the testcase changes included in this patch, but the ones
included here represent the simple cases.  While this patch is not that
important since we are not changing the behavior of those other commands
into an error in the near term, I thought these changes were useful
anyway as an explicit documentation of the intent that these untracked
files are no longer useful.

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Acked-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agostrvec: use size_t to store nr and alloc
Jeff King [Sat, 11 Sep 2021 15:01:16 +0000 (11:01 -0400)] 
strvec: use size_t to store nr and alloc

We converted argv_array (which later became strvec) to use size_t in
819f0e76b1 (argv-array: use size_t for count and alloc, 2020-07-28) in
order to avoid the possibility of integer overflow. But later, commit
d70a9eb611 (strvec: rename struct fields, 2020-07-28) accidentally
converted these back to ints!

Those two commits were part of the same patch series. I'm pretty sure
what happened is that they were originally written in the opposite order
and then cleaned up and re-ordered during an interactive rebase. And
when resolving the inevitable conflict, I mistakenly took the "rename"
patch completely, accidentally dropping the type change.

We can correct it now; better late than never.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompression: drop write-only core_compression_* variables
René Scharfe [Sat, 11 Sep 2021 11:45:43 +0000 (13:45 +0200)] 
compression: drop write-only core_compression_* variables

Since 8de7eeb54b (compression: unify pack.compression configuration
parsing, 2016-11-15) the variables core_compression_level and
core_compression_seen are only set, but never read.  Remove them.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-lib: remove unused $_x40 and $_z40 variables
Ævar Arnfjörð Bjarmason [Sat, 11 Sep 2021 11:17:51 +0000 (13:17 +0200)] 
test-lib: remove unused $_x40 and $_z40 variables

These two have fallen out of use with the SHA-256 migration.

The last use of $_x40 was removed in fc7e73d7ef (t4013: improve
diff-post-processor logic, 2020-08-21) and

The last use of $_z40 was removed in 7a868c51c2 (t5562: use $ZERO_OID,
2019-12-21), but it was then needlessly refactored to be hash-agnostic
in 192b517589 (t: use hash-specific lookup tables to define test
constants, 2020-02-22). We can just remove it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-bisect: remove unused SHA-1 $x40 shell variable
Ævar Arnfjörð Bjarmason [Sat, 11 Sep 2021 11:17:50 +0000 (13:17 +0200)] 
git-bisect: remove unused SHA-1 $x40 shell variable

This variable was last used in code removed in
06f5608c14 (bisect--helper: `bisect_start` shell function partially in
C, 2019-01-02).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogit-sh-setup: remove unused "pull with rebase" message
Ævar Arnfjörð Bjarmason [Sat, 11 Sep 2021 11:17:49 +0000 (13:17 +0200)] 
git-sh-setup: remove unused "pull with rebase" message

Remove the "pull with rebase" message previously used by the
git-pull.sh script, which was removed in 49eb8d39c78 (Remove
contrib/examples/*, 2018-03-25).

Even if some out-of-tree user copy/pasted the old git-pull.sh code,
and relied on passing it a "pull with rebase" argument, we'll fall
back on the "*" case here, they just won't get the "pull with rebase"
part of their message translated.

I don't think it's likely that anyone out-of-tree relied on that, but
I'm being conservative here per the discussion that can be found
upthread of [1].

1. https://lore.kernel.org/git/87tuiwjfvi.fsf@evledraar.gmail.com/

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