]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 years agouse child_process members "args" and "env" directly
René Scharfe [Sun, 30 Oct 2022 11:51:14 +0000 (12:51 +0100)] 
use child_process members "args" and "env" directly

Build argument list and environment of child processes by using
struct child_process and populating its members "args" and "env"
directly instead of maintaining separate strvecs and letting
run_command_v_opt() and friends populate these members.  This is
simpler, shorter and slightly more efficient.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agouse child_process member "args" instead of string array variable
René Scharfe [Sun, 30 Oct 2022 11:50:27 +0000 (12:50 +0100)] 
use child_process member "args" instead of string array variable

Use run_command() with a struct child_process variable and populate its
"args" member directly instead of building a string array and passing it
to run_command_v_opt().  This avoids the use of magic index numbers and
makes simplifies the possible addition of more arguments in the future.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agosequencer: simplify building argument list in do_exec()
René Scharfe [Sun, 30 Oct 2022 11:49:37 +0000 (12:49 +0100)] 
sequencer: simplify building argument list in do_exec()

Build child_argv during initialization, taking advantage of the C99
support for initialization expressions that are not compile time
constants.  This avoids the use of a magic index constant and is shorter
and simpler.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agobisect--helper: factor out do_bisect_run()
René Scharfe [Sun, 30 Oct 2022 11:48:16 +0000 (12:48 +0100)] 
bisect--helper: factor out do_bisect_run()

Deduplicate the code for reporting and starting the bisect run command
by moving it to a short helper function.  Use a string array instead of
a strvec to prepare the arguments, for simplicity.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agobisect: simplify building "checkout" argument list
René Scharfe [Sun, 30 Oct 2022 11:47:02 +0000 (12:47 +0100)] 
bisect: simplify building "checkout" argument list

Reduce the scope of argv_checkout, which allows to fully build it during
initialization.  Use oid_to_hex() instead of oid_to_hex_r(), because
that's simpler and using the static buffer of the former is just as safe
as the old static argv_checkout.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agoam: simplify building "show" argument list
René Scharfe [Sun, 30 Oct 2022 11:46:11 +0000 (12:46 +0100)] 
am: simplify building "show" argument list

Build the string array av during initialization, without any magic
numbers or heap allocations.  Not duplicating the result of oid_to_hex()
is safe because run_command_v_opt() duplicates all arguments already.
(It would even be safe if it didn't, but that's a different story.)

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agorun-command: fix return value comment
René Scharfe [Sun, 30 Oct 2022 11:45:13 +0000 (12:45 +0100)] 
run-command: fix return value comment

483bbd4e4c (run-command: introduce child_process_init(), 2014-08-19) and
2d71608ec0 (run-command: factor out child_process_clear(), 2015-10-24)
added help texts about child_process_init() and child_process_clear()
without updating the immediately following documentation of return codes
that only applied to the preexisting functions.

4c4066d95d (run-command: move doc to run-command.h, 2019-11-17) started
to list the functions explicitly that this paragraph applies to, but
still wrongly included child_process_init() and child_process_clear().
Remove their names from that list.

Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agomerge: remove always-the-same "verbose" arguments
Ævar Arnfjörð Bjarmason [Sun, 30 Oct 2022 11:42:59 +0000 (12:42 +0100)] 
merge: remove always-the-same "verbose" arguments

Simplify the code that builds the arguments for the "read-tree"
invocation in reset_hard() and read_empty() to remove the "verbose"
parameter.

Before 172b6428d06 (do not overwrite untracked during merge from
unborn branch, 2010-11-14) there was a "reset_hard()" function that
would be called in two places, one of those passed a "verbose=1", the
other a "verbose=0".

After 172b6428d06 when read_empty() was split off from reset_hard()
both of these functions only had one caller. The "verbose" in
read_empty() would always be false, and the one in reset_hard() would
always be true.

There was never a good reason for the code to act this way, it
happened because the read_empty() function was a copy/pasted and
adjusted version of reset_hard().

Since we're no longer conditionally adding the "-v" parameter
here (and we'd only add it for "reset_hard()" we'll be able to move to
a simpler and safer run-command API in the subsequent commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2 years agoSync with 'maint'
Junio C Hamano [Wed, 26 Oct 2022 00:12:09 +0000 (17:12 -0700)] 
Sync with 'maint'

2 years agoThe sixth batch
Junio C Hamano [Tue, 25 Oct 2022 23:22:28 +0000 (16:22 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jc/more-sanitizer-at-ci'
Junio C Hamano [Wed, 26 Oct 2022 00:11:44 +0000 (17:11 -0700)] 
Merge branch 'jc/more-sanitizer-at-ci'

Enable address and undefined sanitizer tasks at GitHub Actions CI.

* jc/more-sanitizer-at-ci:
  ci: add address and undefined sanitizer tasks

2 years agoMerge branch 'jc/ci-osx-with-sha1dc'
Junio C Hamano [Wed, 26 Oct 2022 00:11:44 +0000 (17:11 -0700)] 
Merge branch 'jc/ci-osx-with-sha1dc'

Give a bit more diversity to macOS CI by using sha1dc in one of the
jobs (the other one tests Apple Common Crypto).

* jc/ci-osx-with-sha1dc:
  ci: use DC_SHA1=YesPlease on osx-clang job for CI

2 years agoMerge branch 'gc/bare-repo-discovery'
Junio C Hamano [Wed, 26 Oct 2022 00:11:44 +0000 (17:11 -0700)] 
Merge branch 'gc/bare-repo-discovery'

Allow configuration files in "protected" scopes to include other
configuration files.

* gc/bare-repo-discovery:
  config: respect includes in protected config

2 years agoMerge branch 'rs/diff-caret-bang-with-parents'
Junio C Hamano [Wed, 26 Oct 2022 00:11:43 +0000 (17:11 -0700)] 
Merge branch 'rs/diff-caret-bang-with-parents'

"git diff rev^!" did not show combined diff to go to the rev from
its parents.

* rs/diff-caret-bang-with-parents:
  diff: support ^! for merges
  revisions.txt: unspecify order of resolved parts of ^!
  revision: use strtol_i() for exclude_parent

2 years agoDownmerge a handful of topics for 2.38.2
Junio C Hamano [Wed, 26 Oct 2022 00:11:13 +0000 (17:11 -0700)] 
Downmerge a handful of topics for 2.38.2

2 years agoMerge branch 'jk/cleanup-callback-parameters' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:39 +0000 (17:11 -0700)] 
Merge branch 'jk/cleanup-callback-parameters' into maint-2.38

Code clean-up.

* jk/cleanup-callback-parameters:
  attr: drop DEBUG_ATTR code
  commit: avoid writing to global in option callback
  multi-pack-index: avoid writing to global in option callback
  test-submodule: inline resolve_relative_url() function

2 years agoMerge branch 'rs/gc-pack-refs-simplify' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:39 +0000 (17:11 -0700)] 
Merge branch 'rs/gc-pack-refs-simplify' into maint-2.38

Code clean-up.

* rs/gc-pack-refs-simplify:
  gc: simplify maintenance_task_pack_refs()

2 years agoMerge branch 'nb/doc-mergetool-typofix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:38 +0000 (17:11 -0700)] 
Merge branch 'nb/doc-mergetool-typofix' into maint-2.38

Typofix.

* nb/doc-mergetool-typofix:
  mergetool.txt: typofix 'overwriten' -> 'overwritten'

2 years agoMerge branch 'jk/sequencer-missing-author-name-check' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:38 +0000 (17:11 -0700)] 
Merge branch 'jk/sequencer-missing-author-name-check' into maint-2.38

Typofix in code.

* jk/sequencer-missing-author-name-check:
  sequencer: detect author name errors in read_author_script()

2 years agoMerge branch 'ds/bundle-uri-docfix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'ds/bundle-uri-docfix' into maint-2.38

Doc formatting fix.

* ds/bundle-uri-docfix:
  bundle-uri: fix technical doc issues

2 years agoMerge branch 'ab/test-malloc-with-sanitize-leak' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'ab/test-malloc-with-sanitize-leak' into maint-2.38

Test fix.

* ab/test-malloc-with-sanitize-leak:
  test-lib: have SANITIZE=leak imply TEST_NO_MALLOC_CHECK

2 years agoMerge branch 'rs/bisect-start-leakfix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'rs/bisect-start-leakfix' into maint-2.38

Code clean-up that results in plugging a leak.

* rs/bisect-start-leakfix:
  bisect--helper: plug strvec leak

2 years agoMerge branch 'jc/branch-description-unset' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'jc/branch-description-unset' into maint-2.38

"GIT_EDITOR=: git branch --edit-description" resulted in failure,
which has been corrected.

* jc/branch-description-unset:
  branch: do not fail a no-op --edit-desc

2 years agoMerge branch 'pw/ssh-sign-report-errors' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:35 +0000 (17:11 -0700)] 
Merge branch 'pw/ssh-sign-report-errors' into maint-2.38

The codepath to sign learned to report errors when it fails to read
from "ssh-keygen".

* pw/ssh-sign-report-errors:
  ssh signing: return an error when signature cannot be read

2 years agoMerge branch 'pw/mailinfo-b-fix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:35 +0000 (17:11 -0700)] 
Merge branch 'pw/mailinfo-b-fix' into maint-2.38

Fix a logic in "mailinfo -b" that miscomputed the length of a
substring, which lead to an out-of-bounds access.

* pw/mailinfo-b-fix:
  mailinfo -b: fix an out of bounds access

2 years agoMerge branch 'rs/test-httpd-in-C-locale' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:35 +0000 (17:11 -0700)] 
Merge branch 'rs/test-httpd-in-C-locale' into maint-2.38

Force C locale while running tests around httpd to make sure we can
find expected error messages in the log.

* rs/test-httpd-in-C-locale:
  t/lib-httpd: pass LANG and LC_ALL to Apache

2 years agoMerge branch 'js/merge-ort-in-read-only-repo' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:34 +0000 (17:11 -0700)] 
Merge branch 'js/merge-ort-in-read-only-repo' into maint-2.38

In read-only repositories, "git merge-tree" tried to come up with a
merge result tree object, which it failed (which is not wrong) and
led to a segfault (which is bad), which has been corrected.

* js/merge-ort-in-read-only-repo:
  merge-ort: return early when failing to write a blob
  merge-ort: fix segmentation fault in read-only repositories

2 years agoMerge branch 'ja/rebase-i-avoid-amending-self' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:34 +0000 (17:11 -0700)] 
Merge branch 'ja/rebase-i-avoid-amending-self' into maint-2.38

"git rebase -i" can mistakenly attempt to apply a fixup to a commit
itself, which has been corrected.

* ja/rebase-i-avoid-amending-self:
  sequencer: avoid dropping fixup commit that targets self via commit-ish

2 years agoMerge branch 'jk/fsck-on-diet' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:33 +0000 (17:11 -0700)] 
Merge branch 'jk/fsck-on-diet' into maint-2.38

"git fsck" failed to release contents of tree objects already used
from the memory, which has been fixed.

* jk/fsck-on-diet:
  parse_object_buffer(): respect save_commit_buffer
  fsck: turn off save_commit_buffer
  fsck: free tree buffers after walking unreachable objects

2 years agoMerge branch 'ah/fsmonitor-daemon-usage-non-l10n' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:33 +0000 (17:11 -0700)] 
Merge branch 'ah/fsmonitor-daemon-usage-non-l10n' into maint-2.38

Fix messages incorrectly marked for translation.

* ah/fsmonitor-daemon-usage-non-l10n:
  fsmonitor--daemon: don't translate literal commands

2 years agoMerge branch 'jk/clone-allow-bare-and-o-together' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:33 +0000 (17:11 -0700)] 
Merge branch 'jk/clone-allow-bare-and-o-together' into maint-2.38

"git clone" did not like to see the "--bare" and the "--origin"
options used together without a good reason.

* jk/clone-allow-bare-and-o-together:
  clone: allow "--bare" with "-o"

2 years agoMerge branch 'jk/remote-rename-without-fetch-refspec' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:32 +0000 (17:11 -0700)] 
Merge branch 'jk/remote-rename-without-fetch-refspec' into maint-2.38

"git remote rename" failed to rename a remote without fetch
refspec, which has been corrected.

* jk/remote-rename-without-fetch-refspec:
  remote: handle rename of remote without fetch refspec

2 years agoMerge branch 'vd/fix-unaligned-read-index-v4' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:32 +0000 (17:11 -0700)] 
Merge branch 'vd/fix-unaligned-read-index-v4' into maint-2.38

The codepath that reads from the index v4 had unaligned memory
accesses, which has been corrected.

* vd/fix-unaligned-read-index-v4:
  read-cache: avoid misaligned reads in index v4

2 years agoMerge branch 'ab/coding-guidelines-c99' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:32 +0000 (17:11 -0700)] 
Merge branch 'ab/coding-guidelines-c99' into maint-2.38

Update CodingGuidelines to clarify what features to use and avoid
in C99.

* ab/coding-guidelines-c99:
  CodingGuidelines: recommend against unportable C99 struct syntax
  CodingGuidelines: mention C99 features we can't use
  CodingGuidelines: allow declaring variables in for loops
  CodingGuidelines: mention dynamic C99 initializer elements
  CodingGuidelines: update for C99

2 years agoThe fifth batch
Junio C Hamano [Fri, 21 Oct 2022 18:37:36 +0000 (11:37 -0700)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'rj/branch-edit-description-with-nth-checkout'
Junio C Hamano [Fri, 21 Oct 2022 18:37:29 +0000 (11:37 -0700)] 
Merge branch 'rj/branch-edit-description-with-nth-checkout'

"git branch --edit-description @{-1}" is now a way to edit branch
description of the branch you were on before switching to the
current branch.

* rj/branch-edit-description-with-nth-checkout:
  branch: support for shortcuts like @{-1}, completed

2 years agoMerge branch 'ds/cmd-main-reorder'
Junio C Hamano [Fri, 21 Oct 2022 18:37:28 +0000 (11:37 -0700)] 
Merge branch 'ds/cmd-main-reorder'

Code clean-up.

* ds/cmd-main-reorder:
  git.c: improve code readability in cmd_main()

2 years agoMerge branch 'ab/grep-simplify-extended-expression'
Junio C Hamano [Fri, 21 Oct 2022 18:37:28 +0000 (11:37 -0700)] 
Merge branch 'ab/grep-simplify-extended-expression'

Giving "--invert-grep" and "--all-match" without "--grep" to the
"git log" command resulted in an attempt to access grep pattern
expression structure that has not been allocated, which has been
corrected.

* ab/grep-simplify-extended-expression:
  grep.c: remove "extended" in favor of "pattern_expression", fix segfault

2 years agoMerge branch 'jc/symbolic-ref-no-recurse'
Junio C Hamano [Fri, 21 Oct 2022 18:37:28 +0000 (11:37 -0700)] 
Merge branch 'jc/symbolic-ref-no-recurse'

After checking out a "branch" that is a symbolic-ref that points at
another branch, "git symbolic-ref HEAD" reports the underlying
branch, not the symbolic-ref the user gave checkout as argument.
The command learned the "--no-recurse" option to stop after
dereferencing a symbolic-ref only once.

* jc/symbolic-ref-no-recurse:
  symbolic-ref: teach "--[no-]recurse" option

2 years agoMerge branch 'jk/use-o0-in-leak-sanitizer'
Junio C Hamano [Fri, 21 Oct 2022 18:37:27 +0000 (11:37 -0700)] 
Merge branch 'jk/use-o0-in-leak-sanitizer'

Avoid false-positive from LSan whose assumption may be broken with
higher optimization levels.

* jk/use-o0-in-leak-sanitizer:
  Makefile: force -O0 when compiling with SANITIZE=leak

2 years agoMerge branch 'ab/macos-build-fix-with-sha1dc'
Junio C Hamano [Fri, 21 Oct 2022 18:37:27 +0000 (11:37 -0700)] 
Merge branch 'ab/macos-build-fix-with-sha1dc'

Enable macOS build with sha1dc hash function.

* ab/macos-build-fix-with-sha1dc:
  fsmonitor OSX: compile with DC_SHA1=YesPlease

2 years agoci: use DC_SHA1=YesPlease on osx-clang job for CI
Junio C Hamano [Thu, 20 Oct 2022 17:01:07 +0000 (10:01 -0700)] 
ci: use DC_SHA1=YesPlease on osx-clang job for CI

7b8cfe34 (Merge branch 'ed/fsmonitor-on-networked-macos',
2022-10-17) broke the build on macOS with sha1dc by bypassing our
hash abstraction (git_SHA_CTX etc.), but it wasn't caught before the
problematic topic was merged down to the 'master' branch.  Nobody
was even compile testing with DC_SHA1 set, although it is the
recommended choice in these days for folks when they use SHA-1.

This was because the default for macOS uses Apple Common Crypto, and
both of the two CI jobs did not override the default.  Tweak one of
them to use DC_SHA1 to improve the coverage.

We may want to give similar diversity for Linux jobs so that some of
them build with other implementations of SHA-1; they currently all
build and test with DC_SHA1 as that is the default on everywhere
other than macOS.

But let's start small to fill only the immediate need.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoci: add address and undefined sanitizer tasks
Junio C Hamano [Thu, 20 Oct 2022 16:20:59 +0000 (09:20 -0700)] 
ci: add address and undefined sanitizer tasks

The current code is clean with these two sanitizers, and we would
like to keep it that way by running the checks for any new code.

The signal of "passed with asan, but not ubsan" (or vice versa) is
not that useful in practice, so it is tempting to run both santizers
in a single task, but it seems to take forever, so tentatively let's
try having two separate ones.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe fourth batch
Junio C Hamano [Wed, 19 Oct 2022 21:25:03 +0000 (14:25 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jh/struct-zero-init-with-older-clang'
Junio C Hamano [Wed, 19 Oct 2022 22:38:06 +0000 (15:38 -0700)] 
Merge branch 'jh/struct-zero-init-with-older-clang'

Work around older clang that warns against C99 zero initialization
syntax for struct.

* jh/struct-zero-init-with-older-clang:
  config.mak.dev: disable suggest braces error on old clang versions

2 years agoMerge branch 'rs/archive-dedup-printf'
Junio C Hamano [Wed, 19 Oct 2022 22:38:06 +0000 (15:38 -0700)] 
Merge branch 'rs/archive-dedup-printf'

Code simplification.

* rs/archive-dedup-printf:
  archive: deduplicate verbose printing

2 years agoMerge branch 'ab/coding-guidelines-c99'
Junio C Hamano [Wed, 19 Oct 2022 22:38:05 +0000 (15:38 -0700)] 
Merge branch 'ab/coding-guidelines-c99'

Update CodingGuidelines to clarify what features to use and avoid
in C99.

* ab/coding-guidelines-c99:
  CodingGuidelines: recommend against unportable C99 struct syntax
  CodingGuidelines: mention C99 features we can't use
  CodingGuidelines: allow declaring variables in for loops
  CodingGuidelines: mention dynamic C99 initializer elements
  CodingGuidelines: update for C99

2 years agofsmonitor OSX: compile with DC_SHA1=YesPlease
Ævar Arnfjörð Bjarmason [Wed, 19 Oct 2022 01:03:19 +0000 (03:03 +0200)] 
fsmonitor OSX: compile with DC_SHA1=YesPlease

As we'll address in subsequent commits the "DC_SHA1=YesPlease" is not
on by default on OSX, instead we use Apple Common Crypto's SHA-1
implementation.

In 6beb2688d33 (fsmonitor: relocate socket file if .git directory is
remote, 2022-10-04) the build was broken with "DC_SHA1=YesPlease" (and
probably other non-"APPLE_COMMON_CRYPTO" SHA-1 backends).

So let's extract the fix for this from [1] to get the build working
again with "DC_SHA1=YesPlease". In addition to the fix in [1] we also
need to replace "SHA_DIGEST_LENGTH" with "GIT_MAX_RAWSZ".

1. https://lore.kernel.org/git/c085fc15b314abcb5e5ca6b4ee5ac54a28327cab.1665326258.git.gitgitgadget@gmail.com/

Signed-off-by: Eric DeCosta <edecosta@mathworks.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: force -O0 when compiling with SANITIZE=leak
Jeff King [Tue, 18 Oct 2022 20:15:33 +0000 (16:15 -0400)] 
Makefile: force -O0 when compiling with SANITIZE=leak

Compiling with -O2 can interact badly with LSan's leak-checker, causing
false positives. Imagine a simplified example like:

  char *str = allocate_some_string();
  if (some_func(str) < 0)
          die("bad str");
  free(str);

The compiler may eliminate "str" as a stack variable, and just leave it
in a register. The register is preserved through most of the function,
including across the call to some_func(), since we'd eventually need to
free it. But because die() is marked with NORETURN, the compiler knows
that it doesn't need to save registers, and just clobbers it.

When die() eventually exits, the leak-checker runs. It looks in
registers and on the stack for any reference to the memory allocated by
str (which would indicate that it's not leaked), but can't find one.  So
it reports it as a leak.

Neither system is wrong, really. The C standard (mostly section 5.1.2.3)
defines an abstract machine, and compilers are allowed to modify the
program as long as the observable behavior of that abstract machine is
unchanged. Looking at random memory values on the stack is undefined
behavior, and not something that the optimizer needs to support. But
there really isn't any other way for a leak checker to work; it
inherently has to do undefined things like scouring memory for pointers.
So the two things are inherently at odds with each other. We can't fix
it by changing the code, because from the perspective of the program
running in an abstract machine, there is no leak.

This has caused real false positives in the past, like:

  - https://lore.kernel.org/git/patch-v3-5.6-9a44204c4c9-20211022T175227Z-avarab@gmail.com/

  - https://lore.kernel.org/git/Yy4eo6500C0ijhk+@coredump.intra.peff.net/

  - https://lore.kernel.org/git/Y07yeEQu+C7AH7oN@nand.local/

This patch makes those go away by forcing -O0 when compiling with LSan.
There are a few ways we could do this:

  - we could just teach the linux-leaks CI job to set -O0. That's the
    smallest change, and means we wouldn't get spurious CI failures. But
    it doesn't help people looking for leaks manually or in a specific
    test (and because the problem depends on the vagaries of the
    optimizer, investigating these can waste a lot of time in
    head-scratching as the problem comes and goes)

  - we default to -O2 in CFLAGS; we could pull this out to a separate
    variable ("-O$(O)" or something) and modify "O" when LSan is in use.
    This is the most flexible, in that you could still build with "make
    O=2 SANITIZE=leak" if you really wanted to (say, for experimenting).
    But it would also fail to kick in if the user defines their own
    CFLAGS variable, which again leads to head-scratching.

  - we can just stick -O0 into BASIC_CFLAGS when enabling LSan. Since
    this comes after the user-provided CFLAGS, it will override any
    previous -O setting found there. This is more foolproof, albeit less
    flexible. If you want to experiment with an optimized leak-checking
    build, you'll have to put "-O2 -fsanitize=leak" into CFLAGS
    manually, rather than using our SANITIZE=leak Makefile magic.

Since the final one is the least likely to break in normal use, this
patch uses that approach.

The resulting build is a little slower, of course, but since LSan is
already about 2x slower than a regular build, another 10% slowdown isn't
that big a deal.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoSync with v2.38.1
Junio C Hamano [Mon, 17 Oct 2022 22:46:09 +0000 (15:46 -0700)] 
Sync with v2.38.1

2 years agoThe third batch
Junio C Hamano [Mon, 17 Oct 2022 21:57:21 +0000 (14:57 -0700)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'pw/remove-rebase-p-test'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'pw/remove-rebase-p-test'

Remove outdated test.

* pw/remove-rebase-p-test:
  t3435: remove redundant test case

2 years agoMerge branch 'rj/branch-edit-desc-unborn'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'rj/branch-edit-desc-unborn'

"git branch --edit-description" on an unborh branch misleadingly
said that no such branch exists, which has been corrected.

* rj/branch-edit-desc-unborn:
  branch: description for non-existent branch errors

2 years agoMerge branch 'jt/promisor-remote-fetch-tweak'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'jt/promisor-remote-fetch-tweak'

Remove error detection from a function that fetches from promisor
remotes, and make it die when such a fetch fails to bring all the
requested objects, to give an early failure to various operations.

* jt/promisor-remote-fetch-tweak:
  promisor-remote: die upon failing fetch
  promisor-remote: remove a return value

2 years agoMerge branch 'rs/use-fspathncmp'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'rs/use-fspathncmp'

Code clean-up.

* rs/use-fspathncmp:
  dir: use fspathncmp() in pl_hashmap_cmp()

2 years agoMerge branch 'jc/use-of-uc-in-log-messages'
Junio C Hamano [Mon, 17 Oct 2022 21:56:35 +0000 (14:56 -0700)] 
Merge branch 'jc/use-of-uc-in-log-messages'

Clarify that "the sentence after <area>: prefix does not begin with
a capital letter" rule applies only to the commit title.

* jc/use-of-uc-in-log-messages:
  SubmittingPatches: use usual capitalization in the log message body

2 years agoMerge branch 'dd/document-runtime-prefix-better'
Junio C Hamano [Mon, 17 Oct 2022 21:56:34 +0000 (14:56 -0700)] 
Merge branch 'dd/document-runtime-prefix-better'

Update comment in the Makefile about the RUNTIME_PREFIX config knob.

* dd/document-runtime-prefix-better:
  Makefile: clarify runtime relative gitexecdir

2 years agoMerge branch 'ab/unused-annotation'
Junio C Hamano [Mon, 17 Oct 2022 21:56:34 +0000 (14:56 -0700)] 
Merge branch 'ab/unused-annotation'

Compilation fix for ancient compilers.

* ab/unused-annotation:
  git-compat-util.h: GCC deprecated message arg only in GCC 4.5+

2 years agoMerge branch 'jc/tmp-objdir'
Junio C Hamano [Mon, 17 Oct 2022 21:56:33 +0000 (14:56 -0700)] 
Merge branch 'jc/tmp-objdir'

The code to clean temporary object directories (used for
quarantine) tried to remove them inside its signal handler, which
was a no-no.

* jc/tmp-objdir:
  tmp-objdir: skip clean up when handling a signal

2 years agoMerge branch 'jc/branch-description-unset'
Junio C Hamano [Mon, 17 Oct 2022 21:56:33 +0000 (14:56 -0700)] 
Merge branch 'jc/branch-description-unset'

"GIT_EDITOR=: git branch --edit-description" resulted in failure,
which has been corrected.

* jc/branch-description-unset:
  branch: do not fail a no-op --edit-desc

2 years agoMerge branch 'jk/cleanup-callback-parameters'
Junio C Hamano [Mon, 17 Oct 2022 21:56:32 +0000 (14:56 -0700)] 
Merge branch 'jk/cleanup-callback-parameters'

Code clean-up.

* jk/cleanup-callback-parameters:
  attr: drop DEBUG_ATTR code
  commit: avoid writing to global in option callback
  multi-pack-index: avoid writing to global in option callback
  test-submodule: inline resolve_relative_url() function

2 years agoMerge branch 'rs/bisect-start-leakfix'
Junio C Hamano [Mon, 17 Oct 2022 21:56:32 +0000 (14:56 -0700)] 
Merge branch 'rs/bisect-start-leakfix'

Code clean-up that results in plugging a leak.

* rs/bisect-start-leakfix:
  bisect--helper: plug strvec leak

2 years agoMerge branch 'ed/fsmonitor-on-networked-macos'
Junio C Hamano [Mon, 17 Oct 2022 21:56:31 +0000 (14:56 -0700)] 
Merge branch 'ed/fsmonitor-on-networked-macos'

By default, use of fsmonitor on a repository on networked
filesystem is disabled. Add knobs to make it workable on macOS.

* ed/fsmonitor-on-networked-macos:
  fsmonitor: fix leak of warning message
  fsmonitor: add documentation for allowRemote and socketDir options
  fsmonitor: check for compatability before communicating with fsmonitor
  fsmonitor: deal with synthetic firmlinks on macOS
  fsmonitor: avoid socket location check if using hook
  fsmonitor: relocate socket file if .git directory is remote
  fsmonitor: refactor filesystem checks to common interface

2 years agoconfig: respect includes in protected config
Glen Choo [Thu, 13 Oct 2022 17:43:47 +0000 (17:43 +0000)] 
config: respect includes in protected config

Protected config is implemented by reading a fixed set of paths,
which ignores config [include]-s. Replace this implementation with a
call to config_with_options(), which handles [include]-s and saves us
from duplicating the logic of 1) identifying which paths to read and 2)
reading command line config.

As a result, git_configset_add_parameters() is unused, so remove it. It
was introduced alongside protected config in 5b3c650777 (config: learn
`git_protected_config()`, 2022-07-14) as a way to handle command line
config.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe second batch
Junio C Hamano [Tue, 11 Oct 2022 17:02:52 +0000 (10:02 -0700)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'rs/gc-pack-refs-simplify'
Junio C Hamano [Tue, 11 Oct 2022 17:36:12 +0000 (10:36 -0700)] 
Merge branch 'rs/gc-pack-refs-simplify'

Code clean-up.

* rs/gc-pack-refs-simplify:
  gc: simplify maintenance_task_pack_refs()

2 years agoMerge branch 'nb/doc-mergetool-typofix'
Junio C Hamano [Tue, 11 Oct 2022 17:36:12 +0000 (10:36 -0700)] 
Merge branch 'nb/doc-mergetool-typofix'

Typofix.

* nb/doc-mergetool-typofix:
  mergetool.txt: typofix 'overwriten' -> 'overwritten'

2 years agoMerge branch 'jk/sequencer-missing-author-name-check'
Junio C Hamano [Tue, 11 Oct 2022 17:36:12 +0000 (10:36 -0700)] 
Merge branch 'jk/sequencer-missing-author-name-check'

Typofix in code.

* jk/sequencer-missing-author-name-check:
  sequencer: detect author name errors in read_author_script()

2 years agoMerge branch 'pw/ssh-sign-report-errors'
Junio C Hamano [Tue, 11 Oct 2022 17:36:11 +0000 (10:36 -0700)] 
Merge branch 'pw/ssh-sign-report-errors'

The codepath to sign learned to report errors when it fails to read
from "ssh-keygen".

* pw/ssh-sign-report-errors:
  ssh signing: return an error when signature cannot be read

2 years agoMerge branch 'pw/mailinfo-b-fix'
Junio C Hamano [Tue, 11 Oct 2022 17:36:11 +0000 (10:36 -0700)] 
Merge branch 'pw/mailinfo-b-fix'

Fix a logic in "mailinfo -b" that miscomputed the length of a
substring, which lead to an out-of-bounds access.

* pw/mailinfo-b-fix:
  mailinfo -b: fix an out of bounds access

2 years agoMerge branch 'rs/test-httpd-in-C-locale'
Junio C Hamano [Tue, 11 Oct 2022 17:36:11 +0000 (10:36 -0700)] 
Merge branch 'rs/test-httpd-in-C-locale'

Force C locale while running tests around httpd to make sure we can
find expected error messages in the log.

* rs/test-httpd-in-C-locale:
  t/lib-httpd: pass LANG and LC_ALL to Apache

2 years agoMerge branch 'ds/bundle-uri-docfix'
Junio C Hamano [Tue, 11 Oct 2022 17:36:10 +0000 (10:36 -0700)] 
Merge branch 'ds/bundle-uri-docfix'

Doc formatting fix.

* ds/bundle-uri-docfix:
  bundle-uri: fix technical doc issues

2 years agoCodingGuidelines: recommend against unportable C99 struct syntax
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:38:00 +0000 (13:38 -0700)] 
CodingGuidelines: recommend against unportable C99 struct syntax

Per 33665d98e6b (reftable: make assignments portable to AIX xlc
v12.01, 2022-03-28) forms like ".a.b = *c" can be replaced by using
".a = { .b = *c }" instead.

We'll probably allow these sooner than later, but since the workaround
is trivial let's note it among the C99 features we'd like to hold off
on for now.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogrep.c: remove "extended" in favor of "pattern_expression", fix segfault
Ævar Arnfjörð Bjarmason [Tue, 11 Oct 2022 09:48:45 +0000 (11:48 +0200)] 
grep.c: remove "extended" in favor of "pattern_expression", fix segfault

Since 79d3696cfb4 (git-grep: boolean expression on pattern matching.,
2006-06-30) the "pattern_expression" member has been used for complex
queries (AND/OR...), with "pattern_list" being used for the simple OR
queries. Since then we've used both "pattern_expression" and its
associated boolean "extended" member to see if we have a complex
expression.

Since f41fb662f57 (revisions API: have release_revisions() release
"grep_filter", 2022-04-13) we've had a subtle bug relating to that: If
we supplied options that were only used for "complex queries", but
didn't supply the query itself we'd set "opt->extended", but would
have a NULL "pattern_expression". As a result these would segfault as
we tried to call "free_grep_patterns()" from "release_revisions()":

git -P log -1 --invert-grep
git -P log -1 --all-match

The root cause of this is that we were conflating the state management
we needed in "compile_grep_patterns()" itself with whether or not we
had an "opt->pattern_expression" later on.

In this cases as we're going through "compile_grep_patterns()" we have
no "opt->pattern_list" but have "opt->no_body_match" or
"opt->all_match". So we'd set "opt->extended = 1", but not "return" on
"opt->extended" as that's an "else if" in the same "if" statement.

That behavior is intentional and required, as the common case is that
we have an "opt->pattern_list" that we're about to parse into the
"opt->pattern_expression".

But we don't need to keep track of this "extended" flag beyond the
state management in compile_grep_patterns() itself. It needs it, but
once we're out of that function we can rely on
"opt->pattern_expression" being non-NULL instead for using these
extended patterns.

As 79d3696cfb4 itself shows we've assumed that there's a one-to-one
mapping between the two since the very beginning. I.e. "match_line()"
would check "opt->extended" to see if it should call "match_expr()",
and the first thing we do in that function is assume that we have a
"opt->pattern_expression". We'd then call "match_expr_eval()", which
would have died if that "opt->pattern_expression" was NULL.

The "die" was added in c922b01f54c (grep: fix segfault when "git grep
'('" is given, 2009-04-27), and can now be removed as it's now clearly
unreachable. We still do the right thing in the case that prompted
that fix:

git grep '('
fatal: unmatched parenthesis

Arguably neither the "--invert-grep" option added in [1] nor the
earlier "--all-match" option added in [2] were intended to be used
stand-alone, and another approach[3] would be to error out in those
cases. But since we've been treating them as a NOOP when given without
--grep for a long time let's keep doing that.

We could also return in "free_pattern_expr()" if the argument is
non-NULL, as an alternative fix for this segfault does [4]. That would
be more elegant in making the "free_*()" function behave like
"free()", but it would also remove a sanity check: The
"free_pattern_expr()" function calls itself recursively, and only the
top-level is allowed to be NULL, let's not conflate those two
conditions.

1. 22dfa8a23de (log: teach --invert-grep option, 2015-01-12)
2. 0ab7befa31d (grep --all-match, 2006-09-27)
3. https://lore.kernel.org/git/patch-1.1-f4b90799fce-20221010T165711Z-avarab@gmail.com/
4. http://lore.kernel.org/git/7e094882c2a71894416089f894557a9eae07e8f8.1665423686.git.me@ttaylorr.com

Reported-by: orygaw <orygaw@protonmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoarchive: deduplicate verbose printing
René Scharfe [Tue, 11 Oct 2022 09:29:38 +0000 (11:29 +0200)] 
archive: deduplicate verbose printing

94bc671a1f (Add directory pattern matching to attributes, 2012-12-08)
moved the code for adding the trailing slash to names of directories and
submodules up.  This left both branches of the if statement starting
with the same conditional fprintf call.  Deduplicate it.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofsmonitor: fix leak of warning message
Jeff King [Tue, 11 Oct 2022 00:42:38 +0000 (20:42 -0400)] 
fsmonitor: fix leak of warning message

The fsm_settings__get_incompatible_msg() function returns an allocated
string.  So we can't pass its result directly to warning(); we must hold
on to the pointer and free it to avoid a leak.

The leak here is small and fixed size, but Coverity complained, and
presumably SANITIZE=leaks would eventually.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobranch: support for shortcuts like @{-1}, completed
Rubén Justo [Mon, 10 Oct 2022 23:24:58 +0000 (01:24 +0200)] 
branch: support for shortcuts like @{-1}, completed

branch command with options "edit-description", "set-upstream-to" and
"unset-upstream" expects a branch name.  Since ae5a6c3684 (checkout:
implement "@{-N}" shortcut name for N-th last branch, 2009-01-17) a
branch can be specified using shortcuts like @{-1}.  Those shortcuts
need to be resolved when considering the arguments.

We can modify the description of the previously checked out branch with:

$ git branch --edit--description @{-1}

We can modify the upstream of the previously checked out branch with:

$ git branch --set-upstream-to upstream @{-1}
$ git branch --unset-upstream @{-1}

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoCodingGuidelines: mention C99 features we can't use
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:59 +0000 (13:37 -0700)] 
CodingGuidelines: mention C99 features we can't use

The C99 section of the CodingGuidelines is a good overview of what we
can use, but is sorely lacking in what we can't use. Something that
comes up occasionally is the portability of %z.

Per [1] we couldn't use it for the longest time due to MSVC not
supporting it, but nowadays by requiring C99 we rely on the MSVC
version that does, but we can't use it yet because a C library that
MinGW uses doesn't support it.

1. https://lore.kernel.org/git/a67e0fd8-4a14-16c9-9b57-3430440ef93c@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoCodingGuidelines: allow declaring variables in for loops
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:58 +0000 (13:37 -0700)] 
CodingGuidelines: allow declaring variables in for loops

Since 44ba10d6712 (revision: use C99 declaration of variable in for()
loop, 2021-11-14) released with v2.35.0 we've had a variable declared
with in a for loop.

Since then we've had inadvertent follow-ups to that with at least
cb2607759e2 (merge-ort: store more specific conflict information,
2022-06-18) released with v2.38.0.

As November 2022 is within the window of this upcoming release,
let's update the guideline to allow this.  We can have the promised
"revisit" discussion while this patch cooks, and drop it if it turns
out that it is still premature, which is not expected to happen at
this moment.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoCodingGuidelines: mention dynamic C99 initializer elements
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:57 +0000 (13:37 -0700)] 
CodingGuidelines: mention dynamic C99 initializer elements

The first use of variables in initializer elements appears to have
been 2b6854c863a (Cleanup variables in cat-file, 2007-04-21) released
with v1.5.2.

Some of those caused portability issues, and e.g. that "cat-file" use
was changed in 66dbfd55e38 (Rewrite dynamic structure initializations
to runtime assignment, 2010-05-14) which went out with v1.7.2.

But curiously 66dbfd55e38 missed some of them, e.g. an archive.c use
added in d5f53d6d6f2 (archive: complain about path specs that don't
match anything, 2009-12-12), and another one in merge-index.c (later
builtin/merge-index.c) in 0077138cd9d (Simplify some instances of
run_command() by using run_command_v_opt()., 2009-06-08).

As far as I can tell there's been no point since 2b6854c863a in 2007
where a compiler that didn't support this has been able to compile
git. Presumably 66dbfd55e38 was an attempt to make headway with wider
portability that ultimately wasn't completed.

In any case, we are thoroughly reliant on this syntax at this point,
so let's update the guidelines, see
https://lore.kernel.org/git/xmqqy1tunjgp.fsf@gitster.g/ for the
initial discussion.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoCodingGuidelines: update for C99
Ævar Arnfjörð Bjarmason [Mon, 10 Oct 2022 20:37:56 +0000 (13:37 -0700)] 
CodingGuidelines: update for C99

Since 7bc341e21b5 (git-compat-util: add a test balloon for C99
support, 2021-12-01) we've had a hard dependency on C99, but the prose
in CodingGuidelines was written under the assumption that we were
using C89 with a few C99 features.

As the updated prose notes we'd still like to hold off on novel C99
features, but let's make it clear that we target that C version, and
then enumerate new C99 features that are safe to use.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot3435: remove redundant test case
Phillip Wood [Mon, 10 Oct 2022 09:45:06 +0000 (09:45 +0000)] 
t3435: remove redundant test case

rebase --preserve-merges no longer exists so there is no point in
carrying this failing test case.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoconfig.mak.dev: disable suggest braces error on old clang versions
Jeff Hostetler [Mon, 10 Oct 2022 15:39:00 +0000 (15:39 +0000)] 
config.mak.dev: disable suggest braces error on old clang versions

Add the "-Wno-missing-braces" option when building with an old version
of clang to suppress the "suggest braces around initialization" error
in developer mode.

For example, using an old version of clang gives the following errors
(when in DEVELOPER=1 mode):

$ make builtin/merge-file.o
    CC builtin/merge-file.o
builtin/merge-file.c:29:23: error: suggest braces around initialization \
    of subobject [-Werror,-Wmissing-braces]
        mmfile_t mmfs[3] = { 0 };
                             ^
                             {}
builtin/merge-file.c:31:20: error: suggest braces around initialization \
    of subobject [-Werror,-Wmissing-braces]
        xmparam_t xmp = { 0 };
                          ^
                          {}
2 errors generated.

This example compiles without error/warning with updated versions of
clang.  Since this is an obsolete error, use the -Wno-missing-braces
option to silence the warning when using an older compiler.  This
avoids the need to update the code to use "{{0}}" style
initializations.

Upstream clang version 8 has the problem.  It was fixed in version 9.

The version of clang distributed by Apple with XCode has its own
unique set of version numbers.  Apple clang version 11 has the
problem.  It was fixed in version 12.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe (real) first batch for 2.39
Junio C Hamano [Mon, 10 Oct 2022 17:09:09 +0000 (10:09 -0700)] 
The (real) first batch for 2.39

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'js/merge-ort-in-read-only-repo'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'js/merge-ort-in-read-only-repo'

In read-only repositories, "git merge-tree" tried to come up with a
merge result tree object, which it failed (which is not wrong) and
led to a segfault (which is bad), which has been corrected.

* js/merge-ort-in-read-only-repo:
  merge-ort: return early when failing to write a blob
  merge-ort: fix segmentation fault in read-only repositories

2 years agoMerge branch 'tb/midx-repack-ignore-cruft-packs'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'tb/midx-repack-ignore-cruft-packs'

"git multi-pack-index repack/expire" used to repack unreachable
cruft into a new pack, which have been corrected.

* tb/midx-repack-ignore-cruft-packs:
  midx.c: avoid cruft packs with non-zero `repack --batch-size`
  midx.c: remove unnecessary loop condition
  midx.c: replace `xcalloc()` with `CALLOC_ARRAY()`
  midx.c: avoid cruft packs with `repack --batch-size=0`
  midx.c: prevent `expire` from removing the cruft pack
  Documentation/git-multi-pack-index.txt: clarify expire behavior
  Documentation/git-multi-pack-index.txt: fix typo

2 years agoMerge branch 'hn/parse-worktree-ref'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'hn/parse-worktree-ref'

Code and semantics cleaning.

* hn/parse-worktree-ref:
  refs: unify parse_worktree_ref() and ref_type()

2 years agoMerge branch 'ja/rebase-i-avoid-amending-self'
Junio C Hamano [Mon, 10 Oct 2022 17:08:43 +0000 (10:08 -0700)] 
Merge branch 'ja/rebase-i-avoid-amending-self'

"git rebase -i" can mistakenly attempt to apply a fixup to a commit
itself, which has been corrected.

* ja/rebase-i-avoid-amending-self:
  sequencer: avoid dropping fixup commit that targets self via commit-ish

2 years agoMerge branch 'rj/ref-filter-get-head-description-leakfix'
Junio C Hamano [Mon, 10 Oct 2022 17:08:42 +0000 (10:08 -0700)] 
Merge branch 'rj/ref-filter-get-head-description-leakfix'

Leakfix.

* rj/ref-filter-get-head-description-leakfix:
  ref-filter.c: fix a leak in get_head_description

2 years agoMerge branch 'jc/environ-docs'
Junio C Hamano [Mon, 10 Oct 2022 17:08:41 +0000 (10:08 -0700)] 
Merge branch 'jc/environ-docs'

Documentation on various Boolean GIT_* environment variables have
been clarified.

* jc/environ-docs:
  environ: GIT_INDEX_VERSION affects not just a new repository
  environ: simplify description of GIT_INDEX_FILE
  environ: GIT_FLUSH should be made a usual Boolean
  environ: explain Boolean environment variables
  environ: document GIT_SSL_NO_VERIFY

2 years agoMerge branch 'ah/branch-autosetupmerge-grammofix'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'ah/branch-autosetupmerge-grammofix'

Fix grammar of a message introduced in previous round.

* ah/branch-autosetupmerge-grammofix:
  push: improve grammar of branch.autoSetupMerge advice

2 years agoMerge branch 'ab/test-malloc-with-sanitize-leak'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'ab/test-malloc-with-sanitize-leak'

Test fix.

* ab/test-malloc-with-sanitize-leak:
  test-lib: have SANITIZE=leak imply TEST_NO_MALLOC_CHECK

2 years agoMerge branch 'sy/sparse-grep'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'sy/sparse-grep'

"git grep" learned to expand the sparse-index more lazily and on
demand in a sparse checkout.

* sy/sparse-grep:
  builtin/grep.c: integrate with sparse index

2 years agoMerge branch 'ds/scalar-unregister-idempotent'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'ds/scalar-unregister-idempotent'

"scalar unregister" in a repository that is already been
unregistered reported an error.

* ds/scalar-unregister-idempotent:
  string-list: document iterator behavior on NULL input
  gc: replace config subprocesses with API calls
  scalar: make 'unregister' idempotent
  maintenance: add 'unregister --force'

2 years agoMerge branch 'mc/cred-helper-ignore-unknown'
Junio C Hamano [Mon, 10 Oct 2022 17:08:40 +0000 (10:08 -0700)] 
Merge branch 'mc/cred-helper-ignore-unknown'

Most credential helpers ignored unknown entries in a credential
description, but a few died upon seeing them.  The latter were
taught to ignore them, too

* mc/cred-helper-ignore-unknown:
  osxkeychain: clarify that we ignore unknown lines
  netrc: ignore unknown lines (do not die)
  wincred: ignore unknown lines (do not die)

2 years agoMerge branch 'jk/remote-rename-without-fetch-refspec'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'jk/remote-rename-without-fetch-refspec'

"git remote rename" failed to rename a remote without fetch
refspec, which has been corrected.

* jk/remote-rename-without-fetch-refspec:
  remote: handle rename of remote without fetch refspec

2 years agoMerge branch 'jk/clone-allow-bare-and-o-together'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'jk/clone-allow-bare-and-o-together'

"git clone" did not like to see the "--bare" and the "--origin"
options used together without a good reason.

* jk/clone-allow-bare-and-o-together:
  clone: allow "--bare" with "-o"

2 years agoMerge branch 'jk/fsck-on-diet'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'jk/fsck-on-diet'

"git fsck" failed to release contents of tree objects already used
from the memory, which has been fixed.

* jk/fsck-on-diet:
  parse_object_buffer(): respect save_commit_buffer
  fsck: turn off save_commit_buffer
  fsck: free tree buffers after walking unreachable objects

2 years agoMerge branch 'so/diff-merges-cleanup'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'so/diff-merges-cleanup'

Code clean-up.

* so/diff-merges-cleanup:
  diff-merges: clarify log.diffMerges documentation
  diff-merges: cleanup set_diff_merges()
  diff-merges: cleanup func_by_opt()

2 years agoMerge branch 'ah/fsmonitor-daemon-usage-non-l10n'
Junio C Hamano [Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)] 
Merge branch 'ah/fsmonitor-daemon-usage-non-l10n'

Fix messages incorrectly marked for translation.

* ah/fsmonitor-daemon-usage-non-l10n:
  fsmonitor--daemon: don't translate literal commands