]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 months agoMerge branch 'bc/merge-file-object-input'
Junio C Hamano [Wed, 8 Nov 2023 02:04:01 +0000 (11:04 +0900)] 
Merge branch 'bc/merge-file-object-input'

"git merge-file" learns a mode to read three contents to be merged
from blob objects.

* bc/merge-file-object-input:
  merge-file: add an option to process object IDs
  git-merge-file doc: drop "-file" from argument placeholders

6 months agoMerge branch 'kn/rev-list-missing-fix'
Junio C Hamano [Wed, 8 Nov 2023 02:04:01 +0000 (11:04 +0900)] 
Merge branch 'kn/rev-list-missing-fix'

"git rev-list --missing" did not work for missing commit objects,
which has been corrected.

* kn/rev-list-missing-fix:
  rev-list: add commit object support in `--missing` option
  rev-list: move `show_commit()` to the bottom
  revision: rename bit to `do_not_die_on_missing_objects`

6 months agoMerge branch 'an/clang-format-typofix'
Junio C Hamano [Wed, 8 Nov 2023 02:04:00 +0000 (11:04 +0900)] 
Merge branch 'an/clang-format-typofix'

Typofix.

* an/clang-format-typofix:
  clang-format: fix typo in comment

6 months agoMerge branch 'tb/format-pack-doc-update'
Junio C Hamano [Wed, 8 Nov 2023 02:04:00 +0000 (11:04 +0900)] 
Merge branch 'tb/format-pack-doc-update'

Doc update.

* tb/format-pack-doc-update:
  Documentation/gitformat-pack.txt: fix incorrect MIDX documentation
  Documentation/gitformat-pack.txt: fix typo

6 months agoMerge branch 'ps/show-ref'
Junio C Hamano [Wed, 8 Nov 2023 02:03:59 +0000 (11:03 +0900)] 
Merge branch 'ps/show-ref'

Teach "git show-ref" a mode to check the existence of a ref.

* ps/show-ref:
  t: use git-show-ref(1) to check for ref existence
  builtin/show-ref: add new mode to check for reference existence
  builtin/show-ref: explicitly spell out different modes in synopsis
  builtin/show-ref: ensure mutual exclusiveness of subcommands
  builtin/show-ref: refactor options for patterns subcommand
  builtin/show-ref: stop using global vars for `show_one()`
  builtin/show-ref: stop using global variable to count matches
  builtin/show-ref: refactor `--exclude-existing` options
  builtin/show-ref: fix dead code when passing patterns
  builtin/show-ref: fix leaking string buffer
  builtin/show-ref: split up different subcommands
  builtin/show-ref: convert pattern to a local variable

6 months agoMerge branch 'ps/do-not-trust-commit-graph-blindly-for-existence'
Junio C Hamano [Wed, 8 Nov 2023 02:03:59 +0000 (11:03 +0900)] 
Merge branch 'ps/do-not-trust-commit-graph-blindly-for-existence'

The codepath to traverse the commit-graph learned to notice that a
commit is missing (e.g., corrupt repository lost an object), even
though it knows something about the commit (like its parents) from
what is in commit-graph.

* ps/do-not-trust-commit-graph-blindly-for-existence:
  commit: detect commits that exist in commit-graph but not in the ODB
  commit-graph: introduce envvar to disable commit existence checks

6 months agoMerge branch 'js/ci-use-macos-13'
Junio C Hamano [Wed, 8 Nov 2023 02:03:59 +0000 (11:03 +0900)] 
Merge branch 'js/ci-use-macos-13'

Replace macos-12 used at GitHub CI with macos-13.

* js/ci-use-macos-13:
  ci: upgrade to using macos-13

6 months agoMerge branch 'jk/chunk-bounds'
Junio C Hamano [Wed, 8 Nov 2023 02:03:58 +0000 (11:03 +0900)] 
Merge branch 'jk/chunk-bounds'

Test portability fix.

* jk/chunk-bounds:
  t: avoid perl's pack/unpack "Q" specifier

6 months agoMerge branch 'jk/tree-name-and-depth-limit'
Junio C Hamano [Wed, 8 Nov 2023 02:03:58 +0000 (11:03 +0900)] 
Merge branch 'jk/tree-name-and-depth-limit'

Further limit tree depth max to avoid Windows build running out of
the stack space.

* jk/tree-name-and-depth-limit:
  max_tree_depth: lower it for MSVC to avoid stack overflows

6 months agoRelNotes: improve wording of credential helper notes
Todd Zullinger [Fri, 3 Nov 2023 14:17:51 +0000 (10:17 -0400)] 
RelNotes: improve wording of credential helper notes

Offer a slightly more verbose description of the issue fixed by
7144dee3ec (credential/libsecret: erase matching creds only, 2023-07-26)
and cb626f8e5c (credential/wincred: erase matching creds only,
2023-07-26).

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 months agoRelNotes: minor typo fixes in 2.43.0 draft
Todd Zullinger [Fri, 3 Nov 2023 14:17:50 +0000 (10:17 -0400)] 
RelNotes: minor typo fixes in 2.43.0 draft

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 months agoA bit more before -rc1
Junio C Hamano [Tue, 7 Nov 2023 00:38:26 +0000 (09:38 +0900)] 
A bit more before -rc1

6 months agoMerge branch 'rc/trace-upload-pack'
Junio C Hamano [Tue, 7 Nov 2023 01:26:45 +0000 (10:26 +0900)] 
Merge branch 'rc/trace-upload-pack'

Trace2 update.

* rc/trace-upload-pack:
  upload-pack: add tracing for fetches

6 months agoMerge branch 'es/bugreport-no-extra-arg'
Junio C Hamano [Tue, 7 Nov 2023 01:26:44 +0000 (10:26 +0900)] 
Merge branch 'es/bugreport-no-extra-arg'

"git bugreport" learned to complain when it received a command line
argument that it will not use.

* es/bugreport-no-extra-arg:
  bugreport: reject positional arguments
  t0091-bugreport: stop using i18ngrep

6 months agoMerge branch 'js/my-first-contribution-update'
Junio C Hamano [Tue, 7 Nov 2023 01:26:44 +0000 (10:26 +0900)] 
Merge branch 'js/my-first-contribution-update'

Documentation update.

* js/my-first-contribution-update:
  Include gettext.h in MyFirstContribution tutorial

6 months agoMerge branch 'ms/send-email-validate-fix'
Junio C Hamano [Tue, 7 Nov 2023 01:26:44 +0000 (10:26 +0900)] 
Merge branch 'ms/send-email-validate-fix'

"git send-email" did not have certain pieces of data computed yet
when it tried to validate the outging messages and its recipient
addresses, which has been sorted out.

* ms/send-email-validate-fix:
  send-email: move validation code below process_address_list

6 months agoMerge branch 'rs/reflog-expire-single-worktree-fix'
Junio C Hamano [Tue, 7 Nov 2023 01:26:43 +0000 (10:26 +0900)] 
Merge branch 'rs/reflog-expire-single-worktree-fix'

"git reflog expire --single-worktree" has been broken for the past
20 months or so, which has been corrected.

* rs/reflog-expire-single-worktree-fix:
  reflog: fix expire --single-worktree

6 months agoMerge branch 'rs/fix-arghelp'
Junio C Hamano [Tue, 7 Nov 2023 01:26:43 +0000 (10:26 +0900)] 
Merge branch 'rs/fix-arghelp'

Doc and help update.

* rs/fix-arghelp:
  am, rebase: fix arghelp syntax of --empty

6 months agoMerge branch 'rs/parse-options-cmdmode'
Junio C Hamano [Tue, 7 Nov 2023 01:26:43 +0000 (10:26 +0900)] 
Merge branch 'rs/parse-options-cmdmode'

parse-options improvements for OPT_CMDMODE options.

* rs/parse-options-cmdmode:
  am: simplify --show-current-patch handling
  parse-options: make CMDMODE errors more precise

6 months agoMerge branch 'jc/grep-f-relative-to-cwd'
Junio C Hamano [Tue, 7 Nov 2023 01:26:43 +0000 (10:26 +0900)] 
Merge branch 'jc/grep-f-relative-to-cwd'

"cd sub && git grep -f patterns" tried to read "patterns" file at
the top level of the working tree; it has been corrected to read
"sub/patterns" instead.

* jc/grep-f-relative-to-cwd:
  grep: -f <path> is relative to $cwd

6 months agoMerge branch 'ar/submitting-patches-doc-update'
Junio C Hamano [Tue, 7 Nov 2023 01:26:42 +0000 (10:26 +0900)] 
Merge branch 'ar/submitting-patches-doc-update'

Doc update.

* ar/submitting-patches-doc-update:
  SubmittingPatches: call gitk's command "Copy commit reference"

6 months agot: avoid perl's pack/unpack "Q" specifier
Jeff King [Fri, 3 Nov 2023 16:20:19 +0000 (12:20 -0400)] 
t: avoid perl's pack/unpack "Q" specifier

The perl script introduced by 86b008ee61 (t: add library for munging
chunk-format files, 2023-10-09) uses pack("Q") and unpack("Q") to read
and write 64-bit values ("quadwords" in perl parlance) from the on-disk
chunk files. However, some builds of perl may not support 64-bit
integers at all, and throw an exception here. While some 32-bit
platforms may still support 64-bit integers in perl (such as our linux32
CI environment), others reportedly don't (the NonStop 32-bit builds).

We can work around this by treating the 64-bit values as two 32-bit
values. We can't ever combine them into a single 64-bit value, but in
practice this is OK. These are representing file offsets, and our files
are much smaller than 4GB. So the upper half of the 64-bit value will
always be 0.

We can just introduce a few helper functions which perform the
translation and double-check our assumptions.

Reported-by: Randall S. Becker <randall.becker@nexbridge.ca>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoci: upgrade to using macos-13
Johannes Schindelin [Fri, 3 Nov 2023 07:27:35 +0000 (07:27 +0000)] 
ci: upgrade to using macos-13

In April, GitHub announced that the `macos-13` pool is available:
https://github.blog/changelog/2023-04-24-github-actions-macos-13-is-now-available/.
It is only a matter of time until the `macos-12` pool is going away,
therefore we should switch now, without pressure of a looming deadline.

Since the `macos-13` runners no longer include Python2, we also drop
specifically testing with Python2 and switch uniformly to Python3, see
https://github.com/actions/runner-images/blob/HEAD/images/macos/macos-13-Readme.md
for details about the software available on the `macos-13` pool's
runners.

Also, on macOS 13, Homebrew seems to install a `gcc@9` package that no
longer comes with a regular `unistd.h` (there seems only to be a
`ssp/unistd.h`), and hence builds would fail with:

    In file included from base85.c:1:
    git-compat-util.h:223:10: fatal error: unistd.h: No such file or directory
      223 | #include <unistd.h>
          |          ^~~~~~~~~~
    compilation terminated.

The reason why we install GCC v9.x explicitly is historical, and back in
the days it was because it was the _newest_ version available via
Homebrew: 176441bfb58 (ci: build Git with GCC 9 in the 'osx-gcc' build
job, 2019-11-27).

To reinstate the spirit of that commit _and_ to fix that build failure,
let's switch to the now-newest GCC version: v13.x.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoGit 2.43-rc0 v2.43.0-rc0
Junio C Hamano [Thu, 2 Nov 2023 08:09:48 +0000 (17:09 +0900)] 
Git 2.43-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoGit 2.42.1 v2.42.1
Junio C Hamano [Thu, 2 Nov 2023 07:38:18 +0000 (16:38 +0900)] 
Git 2.42.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoMerge branch 'ms/doc-push-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:28 +0000 (16:53 +0900)] 
Merge branch 'ms/doc-push-fix' into maint-2.42

Docfix.

* ms/doc-push-fix:
  git-push doc: more visibility for -q option

7 months agoMerge branch 'jc/commit-new-underscore-index-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:28 +0000 (16:53 +0900)] 
Merge branch 'jc/commit-new-underscore-index-fix' into maint-2.42

Message fix.

* jc/commit-new-underscore-index-fix:
  commit: do not use cryptic "new_index" in end-user facing messages

7 months agoMerge branch 'wx/merge-ort-comment-typofix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:27 +0000 (16:53 +0900)] 
Merge branch 'wx/merge-ort-comment-typofix' into maint-2.42

Typofix.

* wx/merge-ort-comment-typofix:
  merge-ort.c: fix typo 'neeed' to 'needed'

7 months agoMerge branch 'ps/git-repack-doc-fixes' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:27 +0000 (16:53 +0900)] 
Merge branch 'ps/git-repack-doc-fixes' into maint-2.42

Doc updates.

* ps/git-repack-doc-fixes:
  doc/git-repack: don't mention nonexistent "--unpacked" option
  doc/git-repack: fix syntax for `-g` shorthand option

7 months agoMerge branch 'ni/die-message-fix-for-git-add' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:27 +0000 (16:53 +0900)] 
Merge branch 'ni/die-message-fix-for-git-add' into maint-2.42

Message updates.

* ni/die-message-fix-for-git-add:
  builtin/add.c: clean up die() messages

7 months agoMerge branch 'jc/am-doc-whitespace-action-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:27 +0000 (16:53 +0900)] 
Merge branch 'jc/am-doc-whitespace-action-fix' into maint-2.42

Docfix.

* jc/am-doc-whitespace-action-fix:
  am: align placeholder for --whitespace option with apply

7 months agoMerge branch 'jc/update-list-references-to-lore' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:26 +0000 (16:53 +0900)] 
Merge branch 'jc/update-list-references-to-lore' into maint-2.42

Doc update.

* jc/update-list-references-to-lore:
  doc: update list archive reference to use lore.kernel.org

7 months agoMerge branch 'ps/rewritten-is-per-worktree-doc' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:26 +0000 (16:53 +0900)] 
Merge branch 'ps/rewritten-is-per-worktree-doc' into maint-2.42

Doc update.

* ps/rewritten-is-per-worktree-doc:
  doc/git-worktree: mention "refs/rewritten" as per-worktree refs

7 months agoMerge branch 'sn/cat-file-doc-update' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:26 +0000 (16:53 +0900)] 
Merge branch 'sn/cat-file-doc-update' into maint-2.42

"git cat-file" documentation updates.

* sn/cat-file-doc-update:
  doc/cat-file: make synopsis and description less confusing

7 months agoMerge branch 'jk/decoration-and-other-leak-fixes' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:26 +0000 (16:53 +0900)] 
Merge branch 'jk/decoration-and-other-leak-fixes' into maint-2.42

Leakfix.

* jk/decoration-and-other-leak-fixes:
  daemon: free listen_addr before returning
  revision: clear decoration structs during release_revisions()
  decorate: add clear_decoration() function

7 months agoMerge branch 'rs/parse-opt-ctx-cleanup' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:26 +0000 (16:53 +0900)] 
Merge branch 'rs/parse-opt-ctx-cleanup' into maint-2.42

Code clean-up.

* rs/parse-opt-ctx-cleanup:
  parse-options: drop unused parse_opt_ctx_t member

7 months agoMerge branch 'ob/am-msgfix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:25 +0000 (16:53 +0900)] 
Merge branch 'ob/am-msgfix' into maint-2.42

The parameters to generate an error message have been corrected.

* ob/am-msgfix:
  am: fix error message in parse_opt_show_current_patch()

7 months agoMerge branch 'hy/doc-show-is-like-log-not-diff-tree' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:25 +0000 (16:53 +0900)] 
Merge branch 'hy/doc-show-is-like-log-not-diff-tree' into maint-2.42

Doc update.

* hy/doc-show-is-like-log-not-diff-tree:
  show doc: redirect user to git log manual instead of git diff-tree

7 months agoMerge branch 'ch/clean-docfix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:25 +0000 (16:53 +0900)] 
Merge branch 'ch/clean-docfix' into maint-2.42

Typofix.

* ch/clean-docfix:
  git-clean doc: fix "without do cleaning" typo

7 months agoMerge branch 'eg/config-type-path-docfix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:24 +0000 (16:53 +0900)] 
Merge branch 'eg/config-type-path-docfix' into maint-2.42

Typofix.

* eg/config-type-path-docfix:
  git-config: fix misworded --type=path explanation

7 months agoMerge branch 'ob/t3404-typofix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:24 +0000 (16:53 +0900)] 
Merge branch 'ob/t3404-typofix' into maint-2.42

Code clean-up.

* ob/t3404-typofix:
  t3404-rebase-interactive.sh: fix typos in title of a rewording test

7 months agoMerge branch 'ob/sequencer-remove-dead-code' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:24 +0000 (16:53 +0900)] 
Merge branch 'ob/sequencer-remove-dead-code' into maint-2.42

Code clean-up.

* ob/sequencer-remove-dead-code:
  sequencer: remove unreachable exit condition in pick_commits()

7 months agoMerge branch 'rs/name-rev-use-opt-hidden-bool' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:24 +0000 (16:53 +0900)] 
Merge branch 'rs/name-rev-use-opt-hidden-bool' into maint-2.42

Simplify use of parse-options API a bit.

* rs/name-rev-use-opt-hidden-bool:
  name-rev: use OPT_HIDDEN_BOOL for --peel-tag

7 months agoMerge branch 'rs/grep-parseopt-simplify' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:23 +0000 (16:53 +0900)] 
Merge branch 'rs/grep-parseopt-simplify' into maint-2.42

Simplify use of parse-options API a bit.

* rs/grep-parseopt-simplify:
  grep: use OPT_INTEGER_F for --max-depth

7 months agoMerge branch 'ob/sequencer-reword-error-message' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:23 +0000 (16:53 +0900)] 
Merge branch 'ob/sequencer-reword-error-message' into maint-2.42

Update an error message (which would probably never been seen).

* ob/sequencer-reword-error-message:
  sequencer: fix error message on failure to copy SQUASH_MSG

7 months agoMerge branch 'bc/more-git-var' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:23 +0000 (16:53 +0900)] 
Merge branch 'bc/more-git-var' into maint-2.42

Fix-up for a topic that already has graduated.

* bc/more-git-var:
  var: avoid a segmentation fault when `HOME` is unset

7 months agoMerge branch 'jk/ci-retire-allow-ref' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:22 +0000 (16:53 +0900)] 
Merge branch 'jk/ci-retire-allow-ref' into maint-2.42

CI update.

* jk/ci-retire-allow-ref:
  ci: deprecate ci/config/allow-ref script
  ci: allow branch selection through "vars"

7 months agoMerge branch 'ws/git-svn-retire-faketerm' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:22 +0000 (16:53 +0900)] 
Merge branch 'ws/git-svn-retire-faketerm' into maint-2.42

Code clean-up.

* ws/git-svn-retire-faketerm:
  git-svn: drop FakeTerm hack

7 months agoMerge branch 'ch/t6300-verify-commit-test-cleanup' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:22 +0000 (16:53 +0900)] 
Merge branch 'ch/t6300-verify-commit-test-cleanup' into maint-2.42

Test clean-up.

* ch/t6300-verify-commit-test-cleanup:
  t/t6300: drop magic filtering
  t/lib-gpg: forcibly run a trustdb update

7 months agoMerge branch 'jc/mv-d-to-d-error-message-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:22 +0000 (16:53 +0900)] 
Merge branch 'jc/mv-d-to-d-error-message-fix' into maint-2.42

Typofix in an error message.

* jc/mv-d-to-d-error-message-fix:
  mv: fix error for moving directory to another

7 months agoMerge branch 'ja/worktree-orphan' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:21 +0000 (16:53 +0900)] 
Merge branch 'ja/worktree-orphan' into maint-2.42

Typofix in an error message.

* ja/worktree-orphan:
  builtin/worktree.c: fix typo in "forgot fetch" msg

7 months agoMerge branch 'ob/t9001-indent-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:21 +0000 (16:53 +0900)] 
Merge branch 'ob/t9001-indent-fix' into maint-2.42

Test style fix.

* ob/t9001-indent-fix:
  t9001: fix indentation in test_no_confirm()

7 months agoMerge branch 'jk/function-pointer-mismatches-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:20 +0000 (16:53 +0900)] 
Merge branch 'jk/function-pointer-mismatches-fix' into maint-2.42

Code clean-up to please clang-18.

* jk/function-pointer-mismatches-fix:
  hashmap: use expected signatures for comparison functions

7 months agoMerge branch 'ds/upload-pack-error-sequence-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:20 +0000 (16:53 +0900)] 
Merge branch 'ds/upload-pack-error-sequence-fix' into maint-2.42

Error message generation fix.

* ds/upload-pack-error-sequence-fix:
  upload-pack: fix exit code when denying fetch of unreachable object ID
  upload-pack: fix race condition in error messages

7 months agoMerge branch 'ws/git-push-doc-grammofix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:20 +0000 (16:53 +0900)] 
Merge branch 'ws/git-push-doc-grammofix' into maint-2.42

Doc update.

* ws/git-push-doc-grammofix:
  git-push.txt: fix grammar

7 months agoMerge branch 'jk/test-pass-ubsan-options-to-http-test' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:20 +0000 (16:53 +0900)] 
Merge branch 'jk/test-pass-ubsan-options-to-http-test' into maint-2.42

UBSAN options were not propagated through the test framework to git
run via the httpd, unlike ASAN options, which has been corrected.

* jk/test-pass-ubsan-options-to-http-test:
  test-lib: set UBSAN_OPTIONS to match ASan

7 months agoMerge branch 'tb/send-email-extract-valid-address-error-message-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:19 +0000 (16:53 +0900)] 
Merge branch 'tb/send-email-extract-valid-address-error-message-fix' into maint-2.42

An error message given by "git send-email" when given a malformed
address did not give correct information, which has been corrected.

* tb/send-email-extract-valid-address-error-message-fix:
  git-send-email.perl: avoid printing undef when validating addresses

7 months agoMerge branch 'jk/redact-h2h3-headers-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:19 +0000 (16:53 +0900)] 
Merge branch 'jk/redact-h2h3-headers-fix' into maint-2.42

HTTP Header redaction code has been adjusted for a newer version of
cURL library that shows its traces differently from earlier
versions.

* jk/redact-h2h3-headers-fix:
  http: update curl http/2 info matching for curl 8.3.0
  http: factor out matching of curl http/2 trace lines

7 months agoMerge branch 'pb/completion-aliases-doc' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:19 +0000 (16:53 +0900)] 
Merge branch 'pb/completion-aliases-doc' into maint-2.42

Clarify how "alias.foo = : git cmd ; aliased-command-string" should
be spelled with necessary whitespaces around punctuation marks to
work.

* pb/completion-aliases-doc:
  completion: improve doc for complex aliases

7 months agoMerge branch 'js/diff-cached-fsmonitor-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:19 +0000 (16:53 +0900)] 
Merge branch 'js/diff-cached-fsmonitor-fix' into maint-2.42

"git diff --cached" codepath did not fill the necessary stat
information for a file when fsmonitor knows it is clean and ended
up behaving as if it is not clean, which has been corrected.

* js/diff-cached-fsmonitor-fix:
  diff-lib: fix check_removed when fsmonitor is on

7 months agoMerge branch 'js/systemd-timers-wsl-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:18 +0000 (16:53 +0900)] 
Merge branch 'js/systemd-timers-wsl-fix' into maint-2.42

Update "git maintainance" timers' implementation based on systemd
timers to work with WSL.

* js/systemd-timers-wsl-fix:
  maintenance(systemd): support the Windows Subsystem for Linux

7 months agoMerge branch 'pw/diff-no-index-from-named-pipes' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:18 +0000 (16:53 +0900)] 
Merge branch 'pw/diff-no-index-from-named-pipes' into maint-2.42

"git diff --no-index -R <(one) <(two)" did not work correctly,
which has been corrected.

* pw/diff-no-index-from-named-pipes:
  diff --no-index: fix -R with stdin

7 months agoMerge branch 'js/complete-checkout-t' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:18 +0000 (16:53 +0900)] 
Merge branch 'js/complete-checkout-t' into maint-2.42

The completion script (in contrib/) has been taught to treat the
"-t" option to "git checkout" and "git switch" just like the
"--track" option, to complete remote-tracking branches.

* js/complete-checkout-t:
  completion(switch/checkout): treat --track and -t the same

7 months agoMerge branch 'rs/grep-no-no-or' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:17 +0000 (16:53 +0900)] 
Merge branch 'rs/grep-no-no-or' into maint-2.42

"git grep -e A --no-or -e B" is accepted, even though the negation
of "or" did not mean anything, which has been tightened.

* rs/grep-no-no-or:
  grep: reject --no-or

7 months agoMerge branch 'so/diff-doc-for-patch-update' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:17 +0000 (16:53 +0900)] 
Merge branch 'so/diff-doc-for-patch-update' into maint-2.42

References from description of the `--patch` option in various
manual pages have been simplified and improved.

* so/diff-doc-for-patch-update:
  doc/diff-options: fix link to generating patch section

7 months agoMerge branch 'pw/rebase-i-after-failure' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:17 +0000 (16:53 +0900)] 
Merge branch 'pw/rebase-i-after-failure' into maint-2.42

Various fixes to the behaviour of "rebase -i" when the command got
interrupted by conflicting changes.
cf. <6b927687-cf6e-d73e-78fb-bd4f46736928@gmx.de>

* pw/rebase-i-after-failure:
  rebase -i: fix adding failed command to the todo list
  rebase --continue: refuse to commit after failed command
  rebase: fix rewritten list for failed pick
  sequencer: factor out part of pick_commits()
  sequencer: use rebase_path_message()
  rebase -i: remove patch file after conflict resolution
  rebase -i: move unlink() calls

7 months agoMerge branch 'ks/ref-filter-sort-numerically' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:16 +0000 (16:53 +0900)] 
Merge branch 'ks/ref-filter-sort-numerically' into maint-2.42

"git for-each-ref --sort='contents:size'" sorts the refs according
to size numerically, giving a ref that points at a blob twelve-byte
(12) long before showing a blob hundred-byte (100) long.

* ks/ref-filter-sort-numerically:
  ref-filter: sort numerically when ":size" is used

7 months agoMerge branch 'jk/diff-result-code-cleanup' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:16 +0000 (16:53 +0900)] 
Merge branch 'jk/diff-result-code-cleanup' into maint-2.42

"git diff --no-such-option" and other corner cases around the exit
status of the "diff" command has been corrected.

* jk/diff-result-code-cleanup:
  diff: drop useless "status" parameter from diff_result_code()
  diff: drop useless return values in git-diff helpers
  diff: drop useless return from run_diff_{files,index} functions
  diff: die when failing to read index in git-diff builtin
  diff: show usage for unknown builtin_diff_files() options
  diff-files: avoid negative exit value
  diff: spell DIFF_INDEX_CACHED out when calling run_diff_index()

7 months agoMerge branch 'ob/sequencer-empty-hint-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:16 +0000 (16:53 +0900)] 
Merge branch 'ob/sequencer-empty-hint-fix' into maint-2.42

The use of API between two calls to require_clean_work_tree() from
the sequencer code has been cleaned up for consistency.

* ob/sequencer-empty-hint-fix:
  sequencer: rectify empty hint in call of require_clean_work_tree()

7 months agoMerge branch 'ts/unpacklimit-config-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:16 +0000 (16:53 +0900)] 
Merge branch 'ts/unpacklimit-config-fix' into maint-2.42

transfer.unpackLimit ought to be used as a fallback, but overrode
fetch.unpackLimit and receive.unpackLimit instead.

* ts/unpacklimit-config-fix:
  transfer.unpackLimit: fetch/receive.unpackLimit takes precedence

7 months agoMerge branch 'jc/diff-exit-code-with-w-fixes' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:15 +0000 (16:53 +0900)] 
Merge branch 'jc/diff-exit-code-with-w-fixes' into maint-2.42

"git diff -w --exit-code" with various options did not work
correctly, which is being addressed.

* jc/diff-exit-code-with-w-fixes:
  diff: the -w option breaks --exit-code for --raw and other output modes
  t4040: remove test that succeeded for a wrong reason
  diff: teach "--stat -w --exit-code" to notice differences
  diff: mode-only change should be noticed by "--patch -w --exit-code"
  diff: move the fallback "--exit-code" code down

7 months agoMerge branch 'tb/commit-graph-verify-fix' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:15 +0000 (16:53 +0900)] 
Merge branch 'tb/commit-graph-verify-fix' into maint-2.42

The commit-graph verification code that detects mixture of zero and
non-zero generation numbers has been updated.

* tb/commit-graph-verify-fix:
  commit-graph: avoid repeated mixed generation number warnings
  t/t5318-commit-graph.sh: test generation zero transitions during fsck
  commit-graph: verify swapped zero/non-zero generation cases
  commit-graph: introduce `commit_graph_generation_from_graph()`

7 months agoMerge branch 'jc/ci-skip-same-commit' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:15 +0000 (16:53 +0900)] 
Merge branch 'jc/ci-skip-same-commit' into maint-2.42

Tweak GitHub Actions CI so that pushing the same commit to multiple
branch tips at the same time will not waste building and testing
the same thing twice.

* jc/ci-skip-same-commit:
  ci: avoid building from the same commit in parallel

7 months agoMerge branch 'ds/scalar-updates' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:14 +0000 (16:53 +0900)] 
Merge branch 'ds/scalar-updates' into maint-2.42

Scalar updates.

* ds/scalar-updates:
  scalar reconfigure: help users remove buggy repos
  setup: add discover_git_directory_reason()
  scalar: add --[no-]src option

7 months agoMerge branch 'mp/rebase-label-length-limit' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:14 +0000 (16:53 +0900)] 
Merge branch 'mp/rebase-label-length-limit' into maint-2.42

Overly long label names used in the sequencer machinery are now
chopped to fit under filesystem limitation.

* mp/rebase-label-length-limit:
  rebase: allow overriding the maximal length of the generated labels
  sequencer: truncate labels to accommodate loose refs

7 months agoMerge branch 'js/ci-coverity' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:14 +0000 (16:53 +0900)] 
Merge branch 'js/ci-coverity' into maint-2.42

GitHub CI workflow has learned to trigger Coverity check.

* js/ci-coverity:
  coverity: detect and report when the token or project is incorrect
  coverity: allow running on macOS
  coverity: support building on Windows
  coverity: allow overriding the Coverity project
  coverity: cache the Coverity Build Tool
  ci: add a GitHub workflow to submit Coverity scans

7 months agoMerge branch 'jk/test-lsan-denoise-output' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:14 +0000 (16:53 +0900)] 
Merge branch 'jk/test-lsan-denoise-output' into maint-2.42

Tests with LSan from time to time seem to emit harmless message
that makes our tests unnecessarily flakey; we work it around by
filtering the uninteresting output.

* jk/test-lsan-denoise-output:
  test-lib: ignore uninteresting LSan output

7 months agoMerge branch 'js/ci-san-skip-p4-and-svn-tests' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:13 +0000 (16:53 +0900)] 
Merge branch 'js/ci-san-skip-p4-and-svn-tests' into maint-2.42

Flakey "git p4" tests, as well as "git svn" tests, are now skipped
in the (rather expensive) sanitizer CI job.

* js/ci-san-skip-p4-and-svn-tests:
  ci(linux-asan-ubsan): let's save some time

7 months agoMerge branch 'tb/mark-more-tests-as-leak-free' into maint-2.42
Junio C Hamano [Thu, 2 Nov 2023 07:53:13 +0000 (16:53 +0900)] 
Merge branch 'tb/mark-more-tests-as-leak-free' into maint-2.42

Tests that are known to pass with LSan are now marked as such.

* tb/mark-more-tests-as-leak-free:
  leak tests: mark t5583-push-branches.sh as leak-free
  leak tests: mark t3321-notes-stripspace.sh as leak-free
  leak tests: mark a handful of tests as leak-free

7 months agomax_tree_depth: lower it for MSVC to avoid stack overflows
Johannes Schindelin [Wed, 1 Nov 2023 13:03:30 +0000 (13:03 +0000)] 
max_tree_depth: lower it for MSVC to avoid stack overflows

There seems to be some internal stack overflow detection in MSVC's
`malloc()` machinery that seems to be independent of the `stack reserve`
and `heap reserve` sizes specified in the executable (editable via
`EDITBIN /STACK:<n> <exe>` and `EDITBIN /HEAP:<n> <exe>`).

In the newly test cases added by `jk/tree-name-and-depth-limit`, this
stack overflow detection is unfortunately triggered before Git can print
out the error message about too-deep trees and exit gracefully. Instead,
it exits with `STATUS_STACK_OVERFLOW`. This corresponds to the numeric
value -1073741571, something the MSYS2 runtime we sadly need to use to
run Git's test suite cannot handle and which it internally maps to the
exit code 127. Git's test suite, in turn, mistakes this to mean that the
command was not found, and fails both test cases.

Here is an example stack trace from an example run:

    [0x0]   ntdll!RtlpAllocateHeap+0x31   0x4212603f50   0x7ff9d6d4cd49
    [0x1]   ntdll!RtlpAllocateHeapInternal+0x6c9   0x42126041b0   0x7ff9d6e14512
    [0x2]   ntdll!RtlDebugAllocateHeap+0x102   0x42126042b0   0x7ff9d6dcd8b0
    [0x3]   ntdll!RtlpAllocateHeap+0x7ec70   0x4212604350   0x7ff9d6d4cd49
    [0x4]   ntdll!RtlpAllocateHeapInternal+0x6c9   0x42126045b0   0x7ff9596ed480
    [0x5]   ucrtbased!heap_alloc_dbg_internal+0x210   0x42126046b0   0x7ff9596ed20d
    [0x6]   ucrtbased!heap_alloc_dbg+0x4d   0x4212604750   0x7ff9596f037f
    [0x7]   ucrtbased!_malloc_dbg+0x2f   0x42126047a0   0x7ff9596f0dee
    [0x8]   ucrtbased!malloc+0x1e   0x42126047d0   0x7ff730fcc1ef
    [0x9]   git!do_xmalloc+0x2f   0x4212604800   0x7ff730fcc2b9
    [0xa]   git!do_xmallocz+0x59   0x4212604840   0x7ff730fca779
    [0xb]   git!xmallocz_gently+0x19   0x4212604880   0x7ff7311b0883
    [0xc]   git!unpack_compressed_entry+0x43   0x42126048b0   0x7ff7311ac9a4
    [0xd]   git!unpack_entry+0x554   0x42126049a0   0x7ff7311b0628
    [0xe]   git!cache_or_unpack_entry+0x58   0x4212605250   0x7ff7311ad3a8
    [0xf]   git!packed_object_info+0x98   0x42126052a0   0x7ff7310a92da
    [0x10]   git!do_oid_object_info_extended+0x3fa   0x42126053b0   0x7ff7310a44e7
    [0x11]   git!oid_object_info_extended+0x37   0x4212605460   0x7ff7310a38ba
    [0x12]   git!repo_read_object_file+0x9a   0x42126054a0   0x7ff7310a6147
    [0x13]   git!read_object_with_reference+0x97   0x4212605560   0x7ff7310b4656
    [0x14]   git!fill_tree_descriptor+0x66   0x4212605620   0x7ff7310dc0a5
    [0x15]   git!traverse_trees_recursive+0x3f5   0x4212605680   0x7ff7310dd831
    [0x16]   git!unpack_callback+0x441   0x4212605790   0x7ff7310b4c95
    [0x17]   git!traverse_trees+0x5d5   0x42126058a0   0x7ff7310dc0f2
    [0x18]   git!traverse_trees_recursive+0x442   0x4212605980   0x7ff7310dd831
    [0x19]   git!unpack_callback+0x441   0x4212605a90   0x7ff7310b4c95
    [0x1a]   git!traverse_trees+0x5d5   0x4212605ba0   0x7ff7310dc0f2
    [0x1b]   git!traverse_trees_recursive+0x442   0x4212605c80   0x7ff7310dd831
    [0x1c]   git!unpack_callback+0x441   0x4212605d90   0x7ff7310b4c95
    [0x1d]   git!traverse_trees+0x5d5   0x4212605ea0   0x7ff7310dc0f2
    [0x1e]   git!traverse_trees_recursive+0x442   0x4212605f80   0x7ff7310dd831
    [0x1f]   git!unpack_callback+0x441   0x4212606090   0x7ff7310b4c95
    [0x20]   git!traverse_trees+0x5d5   0x42126061a0   0x7ff7310dc0f2
    [0x21]   git!traverse_trees_recursive+0x442   0x4212606280   0x7ff7310dd831
    [...]
    [0xfad]   git!cmd_main+0x2a2   0x42126ff740   0x7ff730fb6345
    [0xfae]   git!main+0xe5   0x42126ff7c0   0x7ff730fbff93
    [0xfaf]   git!wmain+0x2a3   0x42126ff830   0x7ff731318859
    [0xfb0]   git!invoke_main+0x39   0x42126ff8a0   0x7ff7313186fe
    [0xfb1]   git!__scrt_common_main_seh+0x12e   0x42126ff8f0   0x7ff7313185be
    [0xfb2]   git!__scrt_common_main+0xe   0x42126ff960   0x7ff7313188ee
    [0xfb3]   git!wmainCRTStartup+0xe   0x42126ff990   0x7ff9d5ed257d
    [0xfb4]   KERNEL32!BaseThreadInitThunk+0x1d   0x42126ff9c0   0x7ff9d6d6aa78
    [0xfb5]   ntdll!RtlUserThreadStart+0x28   0x42126ff9f0   0x0

I verified manually that `traverse_trees_cur_depth` was 562 when that
happened, which is far below the 2048 that were already accepted into
Git as a hard limit.

Despite many attempts to figure out which of the internals trigger this
`STATUS_STACK_OVERFLOW` and how to maybe increase certain sizes to avoid
running into this issue and let Git behave the same way as under Linux,
I failed to find any build-time/runtime knob we could turn to that
effect.

Note: even switching to using a different allocator (I used mimalloc
because that's what Git for Windows uses for its GCC builds) does not
help, as the zlib code used to unpack compressed pack entries _still_
uses the regular `malloc()`. And runs into the same issue.

Note also: switching to using a different allocator _also_ for zlib code
seems _also_ not to help. I tried that, and it still exited with
`STATUS_STACK_OVERFLOW` that seems to have been triggered by a
`mi_assert_internal()`, i.e. an internal assertion of mimalloc...

So the best bet to work around this for now seems to just lower the
maximum allowed tree depth _even further_ for MSVC builds.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agomerge-file: add an option to process object IDs
brian m. carlson [Wed, 1 Nov 2023 19:24:19 +0000 (19:24 +0000)] 
merge-file: add an option to process object IDs

git merge-file knows how to merge files on the file system already.  It
would be helpful, however, to allow it to also merge single blobs.
Teach it an `--object-id` option which means that its arguments are
object IDs and not files to allow it to do so.

We handle the empty blob specially since read_mmblob doesn't read it
directly and otherwise users cannot specify an empty ancestor.

Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agogit-merge-file doc: drop "-file" from argument placeholders
Martin Ågren [Wed, 1 Nov 2023 19:24:18 +0000 (19:24 +0000)] 
git-merge-file doc: drop "-file" from argument placeholders

`git merge-file` takes three positional arguments. Each of them is
documented as `<foo-file>`. In preparation for teaching this command to
alternatively take three object IDs, make these placeholders a bit more
generic by dropping the "-file" parts. Instead, clarify early that the
three arguments are filenames. Even after the next commit, we can afford
to present this file-centric view up front and in the general
discussion, since it will remain the default one.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoDocumentation/gitformat-pack.txt: fix incorrect MIDX documentation
Taylor Blau [Tue, 31 Oct 2023 19:24:11 +0000 (15:24 -0400)] 
Documentation/gitformat-pack.txt: fix incorrect MIDX documentation

Back in 32f3c541e3 (multi-pack-index: write pack names in chunk,
2018-07-12) the MIDX's "Packfile Names" (or "PNAM", for short) chunk was
described as containing an array of string entries. e0d1bcf825 notes
that this is the only chunk in the MIDX format's specification that is
not guaranteed to be 4-byte aligned, and so should be placed last.

This isn't quite accurate: the entries within the PNAM chunk are not
guaranteed to be 4-byte aligned since they are arbitrary strings, but
the chunk itself is 4-byte aligned since the ending is padded with NUL
bytes.

That padding has always been there since 32f3c541e3 via
midx.c::write_midx_pack_names(), which ended with:

    i = MIDX_CHUNK_ALIGNMENT - (written % MIDX_CHUNK_ALIGNMENT)
    if (i < MIDX_CHUNK_ALIGNMENT) {
      unsigned char padding[MIDX_CHUNK_ALIGNMENT];
      memset(padding, 0, sizeof(padding))
      hashwrite(f, padding, i);
      written += i;
    }

In fact, 32f3c541e3's log message itself describes the chunk in its
first paragraph with:

    Since filenames are not well structured, add padding to keep good
    alignment in later chunks.

So these have always been externally aligned. Correct the corresponding
part of our documentation to reflect that.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoDocumentation/gitformat-pack.txt: fix typo
Taylor Blau [Tue, 31 Oct 2023 19:24:08 +0000 (15:24 -0400)] 
Documentation/gitformat-pack.txt: fix typo

e0d1bcf825 (multi-pack-index: add format details, 2018-07-12) describes
the MIDX's "PNAM" chunk as having entries which are "null-terminated
strings".

This is a typo, as strings are terminated with a NUL character, which is
a distinct concept from "NULL" or "null", which we typically reserve for
the void pointer to address 0.

Correct the documentation accordingly.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agoclang-format: fix typo in comment
Aditya Neelamraju [Tue, 31 Oct 2023 13:40:28 +0000 (13:40 +0000)] 
clang-format: fix typo in comment

Signed-off-by: Aditya Neelamraju <adityanv97@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agot: use git-show-ref(1) to check for ref existence
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:59 +0000 (09:16 +0100)] 
t: use git-show-ref(1) to check for ref existence

Convert tests that use `test_path_is_file` and `test_path_is_missing` to
instead use a set of helpers `test_ref_exists` and `test_ref_missing`.
These helpers are implemented via the newly introduced `git show-ref
--exists` command. Thus, we can avoid intimate knowledge of how the ref
backend stores references on disk.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: add new mode to check for reference existence
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:54 +0000 (09:16 +0100)] 
builtin/show-ref: add new mode to check for reference existence

While we have multiple ways to show the value of a given reference, we
do not have any way to check whether a reference exists at all. While
commands like git-rev-parse(1) or git-show-ref(1) can be used to check
for reference existence in case the reference resolves to something
sane, neither of them can be used to check for existence in some other
scenarios where the reference does not resolve cleanly:

    - References which have an invalid name cannot be resolved.

    - References to nonexistent objects cannot be resolved.

    - Dangling symrefs can be resolved via git-symbolic-ref(1), but this
      requires the caller to special case existence checks depending on
      whether or not a reference is symbolic or direct.

Furthermore, git-rev-list(1) and other commands do not let the caller
distinguish easily between an actually missing reference and a generic
error.

Taken together, this seems like sufficient motivation to introduce a
separate plumbing command to explicitly check for the existence of a
reference without trying to resolve its contents.

This new command comes in the form of `git show-ref --exists`. This
new mode will exit successfully when the reference exists, with a
specific exit code of 2 when it does not exist, or with 1 when there
has been a generic error.

Note that the only way to properly implement this command is by using
the internal `refs_read_raw_ref()` function. While the public function
`refs_resolve_ref_unsafe()` can be made to behave in the same way by
passing various flags, it does not provide any way to obtain the errno
with which the reference backend failed when reading the reference. As
such, it becomes impossible for us to distinguish generic errors from
the explicit case where the reference wasn't found.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: explicitly spell out different modes in synopsis
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:50 +0000 (09:16 +0100)] 
builtin/show-ref: explicitly spell out different modes in synopsis

The synopsis treats the `--verify` and the implicit mode the same. They
are slightly different though:

    - They accept different sets of flags.

    - The implicit mode accepts patterns while the `--verify` mode
      accepts references.

Split up the synopsis for these two modes such that we can disambiguate
those differences.

While at it, drop "--quiet" from the pattern mode's synopsis. It does
not make a lot of sense to list patterns, but squelch the listing output
itself. The description for "--quiet" is adapted accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: ensure mutual exclusiveness of subcommands
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:46 +0000 (09:16 +0100)] 
builtin/show-ref: ensure mutual exclusiveness of subcommands

The git-show-ref(1) command has three different modes, of which one is
implicit and the other two can be chosen explicitly by passing a flag.
But while these modes are standalone and cause us to execute completely
separate code paths, we gladly accept the case where a user asks for
both `--exclude-existing` and `--verify` at the same time even though it
is not obvious what will happen. Spoiler: we ignore `--verify` and
execute the `--exclude-existing` mode.

Let's explicitly detect this invalid usage and die in case both modes
were requested.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: refactor options for patterns subcommand
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:42 +0000 (09:16 +0100)] 
builtin/show-ref: refactor options for patterns subcommand

The patterns subcommand is the last command that still uses global
variables to track its options. Convert it to use a structure instead
with the same motivation as preceding commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: stop using global vars for `show_one()`
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:38 +0000 (09:16 +0100)] 
builtin/show-ref: stop using global vars for `show_one()`

The `show_one()` function implicitly receives a bunch of options which
are tracked via global variables. This makes it hard to see which
subcommands of git-show-ref(1) actually make use of these options.

Introduce a `show_one_options` structure that gets passed down to this
function. This allows us to get rid of more global state and makes it
more explicit which subcommands use those options.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: stop using global variable to count matches
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:33 +0000 (09:16 +0100)] 
builtin/show-ref: stop using global variable to count matches

When passing patterns to git-show-ref(1) we're checking whether any
reference matches -- if none do, we indicate this condition via an
unsuccessful exit code.

We're using a global variable to count these matches, which is required
because the counter is getting incremented in a callback function. But
now that we have the `struct show_ref_data` in place, we can get rid of
the global variable and put the counter in there instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: refactor `--exclude-existing` options
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:29 +0000 (09:16 +0100)] 
builtin/show-ref: refactor `--exclude-existing` options

It's not immediately obvious options which options are applicable to
what subcommand in git-show-ref(1) because all options exist as global
state. This can easily cause confusion for the reader.

Refactor options for the `--exclude-existing` subcommand to be contained
in a separate structure. This structure is stored on the stack and
passed down as required. Consequently, it clearly delimits the scope of
those options and requires the reader to worry less about global state.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: fix dead code when passing patterns
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:25 +0000 (09:16 +0100)] 
builtin/show-ref: fix dead code when passing patterns

When passing patterns to `git show-ref` we have some code that will
cause us to die if `verify && !quiet` is true. But because `verify`
indicates a different subcommand of git-show-ref(1) that causes us to
execute `cmd_show_ref__verify()` and not `cmd_show_ref__patterns()`, the
condition cannot ever be true.

Let's remove this dead code.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: fix leaking string buffer
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:21 +0000 (09:16 +0100)] 
builtin/show-ref: fix leaking string buffer

Fix a leaking string buffer in `git show-ref --exclude-existing`. While
the buffer is technically not leaking because its variable is declared
as static, there is no inherent reason why it should be.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: split up different subcommands
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:17 +0000 (09:16 +0100)] 
builtin/show-ref: split up different subcommands

While not immediately obvious, git-show-ref(1) actually implements three
different subcommands:

    - `git show-ref <patterns>` can be used to list references that
      match a specific pattern.

    - `git show-ref --verify <refs>` can be used to list references.
      These are _not_ patterns.

    - `git show-ref --exclude-existing` can be used as a filter that
      reads references from standard input, performing some conversions
      on each of them.

Let's make this more explicit in the code by splitting up the three
subcommands into separate functions. This also allows us to address the
confusingly named `patterns` variable, which may hold either patterns or
reference names.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agobuiltin/show-ref: convert pattern to a local variable
Patrick Steinhardt [Tue, 31 Oct 2023 08:16:12 +0000 (09:16 +0100)] 
builtin/show-ref: convert pattern to a local variable

The `pattern` variable is a global variable that tracks either the
reference names (not patterns!) for the `--verify` mode or the patterns
for the non-verify mode. This is a bit confusing due to the slightly
different meanings.

Convert the variable to be local. While this does not yet fix the double
meaning of the variable, this change allows us to address it in a
subsequent patch more easily by explicitly splitting up the different
subcommands of git-show-ref(1).

Note that we introduce a `struct show_ref_data` to pass the patterns to
`show_ref()`. While this is overengineered now, we will extend this
structure in a subsequent patch.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agorev-list: add commit object support in `--missing` option
Karthik Nayak [Fri, 27 Oct 2023 07:59:29 +0000 (09:59 +0200)] 
rev-list: add commit object support in `--missing` option

The `--missing` object option in rev-list currently works only with
missing blobs/trees. For missing commits the revision walker fails with
a fatal error.

Let's extend the functionality of `--missing` option to also support
commit objects. This is done by adding a `missing_objects` field to
`rev_info`. This field is an `oidset` to which we'll add the missing
commits as we encounter them. The revision walker will now continue the
traversal and call `show_commit()` even for missing commits. In rev-list
we can then check if the commit is a missing commit and call the
existing code for parsing `--missing` objects.

A scenario where this option would be used is to find the boundary
objects between different object directories. Consider a repository with
a main object directory (GIT_OBJECT_DIRECTORY) and one or more alternate
object directories (GIT_ALTERNATE_OBJECT_DIRECTORIES). In such a
repository, using the `--missing=print` option while disabling the
alternate object directory allows us to find the boundary objects
between the main and alternate object directory.

Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agorev-list: move `show_commit()` to the bottom
Karthik Nayak [Thu, 26 Oct 2023 10:11:08 +0000 (12:11 +0200)] 
rev-list: move `show_commit()` to the bottom

The `show_commit()` function already depends on `finish_commit()`, and
in the upcoming commit, we'll also add a dependency on
`finish_object__ma()`. Since in C symbols must be declared before
they're used, let's move `show_commit()` below both `finish_commit()`
and `finish_object__ma()`, so the code is cleaner as a whole without the
need for declarations.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 months agorevision: rename bit to `do_not_die_on_missing_objects`
Karthik Nayak [Thu, 26 Oct 2023 10:11:07 +0000 (12:11 +0200)] 
revision: rename bit to `do_not_die_on_missing_objects`

The bit `do_not_die_on_missing_tree` is used in revision.h to ensure the
revision walker does not die when encountering a missing tree. This is
currently exclusively set within `builtin/rev-list.c` to ensure the
`--missing` option works with missing trees.

In the upcoming commits, we will extend `--missing` to also support
missing commits. So let's rename the bit to
`do_not_die_on_missing_objects`, which is object type agnostic and can
be used for both trees/commits.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>