]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 months agofor-each-ref: add new option to include root refs
Karthik Nayak [Fri, 23 Feb 2024 10:01:12 +0000 (11:01 +0100)] 
for-each-ref: add new option to include root refs

The git-for-each-ref(1) command doesn't provide a way to print root refs
i.e pseudorefs and HEAD with the regular "refs/" prefixed refs.

This commit adds a new option "--include-root-refs" to
git-for-each-ref(1). When used this would also print pseudorefs and HEAD
for the current worktree.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoref-filter: rename 'FILTER_REFS_ALL' to 'FILTER_REFS_REGULAR'
Karthik Nayak [Fri, 23 Feb 2024 10:01:11 +0000 (11:01 +0100)] 
ref-filter: rename 'FILTER_REFS_ALL' to 'FILTER_REFS_REGULAR'

The flag 'FILTER_REFS_ALL' is a bit ambiguous, where ALL doesn't specify
if it means to contain refs from all worktrees or whether all types of
refs (regular, HEAD & pseudorefs) or all of the above.

Since here it is actually referring to all refs with the "refs/" prefix,
let's rename it to 'FILTER_REFS_REGULAR' to indicate that this is
specifically for regular refs.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs: introduce `refs_for_each_include_root_refs()`
Karthik Nayak [Fri, 23 Feb 2024 10:01:10 +0000 (11:01 +0100)] 
refs: introduce `refs_for_each_include_root_refs()`

Introduce a new ref iteration flag `DO_FOR_EACH_INCLUDE_ROOT_REFS`,
which will be used to iterate over regular refs plus pseudorefs and
HEAD.

Refs which fall outside the `refs/` and aren't either pseudorefs or HEAD
are more of a grey area. This is because we don't block the users from
creating such refs but they are not officially supported.

Introduce `refs_for_each_include_root_refs()` which calls
`do_for_each_ref()` with this newly introduced flag.

In `refs/files-backend.c`, introduce a new function
`add_pseudoref_and_head_entries()` to add pseudorefs and HEAD to the
`ref_dir`. We then finally call `add_pseudoref_and_head_entries()`
whenever the `DO_FOR_EACH_INCLUDE_ROOT_REFS` flag is set. Any new ref
backend will also have to implement similar changes on its end.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs: extract out `loose_fill_ref_dir_regular_file()`
Karthik Nayak [Fri, 23 Feb 2024 10:01:09 +0000 (11:01 +0100)] 
refs: extract out `loose_fill_ref_dir_regular_file()`

Extract out the code for adding a single file to the loose ref dir as
`loose_fill_ref_dir_regular_file()` from `loose_fill_ref_dir()` in
`refs/files-backend.c`.

This allows us to use this function independently in the following
commits where we add code to also add pseudorefs to the ref dir.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agorefs: introduce `is_pseudoref()` and `is_headref()`
Karthik Nayak [Fri, 23 Feb 2024 10:01:08 +0000 (11:01 +0100)] 
refs: introduce `is_pseudoref()` and `is_headref()`

Introduce two new functions `is_pseudoref()` and `is_headref()`. This
provides the necessary functionality for us to add pseudorefs and HEAD
to the loose ref cache in the files backend, allowing us to build
tooling to print these refs.

The `is_pseudoref()` function internally calls `is_pseudoref_syntax()`
but adds onto it by also checking to ensure that the pseudoref either
ends with a "_HEAD" suffix or matches a list of exceptions. After which
we also parse the contents of the pseudoref to ensure that it conforms
to the ref format.

We cannot directly add the new syntax checks to `is_pseudoref_syntax()`
because the function is also used by `is_current_worktree_ref()` and
making it stricter to match only known pseudorefs might have unintended
consequences due to files like 'BISECT_START' which isn't a pseudoref
but sometimes contains object ID.

Keeping this in mind, we leave `is_pseudoref_syntax()` as is and create
`is_pseudoref()` which is stricter. Ideally we'd want to move the new
syntax checks to `is_pseudoref_syntax()` but a prerequisite for this
would be to actually remove the exception list by converting those
pseudorefs to also contain a '_HEAD' suffix and perhaps move bisect
related files like 'BISECT_START' to a new directory similar to the
'rebase-merge' directory.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ps/reftable-backend' into kn/for-all-refs
Junio C Hamano [Mon, 12 Feb 2024 18:09:19 +0000 (10:09 -0800)] 
Merge branch 'ps/reftable-backend' into kn/for-all-refs

* ps/reftable-backend:
  refs/reftable: fix leak when copying reflog fails
  ci: add jobs to test with the reftable backend
  refs: introduce reftable backend

3 months agoGit 2.44-rc0 v2.44.0-rc0
Junio C Hamano [Fri, 9 Feb 2024 00:35:07 +0000 (16:35 -0800)] 
Git 2.44-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoSync with Git 2.43.1
Junio C Hamano [Fri, 9 Feb 2024 00:30:22 +0000 (16:30 -0800)] 
Sync with Git 2.43.1

3 months agoGit 2.43.1 v2.43.1
Junio C Hamano [Thu, 8 Feb 2024 23:56:45 +0000 (15:56 -0800)] 
Git 2.43.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ib/rebase-reschedule-doc' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:12 +0000 (16:22 -0800)] 
Merge branch 'ib/rebase-reschedule-doc' into maint-2.43

Doc update.

* ib/rebase-reschedule-doc:
  rebase: clarify --reschedule-failed-exec default

3 months agoMerge branch 'jk/index-pack-lsan-false-positive-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:12 +0000 (16:22 -0800)] 
Merge branch 'jk/index-pack-lsan-false-positive-fix' into maint-2.43

Fix false positive reported by leak sanitizer.

* jk/index-pack-lsan-false-positive-fix:
  index-pack: spawn threads atomically

3 months agoMerge branch 'cp/sideband-array-index-comment-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:12 +0000 (16:22 -0800)] 
Merge branch 'cp/sideband-array-index-comment-fix' into maint-2.43

In-code comment fix.

* cp/sideband-array-index-comment-fix:
  sideband.c: remove redundant 'NEEDSWORK' tag

3 months agoMerge branch 'ms/rebase-insnformat-doc-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:11 +0000 (16:22 -0800)] 
Merge branch 'ms/rebase-insnformat-doc-fix' into maint-2.43

Docfix.

* ms/rebase-insnformat-doc-fix:
  Documentation: fix statement about rebase.instructionFormat

3 months agoMerge branch 'jx/sideband-chomp-newline-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:11 +0000 (16:22 -0800)] 
Merge branch 'jx/sideband-chomp-newline-fix' into maint-2.43

Sideband demultiplexer fixes.

* jx/sideband-chomp-newline-fix:
  pkt-line: do not chomp newlines for sideband messages
  pkt-line: memorize sideband fragment in reader
  test-pkt-line: add option parser for unpack-sideband

3 months agoMerge branch 'jk/t1006-cat-file-objectsize-disk' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:11 +0000 (16:22 -0800)] 
Merge branch 'jk/t1006-cat-file-objectsize-disk' into maint-2.43

Test update.

* jk/t1006-cat-file-objectsize-disk:
  t1006: prefer shell loop to awk for packed object sizes
  t1006: add tests for %(objectsize:disk)

3 months agoMerge branch 'js/contributor-docs-updates' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:11 +0000 (16:22 -0800)] 
Merge branch 'js/contributor-docs-updates' into maint-2.43

Doc update.

* js/contributor-docs-updates:
  SubmittingPatches: hyphenate non-ASCII
  SubmittingPatches: clarify GitHub artifact format
  SubmittingPatches: clarify GitHub visual
  SubmittingPatches: provide tag naming advice
  SubmittingPatches: update extra tags list
  SubmittingPatches: discourage new trailers
  SubmittingPatches: drop ref to "What's in git.git"
  CodingGuidelines: write punctuation marks
  CodingGuidelines: move period inside parentheses

3 months agoMerge branch 'rs/fast-import-simplify-mempool-allocation' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:10 +0000 (16:22 -0800)] 
Merge branch 'rs/fast-import-simplify-mempool-allocation' into maint-2.43

Code simplification.

* rs/fast-import-simplify-mempool-allocation:
  fast-import: use mem_pool_calloc()

3 months agoMerge branch 'en/header-cleanup' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:10 +0000 (16:22 -0800)] 
Merge branch 'en/header-cleanup' into maint-2.43

Remove unused header "#include".

* en/header-cleanup:
  treewide: remove unnecessary includes in source files
  treewide: add direct includes currently only pulled in transitively
  trace2/tr2_tls.h: remove unnecessary include
  submodule-config.h: remove unnecessary include
  pkt-line.h: remove unnecessary include
  line-log.h: remove unnecessary include
  http.h: remove unnecessary include
  fsmonitor--daemon.h: remove unnecessary includes
  blame.h: remove unnecessary includes
  archive.h: remove unnecessary include
  treewide: remove unnecessary includes in source files
  treewide: remove unnecessary includes from header files

3 months agoMerge branch 'ml/doc-merge-updates' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:10 +0000 (16:22 -0800)] 
Merge branch 'ml/doc-merge-updates' into maint-2.43

Doc update.

* ml/doc-merge-updates:
  Documentation/git-merge.txt: use backticks for command wrapping
  Documentation/git-merge.txt: fix reference to synopsis

3 months agoMerge branch 'jc/orphan-unborn' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:09 +0000 (16:22 -0800)] 
Merge branch 'jc/orphan-unborn' into maint-2.43

Doc updates to clarify what an "unborn branch" means.

* jc/orphan-unborn:
  orphan/unborn: fix use of 'orphan' in end-user facing messages
  orphan/unborn: add to the glossary and use them consistently

3 months agoMerge branch 'la/trailer-cleanups' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:09 +0000 (16:22 -0800)] 
Merge branch 'la/trailer-cleanups' into maint-2.43

Code clean-up.

* la/trailer-cleanups:
  trailer: use offsets for trailer_start/trailer_end
  trailer: find the end of the log message
  commit: ignore_non_trailer computes number of bytes to ignore

3 months agoMerge branch 'jc/retire-cas-opt-name-constant' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:09 +0000 (16:22 -0800)] 
Merge branch 'jc/retire-cas-opt-name-constant' into maint-2.43

Code clean-up.

* jc/retire-cas-opt-name-constant:
  remote.h: retire CAS_OPT_NAME

3 months agoMerge branch 'rs/rebase-use-strvec-pushf' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:09 +0000 (16:22 -0800)] 
Merge branch 'rs/rebase-use-strvec-pushf' into maint-2.43

Code clean-up.

* rs/rebase-use-strvec-pushf:
  rebase: use strvec_pushf() for format-patch revisions

3 months agoMerge branch 'rs/t6300-compressed-size-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:08 +0000 (16:22 -0800)] 
Merge branch 'rs/t6300-compressed-size-fix' into maint-2.43

Test fix.

* rs/t6300-compressed-size-fix:
  t6300: avoid hard-coding object sizes

3 months agoMerge branch 'sp/test-i18ngrep' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:08 +0000 (16:22 -0800)] 
Merge branch 'sp/test-i18ngrep' into maint-2.43

Error message fix in the test framework.

* sp/test-i18ngrep:
  test-lib-functions.sh: fix test_grep fail message wording

3 months agoMerge branch 'jc/doc-misspelt-refs-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:08 +0000 (16:22 -0800)] 
Merge branch 'jc/doc-misspelt-refs-fix' into maint-2.43

Doc update.

* jc/doc-misspelt-refs-fix:
  doc: format.notes specify a ref under refs/notes/ hierarchy

3 months agoMerge branch 'jc/doc-most-refs-are-not-that-special' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:08 +0000 (16:22 -0800)] 
Merge branch 'jc/doc-most-refs-are-not-that-special' into maint-2.43

Doc updates.

* jc/doc-most-refs-are-not-that-special:
  docs: MERGE_AUTOSTASH is not that special
  docs: AUTO_MERGE is not that special
  refs.h: HEAD is not that special
  git-bisect.txt: BISECT_HEAD is not that special
  git.txt: HEAD is not that special

3 months agoMerge branch 'es/add-doc-list-short-form-of-all-in-synopsis' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:07 +0000 (16:22 -0800)] 
Merge branch 'es/add-doc-list-short-form-of-all-in-synopsis' into maint-2.43

Doc update.

* es/add-doc-list-short-form-of-all-in-synopsis:
  git-add.txt: add missing short option -A to synopsis

3 months agoMerge branch 'ps/chainlint-self-check-update' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:07 +0000 (16:22 -0800)] 
Merge branch 'ps/chainlint-self-check-update' into maint-2.43

Test framework update.

* ps/chainlint-self-check-update:
  tests: adjust whitespace in chainlint expectations

3 months agoMerge branch 'ps/reftable-fixes' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:07 +0000 (16:22 -0800)] 
Merge branch 'ps/reftable-fixes' into maint-2.43

Bunch of small fix-ups to the reftable code.

* ps/reftable-fixes:
  reftable/block: reuse buffer to compute record keys
  reftable/block: introduce macro to initialize `struct block_iter`
  reftable/merged: reuse buffer to compute record keys
  reftable/stack: fix use of unseeded randomness
  reftable/stack: fix stale lock when dying
  reftable/stack: reuse buffers when reloading stack
  reftable/stack: perform auto-compaction with transactional interface
  reftable/stack: verify that `reftable_stack_add()` uses auto-compaction
  reftable: handle interrupted writes
  reftable: handle interrupted reads
  reftable: wrap EXPECT macros in do/while

3 months agoMerge branch 'jk/config-cleanup' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:07 +0000 (16:22 -0800)] 
Merge branch 'jk/config-cleanup' into maint-2.43

Code clean-up around use of configuration variables.

* jk/config-cleanup:
  sequencer: simplify away extra git_config_string() call
  gpg-interface: drop pointless config_error_nonbool() checks
  push: drop confusing configset/callback redundancy
  config: use git_config_string() for core.checkRoundTripEncoding
  diff: give more detailed messages for bogus diff.* config
  config: use config_error_nonbool() instead of custom messages
  imap-send: don't use git_die_config() inside callback
  git_xmerge_config(): prefer error() to die()
  config: reject bogus values for core.checkstat

3 months agoMerge branch 'rs/incompatible-options-messages' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:06 +0000 (16:22 -0800)] 
Merge branch 'rs/incompatible-options-messages' into maint-2.43

Clean-up code that handles combinations of incompatible options.

* rs/incompatible-options-messages:
  worktree: simplify incompatibility message for --orphan and commit-ish
  worktree: standardize incompatibility messages
  clean: factorize incompatibility message
  revision, rev-parse: factorize incompatibility messages about - -exclude-hidden
  revision: use die_for_incompatible_opt3() for - -graph/--reverse/--walk-reflogs
  repack: use die_for_incompatible_opt3() for -A/-k/--cruft
  push: use die_for_incompatible_opt4() for - -delete/--tags/--all/--mirror

3 months agoMerge branch 'mk/doc-gitfile-more' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:06 +0000 (16:22 -0800)] 
Merge branch 'mk/doc-gitfile-more' into maint-2.43

Doc update.

* mk/doc-gitfile-more:
  doc: make the gitfile syntax easier to discover

3 months agoMerge branch 'ps/ref-tests-update-more' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:06 +0000 (16:22 -0800)] 
Merge branch 'ps/ref-tests-update-more' into maint-2.43

Tests update.

* ps/ref-tests-update-more:
  t6301: write invalid object ID via `test-tool ref-store`
  t5551: stop writing packed-refs directly
  t5401: speed up creation of many branches
  t4013: simplify magic parsing and drop "failure"
  t3310: stop checking for reference existence via `test -f`
  t1417: make `reflog --updateref` tests backend agnostic
  t1410: use test-tool to create empty reflog
  t1401: stop treating FETCH_HEAD as real reference
  t1400: split up generic reflog tests from the reffile-specific ones
  t0410: mark tests to require the reffiles backend

3 months agoMerge branch 'rs/column-leakfix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:06 +0000 (16:22 -0800)] 
Merge branch 'rs/column-leakfix' into maint-2.43

Leakfix.

* rs/column-leakfix:
  column: release strbuf and string_list after use

3 months agoMerge branch 'rs/i18n-cannot-be-used-together' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:05 +0000 (16:22 -0800)] 
Merge branch 'rs/i18n-cannot-be-used-together' into maint-2.43

Clean-up code that handles combinations of incompatible options.

* rs/i18n-cannot-be-used-together:
  i18n: factorize even more 'incompatible options' messages

3 months agoMerge branch 'jb/reflog-expire-delete-dry-run-options' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:05 +0000 (16:22 -0800)] 
Merge branch 'jb/reflog-expire-delete-dry-run-options' into maint-2.43

Command line parsing fix for "git reflog".

* jb/reflog-expire-delete-dry-run-options:
  builtin/reflog.c: fix dry-run option short name

3 months agoMerge branch 'js/packfile-h-typofix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:05 +0000 (16:22 -0800)] 
Merge branch 'js/packfile-h-typofix' into maint-2.43

Typofix.

* js/packfile-h-typofix:
  packfile.c: fix a typo in `each_file_in_pack_dir_fn()`'s declaration

3 months agoMerge branch 'jk/commit-graph-slab-clear-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:05 +0000 (16:22 -0800)] 
Merge branch 'jk/commit-graph-slab-clear-fix' into maint-2.43

Clearing in-core repository (happens during e.g., "git fetch
--recurse-submodules" with commit graph enabled) made in-core
commit object in an inconsistent state by discarding the necessary
data from commit-graph too early, which has been corrected.

* jk/commit-graph-slab-clear-fix:
  commit-graph: retain commit slab when closing NULL commit_graph

3 months agoMerge branch 'cp/git-flush-is-an-env-bool' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:04 +0000 (16:22 -0800)] 
Merge branch 'cp/git-flush-is-an-env-bool' into maint-2.43

Unlike other environment variables that took the usual
true/false/yes/no as well as 0/1, GIT_FLUSH only understood 0/1,
which has been corrected.

* cp/git-flush-is-an-env-bool:
  write-or-die: make GIT_FLUSH a Boolean environment variable

3 months agoMerge branch 'jc/sparse-checkout-set-default-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:04 +0000 (16:22 -0800)] 
Merge branch 'jc/sparse-checkout-set-default-fix' into maint-2.43

"git sparse-checkout set" added default patterns even when the
patterns are being fed from the standard input, which has been
corrected.

* jc/sparse-checkout-set-default-fix:
  sparse-checkout: use default patterns for 'set' only !stdin

3 months agoMerge branch 'jc/archive-list-with-extra-args' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:04 +0000 (16:22 -0800)] 
Merge branch 'jc/archive-list-with-extra-args' into maint-2.43

"git archive --list extra garbage" silently ignored excess command
line parameters, which has been corrected.

* jc/archive-list-with-extra-args:
  archive: "--list" does not take further options

3 months agoMerge branch 'rj/status-bisect-while-rebase' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:04 +0000 (16:22 -0800)] 
Merge branch 'rj/status-bisect-while-rebase' into maint-2.43

"git status" is taught to show both the branch being bisected and
being rebased when both are in effect at the same time.
cf. <xmqqil76kyov.fsf@gitster.g>

* rj/status-bisect-while-rebase:
  status: fix branch shown when not only bisecting

3 months agoMerge branch 'sh/completion-with-reftable' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:04 +0000 (16:22 -0800)] 
Merge branch 'sh/completion-with-reftable' into maint-2.43

Command line completion script (in contrib/) learned to work better
with the reftable backend.

* sh/completion-with-reftable:
  completion: support pseudoref existence checks for reftables
  completion: refactor existence checks for pseudorefs

3 months agoMerge branch 'jx/fetch-atomic-error-message-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:03 +0000 (16:22 -0800)] 
Merge branch 'jx/fetch-atomic-error-message-fix' into maint-2.43

"git fetch --atomic" issued an unnecessary empty error message,
which has been corrected.
cf. <ZX__e7VjyLXIl-uV@tanuki>

* jx/fetch-atomic-error-message-fix:
  fetch: no redundant error message for atomic fetch
  t5574: test porcelain output of atomic fetch

3 months agoMerge branch 'jk/mailinfo-iterative-unquote-comment' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:03 +0000 (16:22 -0800)] 
Merge branch 'jk/mailinfo-iterative-unquote-comment' into maint-2.43

The code to parse the From e-mail header has been updated to avoid
recursion.

* jk/mailinfo-iterative-unquote-comment:
  mailinfo: avoid recursion when unquoting From headers
  t5100: make rfc822 comment test more careful
  mailinfo: fix out-of-bounds memory reads in unquote_quoted_pair()

3 months agoMerge branch 'rs/show-ref-incompatible-options' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:03 +0000 (16:22 -0800)] 
Merge branch 'rs/show-ref-incompatible-options' into maint-2.43

Code clean-up for sanity checking of command line options for "git
show-ref".

* rs/show-ref-incompatible-options:
  show-ref: use die_for_incompatible_opt3()

3 months agoMerge branch 'jk/implicit-true' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:03 +0000 (16:22 -0800)] 
Merge branch 'jk/implicit-true' into maint-2.43

Some codepaths did not correctly parse configuration variables
specified with valueless "true", which has been corrected.

* jk/implicit-true:
  fsck: handle NULL value when parsing message config
  trailer: handle NULL value when parsing trailer-specific config
  submodule: handle NULL value when parsing submodule.*.branch
  help: handle NULL value for alias.* config
  trace2: handle NULL values in tr2_sysenv config callback
  setup: handle NULL value when parsing extensions
  config: handle NULL value when parsing non-bools

3 months agoMerge branch 'jk/bisect-reset-fix' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:02 +0000 (16:22 -0800)] 
Merge branch 'jk/bisect-reset-fix' into maint-2.43

"git bisect reset" has been taught to clean up state files and refs
even when BISECT_START file is gone.

* jk/bisect-reset-fix:
  bisect: always clean on reset

3 months agoMerge branch 'jk/end-of-options' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:02 +0000 (16:22 -0800)] 
Merge branch 'jk/end-of-options' into maint-2.43

"git $cmd --end-of-options --rev -- --path" for some $cmd failed
to interpret "--rev" as a rev, and "--path" as a path.  This was
fixed for many programs like "reset" and "checkout".

* jk/end-of-options:
  parse-options: decouple "--end-of-options" and "--"

3 months agoMerge branch 'jc/revision-parse-int' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:02 +0000 (16:22 -0800)] 
Merge branch 'jc/revision-parse-int' into maint-2.43

The command line parser for the "log" family of commands was too
loose when parsing certain numbers, e.g., silently ignoring the
extra 'q' in "git log -n 1q" without complaining, which has been
tightened up.

* jc/revision-parse-int:
  revision: parse integer arguments to --max-count, --skip, etc., more carefully

3 months agoMerge branch 'jp/use-diff-index-in-pre-commit-sample' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:02 +0000 (16:22 -0800)] 
Merge branch 'jp/use-diff-index-in-pre-commit-sample' into maint-2.43

The sample pre-commit hook that tries to catch introduction of new
paths that use potentially non-portable characters did not notice
an existing path getting renamed to such a problematic path, when
rename detection was enabled.

* jp/use-diff-index-in-pre-commit-sample:
  hooks--pre-commit: detect non-ASCII when renaming

3 months agoMerge branch 'jh/trace2-redact-auth' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:01 +0000 (16:22 -0800)] 
Merge branch 'jh/trace2-redact-auth' into maint-2.43

trace2 streams used to record the URLs that potentially embed
authentication material, which has been corrected.

* jh/trace2-redact-auth:
  t0212: test URL redacting in EVENT format
  t0211: test URL redacting in PERF format
  trace2: redact passwords from https:// URLs by default
  trace2: fix signature of trace2_def_param() macro

3 months agoMerge branch 'js/update-urls-in-doc-and-comment' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:01 +0000 (16:22 -0800)] 
Merge branch 'js/update-urls-in-doc-and-comment' into maint-2.43

Stale URLs have been updated to their current counterparts (or
archive.org) and HTTP links are replaced with working HTTPS links.

* js/update-urls-in-doc-and-comment:
  doc: refer to internet archive
  doc: update links for andre-simon.de
  doc: switch links to https
  doc: update links to current pages

3 months agoMerge branch 'ps/commit-graph-less-paranoid' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:01 +0000 (16:22 -0800)] 
Merge branch 'ps/commit-graph-less-paranoid' into maint-2.43

Earlier we stopped relying on commit-graph that (still) records
information about commits that are lost from the object store,
which has negative performance implications.  The default has been
flipped to disable this pessimization.

* ps/commit-graph-less-paranoid:
  commit-graph: disable GIT_COMMIT_GRAPH_PARANOIA by default

3 months agoMerge branch 'tz/send-email-negatable-options' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:00 +0000 (16:22 -0800)] 
Merge branch 'tz/send-email-negatable-options' into maint-2.43

Newer versions of Getopt::Long started giving warnings against our
(ab)use of it in "git send-email".  Bump the minimum version
requirement for Perl to 5.8.1 (from September 2002) to allow
simplifying our implementation.

* tz/send-email-negatable-options:
  send-email: avoid duplicate specification warnings
  perl: bump the required Perl version to 5.8.1 from 5.8.0

3 months agoMerge branch 'js/ci-discard-prove-state' into maint-2.43
Junio C Hamano [Fri, 9 Feb 2024 00:22:00 +0000 (16:22 -0800)] 
Merge branch 'js/ci-discard-prove-state' into maint-2.43

The way CI testing used "prove" could lead to running the test
suite twice needlessly, which has been corrected.

* js/ci-discard-prove-state:
  ci: avoid running the test suite _twice_
  ci: add support for GitLab CI
  ci: install test dependencies for linux-musl
  ci: squelch warnings when testing with unusable Git repo
  ci: unify setup of some environment variables
  ci: split out logic to set up failed test artifacts
  ci: group installation of Docker dependencies
  ci: make grouping setup more generic
  ci: reorder definitions for grouping functions

3 months agoThe fifteenth batch
Junio C Hamano [Thu, 8 Feb 2024 21:20:41 +0000 (13:20 -0800)] 
The fifteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'jh/sparse-index-expand-to-path-fix'
Junio C Hamano [Thu, 8 Feb 2024 21:20:34 +0000 (13:20 -0800)] 
Merge branch 'jh/sparse-index-expand-to-path-fix'

A caller called index_file_exists() that takes a string expressed
as <ptr, length> with a wrong length, which has been corrected.

* jh/sparse-index-expand-to-path-fix:
  sparse-index: pass string length to index_file_exists()

3 months agoMerge branch 'pb/imap-send-wo-curl-build-fix'
Junio C Hamano [Thu, 8 Feb 2024 21:20:34 +0000 (13:20 -0800)] 
Merge branch 'pb/imap-send-wo-curl-build-fix'

Build fix.

* pb/imap-send-wo-curl-build-fix:
  imap-send: add missing "strbuf.h" include under NO_CURL

3 months agoMerge branch 'ja/doc-placeholders-fix'
Junio C Hamano [Thu, 8 Feb 2024 21:20:34 +0000 (13:20 -0800)] 
Merge branch 'ja/doc-placeholders-fix'

Docfix.

* ja/doc-placeholders-fix:
  doc: enforce placeholders in documentation
  doc: enforce dashes in placeholders

3 months agoMerge branch 'mh/credential-oauth-refresh-token-with-wincred'
Junio C Hamano [Thu, 8 Feb 2024 21:20:34 +0000 (13:20 -0800)] 
Merge branch 'mh/credential-oauth-refresh-token-with-wincred'

The wincred credential backend has been taught to support oauth refresh
token the same way as credential-cache and credential-libsecret backends.

* mh/credential-oauth-refresh-token-with-wincred:
  credential/wincred: store oauth_refresh_token

3 months agoMerge branch 'jk/unit-tests-buildfix'
Junio C Hamano [Thu, 8 Feb 2024 21:20:33 +0000 (13:20 -0800)] 
Merge branch 'jk/unit-tests-buildfix'

Build dependency around unit tests has been fixed.

* jk/unit-tests-buildfix:
  t/Makefile: say the default target upfront
  t/Makefile: get UNIT_TESTS list from C sources
  Makefile: remove UNIT_TEST_BIN directory with "make clean"
  Makefile: use mkdir_p_parent_template for UNIT_TEST_BIN

3 months agoMerge branch 'jc/index-pack-fsck-levels'
Junio C Hamano [Thu, 8 Feb 2024 21:20:33 +0000 (13:20 -0800)] 
Merge branch 'jc/index-pack-fsck-levels'

The "--fsck-objects" option of "git index-pack" now can take the
optional parameter to tweak severity of different fsck errors.

* jc/index-pack-fsck-levels:
  index-pack: --fsck-objects to take an optional argument for fsck msgs
  index-pack: test and document --strict=<msg-id>=<severity>...

3 months agoMerge branch 'cp/unit-test-prio-queue'
Junio C Hamano [Thu, 8 Feb 2024 21:20:33 +0000 (13:20 -0800)] 
Merge branch 'cp/unit-test-prio-queue'

The priority queue test has been migrated to the unit testing
framework.

* cp/unit-test-prio-queue:
  tests: move t0009-prio-queue.sh to the new unit testing framework

3 months agorefs/reftable: fix leak when copying reflog fails
Patrick Steinhardt [Thu, 8 Feb 2024 05:26:14 +0000 (06:26 +0100)] 
refs/reftable: fix leak when copying reflog fails

When copying a ref with the reftable backend we also copy the
corresponding log records. When seeking the first log record that we're
about to copy fails though we directly return from `write_copy_table()`
without doing any cleanup, leaking several allocated data structures.

Fix this by exiting via our common cleanup logic instead.

Reported-by: Jeff King <peff@peff.net> via Coverity
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoci: add jobs to test with the reftable backend
Patrick Steinhardt [Wed, 7 Feb 2024 07:20:35 +0000 (08:20 +0100)] 
ci: add jobs to test with the reftable backend

Add CI jobs for both GitHub Workflows and GitLab CI to run Git with the
new reftable backend.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agorefs: introduce reftable backend
Patrick Steinhardt [Wed, 7 Feb 2024 07:20:31 +0000 (08:20 +0100)] 
refs: introduce reftable backend

Due to scalability issues, Shawn Pearce has originally proposed a new
"reftable" format more than six years ago [1]. Initially, this new
format was implemented in JGit with promising results. Around two years
ago, we have then added the "reftable" library to the Git codebase via
a4bbd13be3 (Merge branch 'hn/reftable', 2021-12-15). With this we have
landed all the low-level code to read and write reftables. Notably
missing though was the integration of this low-level code into the Git
code base in the form of a new ref backend that ties all of this
together.

This gap is now finally closed by introducing a new "reftable" backend
into the Git codebase. This new backend promises to bring some notable
improvements to Git repositories:

  - It becomes possible to do truly atomic writes where either all refs
    are committed to disk or none are. This was not possible with the
    "files" backend because ref updates were split across multiple loose
    files.

  - The disk space required to store many refs is reduced, both compared
    to loose refs and packed-refs. This is enabled both by the reftable
    format being a binary format, which is more compact, and by prefix
    compression.

  - We can ignore filesystem-specific behaviour as ref names are not
    encoded via paths anymore. This means there is no need to handle
    case sensitivity on Windows systems or Unicode precomposition on
    macOS.

  - There is no need to rewrite the complete refdb anymore every time a
    ref is being deleted like it was the case for packed-refs. This
    means that ref deletions are now constant time instead of scaling
    linearly with the number of refs.

  - We can ignore file/directory conflicts so that it becomes possible
    to store both "refs/heads/foo" and "refs/heads/foo/bar".

  - Due to this property we can retain reflogs for deleted refs. We have
    previously been deleting reflogs together with their refs to avoid
    file/directory conflicts, which is not necessary anymore.

  - We can properly enumerate all refs. With the "files" backend it is
    not easily possible to distinguish between refs and non-refs because
    they may live side by side in the gitdir.

Not all of these improvements are realized with the current "reftable"
backend implementation. At this point, the new backend is supposed to be
a drop-in replacement for the "files" backend that is used by basically
all Git repositories nowadays. It strives for 1:1 compatibility, which
means that a user can expect the same behaviour regardless of whether
they use the "reftable" backend or the "files" backend for most of the
part.

Most notably, this means we artificially limit the capabilities of the
"reftable" backend to match the limits of the "files" backend. It is not
possible to create refs that would end up with file/directory conflicts,
we do not retain reflogs, we perform stricter-than-necessary checks.
This is done intentionally due to two main reasons:

  - It makes it significantly easier to land the "reftable" backend as
    tests behave the same. It would be tough to argue for each and every
    single test that doesn't pass with the "reftable" backend.

  - It ensures compatibility between repositories that use the "files"
    backend and repositories that use the "reftable" backend. Like this,
    hosters can migrate their repositories to use the "reftable" backend
    without causing issues for clients that use the "files" backend in
    their clones.

It is expected that these artificial limitations may eventually go away
in the long term.

Performance-wise things very much depend on the actual workload. The
following benchmarks compare the "files" and "reftable" backends in the
current version:

  - Creating N refs in separate transactions shows that the "files"
    backend is ~50% faster. This is not surprising given that creating a
    ref only requires us to create a single loose ref. The "reftable"
    backend will also perform auto compaction on updates. In real-world
    workloads we would likely also want to perform pack loose refs,
    which would likely change the picture.

        Benchmark 1: update-ref: create refs sequentially (refformat = files, refcount = 1)
          Time (mean ± σ):       2.1 ms ±   0.3 ms    [User: 0.6 ms, System: 1.7 ms]
          Range (min … max):     1.8 ms …   4.3 ms    133 runs

        Benchmark 2: update-ref: create refs sequentially (refformat = reftable, refcount = 1)
          Time (mean ± σ):       2.7 ms ±   0.1 ms    [User: 0.6 ms, System: 2.2 ms]
          Range (min … max):     2.4 ms …   2.9 ms    132 runs

        Benchmark 3: update-ref: create refs sequentially (refformat = files, refcount = 1000)
          Time (mean ± σ):      1.975 s ±  0.006 s    [User: 0.437 s, System: 1.535 s]
          Range (min … max):    1.969 s …  1.980 s    3 runs

        Benchmark 4: update-ref: create refs sequentially (refformat = reftable, refcount = 1000)
          Time (mean ± σ):      2.611 s ±  0.013 s    [User: 0.782 s, System: 1.825 s]
          Range (min … max):    2.597 s …  2.622 s    3 runs

        Benchmark 5: update-ref: create refs sequentially (refformat = files, refcount = 100000)
          Time (mean ± σ):     198.442 s ±  0.241 s    [User: 43.051 s, System: 155.250 s]
          Range (min … max):   198.189 s … 198.670 s    3 runs

        Benchmark 6: update-ref: create refs sequentially (refformat = reftable, refcount = 100000)
          Time (mean ± σ):     294.509 s ±  4.269 s    [User: 104.046 s, System: 190.326 s]
          Range (min … max):   290.223 s … 298.761 s    3 runs

  - Creating N refs in a single transaction shows that the "files"
    backend is significantly slower once we start to write many refs.
    The "reftable" backend only needs to update two files, whereas the
    "files" backend needs to write one file per ref.

        Benchmark 1: update-ref: create many refs (refformat = files, refcount = 1)
          Time (mean ± σ):       1.9 ms ±   0.1 ms    [User: 0.4 ms, System: 1.4 ms]
          Range (min … max):     1.8 ms …   2.6 ms    151 runs

        Benchmark 2: update-ref: create many refs (refformat = reftable, refcount = 1)
          Time (mean ± σ):       2.5 ms ±   0.1 ms    [User: 0.7 ms, System: 1.7 ms]
          Range (min … max):     2.4 ms …   3.4 ms    148 runs

        Benchmark 3: update-ref: create many refs (refformat = files, refcount = 1000)
          Time (mean ± σ):     152.5 ms ±   5.2 ms    [User: 19.1 ms, System: 133.1 ms]
          Range (min … max):   148.5 ms … 167.8 ms    15 runs

        Benchmark 4: update-ref: create many refs (refformat = reftable, refcount = 1000)
          Time (mean ± σ):      58.0 ms ±   2.5 ms    [User: 28.4 ms, System: 29.4 ms]
          Range (min … max):    56.3 ms …  72.9 ms    40 runs

        Benchmark 5: update-ref: create many refs (refformat = files, refcount = 1000000)
          Time (mean ± σ):     152.752 s ±  0.710 s    [User: 20.315 s, System: 131.310 s]
          Range (min … max):   152.165 s … 153.542 s    3 runs

        Benchmark 6: update-ref: create many refs (refformat = reftable, refcount = 1000000)
          Time (mean ± σ):     51.912 s ±  0.127 s    [User: 26.483 s, System: 25.424 s]
          Range (min … max):   51.769 s … 52.012 s    3 runs

  - Deleting a ref in a fully-packed repository shows that the "files"
    backend scales with the number of refs. The "reftable" backend has
    constant-time deletions.

        Benchmark 1: update-ref: delete ref (refformat = files, refcount = 1)
          Time (mean ± σ):       1.7 ms ±   0.1 ms    [User: 0.4 ms, System: 1.2 ms]
          Range (min … max):     1.6 ms …   2.1 ms    316 runs

        Benchmark 2: update-ref: delete ref (refformat = reftable, refcount = 1)
          Time (mean ± σ):       1.8 ms ±   0.1 ms    [User: 0.4 ms, System: 1.3 ms]
          Range (min … max):     1.7 ms …   2.1 ms    294 runs

        Benchmark 3: update-ref: delete ref (refformat = files, refcount = 1000)
          Time (mean ± σ):       2.0 ms ±   0.1 ms    [User: 0.5 ms, System: 1.4 ms]
          Range (min … max):     1.9 ms …   2.5 ms    287 runs

        Benchmark 4: update-ref: delete ref (refformat = reftable, refcount = 1000)
          Time (mean ± σ):       1.9 ms ±   0.1 ms    [User: 0.5 ms, System: 1.3 ms]
          Range (min … max):     1.8 ms …   2.1 ms    217 runs

        Benchmark 5: update-ref: delete ref (refformat = files, refcount = 1000000)
          Time (mean ± σ):     229.8 ms ±   7.9 ms    [User: 182.6 ms, System: 46.8 ms]
          Range (min … max):   224.6 ms … 245.2 ms    6 runs

        Benchmark 6: update-ref: delete ref (refformat = reftable, refcount = 1000000)
          Time (mean ± σ):       2.0 ms ±   0.0 ms    [User: 0.6 ms, System: 1.3 ms]
          Range (min … max):     2.0 ms …   2.1 ms    3 runs

  - Listing all refs shows no significant advantage for either of the
    backends. The "files" backend is a bit faster, but not by a
    significant margin. When repositories are not packed the "reftable"
    backend outperforms the "files" backend because the "reftable"
    backend performs auto-compaction.

        Benchmark 1: show-ref: print all refs (refformat = files, refcount = 1, packed = true)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.5 ms …   2.0 ms    1729 runs

        Benchmark 2: show-ref: print all refs (refformat = reftable, refcount = 1, packed = true)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.5 ms …   1.8 ms    1816 runs

        Benchmark 3: show-ref: print all refs (refformat = files, refcount = 1000, packed = true)
          Time (mean ± σ):       4.3 ms ±   0.1 ms    [User: 0.9 ms, System: 3.3 ms]
          Range (min … max):     4.1 ms …   4.6 ms    645 runs

        Benchmark 4: show-ref: print all refs (refformat = reftable, refcount = 1000, packed = true)
          Time (mean ± σ):       4.5 ms ±   0.2 ms    [User: 1.0 ms, System: 3.3 ms]
          Range (min … max):     4.2 ms …   5.9 ms    643 runs

        Benchmark 5: show-ref: print all refs (refformat = files, refcount = 1000000, packed = true)
          Time (mean ± σ):      2.537 s ±  0.034 s    [User: 0.488 s, System: 2.048 s]
          Range (min … max):    2.511 s …  2.627 s    10 runs

        Benchmark 6: show-ref: print all refs (refformat = reftable, refcount = 1000000, packed = true)
          Time (mean ± σ):      2.712 s ±  0.017 s    [User: 0.653 s, System: 2.059 s]
          Range (min … max):    2.692 s …  2.752 s    10 runs

        Benchmark 7: show-ref: print all refs (refformat = files, refcount = 1, packed = false)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.5 ms …   1.9 ms    1834 runs

        Benchmark 8: show-ref: print all refs (refformat = reftable, refcount = 1, packed = false)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.4 ms …   2.0 ms    1840 runs

        Benchmark 9: show-ref: print all refs (refformat = files, refcount = 1000, packed = false)
          Time (mean ± σ):      13.8 ms ±   0.2 ms    [User: 2.8 ms, System: 10.8 ms]
          Range (min … max):    13.3 ms …  14.5 ms    208 runs

        Benchmark 10: show-ref: print all refs (refformat = reftable, refcount = 1000, packed = false)
          Time (mean ± σ):       4.5 ms ±   0.2 ms    [User: 1.2 ms, System: 3.3 ms]
          Range (min … max):     4.3 ms …   6.2 ms    624 runs

        Benchmark 11: show-ref: print all refs (refformat = files, refcount = 1000000, packed = false)
          Time (mean ± σ):     12.127 s ±  0.129 s    [User: 2.675 s, System: 9.451 s]
          Range (min … max):   11.965 s … 12.370 s    10 runs

        Benchmark 12: show-ref: print all refs (refformat = reftable, refcount = 1000000, packed = false)
          Time (mean ± σ):      2.799 s ±  0.022 s    [User: 0.735 s, System: 2.063 s]
          Range (min … max):    2.769 s …  2.836 s    10 runs

  - Printing a single ref shows no real difference between the "files"
    and "reftable" backends.

        Benchmark 1: show-ref: print single ref (refformat = files, refcount = 1)
          Time (mean ± σ):       1.5 ms ±   0.1 ms    [User: 0.4 ms, System: 1.0 ms]
          Range (min … max):     1.4 ms …   1.8 ms    1779 runs

        Benchmark 2: show-ref: print single ref (refformat = reftable, refcount = 1)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.4 ms …   2.5 ms    1753 runs

        Benchmark 3: show-ref: print single ref (refformat = files, refcount = 1000)
          Time (mean ± σ):       1.5 ms ±   0.1 ms    [User: 0.3 ms, System: 1.1 ms]
          Range (min … max):     1.4 ms …   1.9 ms    1840 runs

        Benchmark 4: show-ref: print single ref (refformat = reftable, refcount = 1000)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.5 ms …   2.0 ms    1831 runs

        Benchmark 5: show-ref: print single ref (refformat = files, refcount = 1000000)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.5 ms …   2.1 ms    1848 runs

        Benchmark 6: show-ref: print single ref (refformat = reftable, refcount = 1000000)
          Time (mean ± σ):       1.6 ms ±   0.1 ms    [User: 0.4 ms, System: 1.1 ms]
          Range (min … max):     1.5 ms …   2.1 ms    1762 runs

So overall, performance depends on the usecases. Except for many
sequential writes the "reftable" backend is roughly on par or
significantly faster than the "files" backend though. Given that the
"files" backend has received 18 years of optimizations by now this can
be seen as a win. Furthermore, we can expect that the "reftable" backend
will grow faster over time when attention turns more towards
optimizations.

The complete test suite passes, except for those tests explicitly marked
to require the REFFILES prerequisite. Some tests in t0610 are marked as
failing because they depend on still-in-flight bug fixes. Tests can be
run with the new backend by setting the GIT_TEST_DEFAULT_REF_FORMAT
environment variable to "reftable".

There is a single known conceptual incompatibility with the dumb HTTP
transport. As "info/refs" SHOULD NOT contain the HEAD reference, and
because the "HEAD" file is not valid anymore, it is impossible for the
remote client to figure out the default branch without changing the
protocol. This shortcoming needs to be handled in a subsequent patch
series.

As the reftable library has already been introduced a while ago, this
commit message will not go into the details of how exactly the on-disk
format works. Please refer to our preexisting technical documentation at
Documentation/technical/reftable for this.

[1]: https://public-inbox.org/git/CAJo=hJtyof=HRy=2sLP0ng0uZ4=S-DpZ5dR1aF+VHVETKG20OQ@mail.gmail.com/

Original-idea-by: Shawn Pearce <spearce@spearce.org>
Based-on-patch-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe fourteenth batch
Junio C Hamano [Tue, 6 Feb 2024 22:31:50 +0000 (14:31 -0800)] 
The fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'cb/use-freebsd-13-2-at-cirrus-ci'
Junio C Hamano [Tue, 6 Feb 2024 22:31:22 +0000 (14:31 -0800)] 
Merge branch 'cb/use-freebsd-13-2-at-cirrus-ci'

Cirrus CI jobs started breaking because we specified version of
FreeBSD that is no longer available, which has been corrected.

* cb/use-freebsd-13-2-at-cirrus-ci:
  ci: update FreeBSD cirrus job

3 months agoMerge branch 'jc/make-libpath-template'
Junio C Hamano [Tue, 6 Feb 2024 22:31:22 +0000 (14:31 -0800)] 
Merge branch 'jc/make-libpath-template'

The Makefile often had to say "-L$(path) -R$(path)" that repeats
the path to the same library directory for link time and runtime.
A Makefile template is used to reduce such repetition.

* jc/make-libpath-template:
  Makefile: simplify output of the libpath_template
  Makefile: reduce repetitive library paths

3 months agoMerge branch 'rj/test-with-leak-check'
Junio C Hamano [Tue, 6 Feb 2024 22:31:21 +0000 (14:31 -0800)] 
Merge branch 'rj/test-with-leak-check'

More tests that are supposed to pass leak sanitizer are marked as such.

* rj/test-with-leak-check:
  t0080: mark as leak-free
  test-lib: check for TEST_PASSES_SANITIZE_LEAK
  t6113: mark as leak-free
  t5332: mark as leak-free

3 months agoMerge branch 'jc/t0091-with-unknown-git'
Junio C Hamano [Tue, 6 Feb 2024 22:31:21 +0000 (14:31 -0800)] 
Merge branch 'jc/t0091-with-unknown-git'

The test did not work when Git was built from a repository without
tags.

* jc/t0091-with-unknown-git:
  t0091: allow test in a repository without tags

3 months agoMerge branch 'js/win32-retry-pipe-write-on-enospc'
Junio C Hamano [Tue, 6 Feb 2024 22:31:21 +0000 (14:31 -0800)] 
Merge branch 'js/win32-retry-pipe-write-on-enospc'

Update to the code that writes to pipes on Windows.

* js/win32-retry-pipe-write-on-enospc:
  win32: special-case `ENOSPC` when writing to a pipe

3 months agoMerge branch 'ps/tests-with-ref-files-backend'
Junio C Hamano [Tue, 6 Feb 2024 22:31:21 +0000 (14:31 -0800)] 
Merge branch 'ps/tests-with-ref-files-backend'

Prepare existing tests on refs to work better with non-default
backends.

* ps/tests-with-ref-files-backend:
  t: mark tests regarding git-pack-refs(1) to be backend specific
  t5526: break test submodule differently
  t1419: mark test suite as files-backend specific
  t1302: make tests more robust with new extensions
  t1301: mark test for `core.sharedRepository` as reffiles specific
  t1300: make tests more robust with non-default ref backends

3 months agoMerge branch 'jc/comment-style-fixes'
Junio C Hamano [Tue, 6 Feb 2024 22:31:21 +0000 (14:31 -0800)] 
Merge branch 'jc/comment-style-fixes'

Rewrite //-comments to /* comments */ in files whose comments
prevalently use the latter.

* jc/comment-style-fixes:
  reftable/pq_test: comment style fix
  merge-ort.c: comment style fix
  builtin/worktree: comment style fixes

3 months agoMerge branch 'jk/diff-external-with-no-index'
Junio C Hamano [Tue, 6 Feb 2024 22:31:20 +0000 (14:31 -0800)] 
Merge branch 'jk/diff-external-with-no-index'

"git diff --no-index file1 file2" segfaulted while invoking the
external diff driver, which has been corrected.

* jk/diff-external-with-no-index:
  diff: handle NULL meta-info when spawning external diff

3 months agoMerge branch 'kh/maintenance-use-xdg-when-it-should'
Junio C Hamano [Tue, 6 Feb 2024 22:31:20 +0000 (14:31 -0800)] 
Merge branch 'kh/maintenance-use-xdg-when-it-should'

Comment fix.

* kh/maintenance-use-xdg-when-it-should:
  config: add back code comment

3 months agoMerge branch 'tb/pack-bitmap-drop-unused-struct-member'
Junio C Hamano [Tue, 6 Feb 2024 22:31:20 +0000 (14:31 -0800)] 
Merge branch 'tb/pack-bitmap-drop-unused-struct-member'

Code clean-up.

* tb/pack-bitmap-drop-unused-struct-member:
  pack-bitmap: drop unused `reuse_objects`

3 months agoMerge branch 'jt/p4-spell-re-with-raw-string'
Junio C Hamano [Tue, 6 Feb 2024 22:31:20 +0000 (14:31 -0800)] 
Merge branch 'jt/p4-spell-re-with-raw-string'

"git p4" update to squelch warnings from Python.

* jt/p4-spell-re-with-raw-string:
  git-p4: use raw string literals for regular expressions

3 months agoMerge branch 'ps/reftable-compacted-tables-permission-fix'
Junio C Hamano [Tue, 6 Feb 2024 22:31:20 +0000 (14:31 -0800)] 
Merge branch 'ps/reftable-compacted-tables-permission-fix'

Reftable bugfix.

* ps/reftable-compacted-tables-permission-fix:
  reftable/stack: adjust permissions of compacted tables

3 months agoMerge branch 'jc/reftable-core-fsync'
Junio C Hamano [Tue, 6 Feb 2024 22:31:20 +0000 (14:31 -0800)] 
Merge branch 'jc/reftable-core-fsync'

The write codepath for the reftable data learned to honor
core.fsync configuration.

* jc/reftable-core-fsync:
  reftable/stack: fsync "tables.list" during compaction
  reftable: honor core.fsync

3 months agot/Makefile: say the default target upfront
Junio C Hamano [Sat, 3 Feb 2024 01:32:42 +0000 (17:32 -0800)] 
t/Makefile: say the default target upfront

Similar to how 2731d048 (Makefile: say the default target upfront.,
2005-12-01) added the default target to the very beginning of the
main Makefile to prevent a random rule that happens to be defined
first in an included makefile fragments from becoming the default
target, protect this Makefile the same way.

This started to matter as we started to include config.mak.uname
and that included makefile fragment does more than defining Make
macros, unfortunately.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe thirteenth batch
Junio C Hamano [Fri, 2 Feb 2024 18:33:01 +0000 (10:33 -0800)] 
The thirteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'zf/subtree-split-fix'
Junio C Hamano [Fri, 2 Feb 2024 19:31:51 +0000 (11:31 -0800)] 
Merge branch 'zf/subtree-split-fix'

"git subtree" (in contrib/) update.

* zf/subtree-split-fix:
  subtree: fix split processing with multiple subtrees present

3 months agoMerge branch 'jc/ls-files-doc-update'
Junio C Hamano [Fri, 2 Feb 2024 19:31:51 +0000 (11:31 -0800)] 
Merge branch 'jc/ls-files-doc-update'

The documentation for the --exclude-per-directory option marked it
as deprecated, which confused readers into thinking there may be a
plan to remove it in the future, which was not our intention.

* jc/ls-files-doc-update:
  ls-files: avoid the verb "deprecate" for individual options

3 months agoMerge branch 'jk/fetch-auto-tag-following-fix'
Junio C Hamano [Fri, 2 Feb 2024 19:31:51 +0000 (11:31 -0800)] 
Merge branch 'jk/fetch-auto-tag-following-fix'

Fetching via protocol v0 over Smart HTTP transport sometimes failed
to correctly auto-follow tags.

* jk/fetch-auto-tag-following-fix:
  transport-helper: re-examine object dir after fetching

3 months agoMerge branch 'jc/coc-whitespace-fix'
Junio C Hamano [Fri, 2 Feb 2024 19:31:51 +0000 (11:31 -0800)] 
Merge branch 'jc/coc-whitespace-fix'

Docfix.

* jc/coc-whitespace-fix:
  CoC: whitespace fix

3 months agoMerge branch 'ad/custom-merge-placeholder-for-symbolic-pathnames'
Junio C Hamano [Fri, 2 Feb 2024 19:31:50 +0000 (11:31 -0800)] 
Merge branch 'ad/custom-merge-placeholder-for-symbolic-pathnames'

The labels on conflict markers for the common ancestor, our version,
and the other version are available to custom 3-way merge driver
via %S, %X, and %Y placeholders.

* ad/custom-merge-placeholder-for-symbolic-pathnames:
  merge-ll: expose revision names to custom drivers

3 months agoMerge branch 'jc/reffiles-tests'
Junio C Hamano [Fri, 2 Feb 2024 19:31:50 +0000 (11:31 -0800)] 
Merge branch 'jc/reffiles-tests'

Tests on ref API are moved around to prepare for reftable.

* jc/reffiles-tests:
  t5312: move reffiles specific tests to t0601
  t4202: move reffiles specific tests to t0600
  t3903: make drop stash test ref backend agnostic
  t1503: move reffiles specific tests to t0600
  t1415: move reffiles specific tests to t0601
  t1410: move reffiles specific tests to t0600
  t1406: move reffiles specific tests to t0600
  t1405: move reffiles specific tests to t0601
  t1404: move reffiles specific tests to t0600
  t1414: convert test to use Git commands instead of writing refs manually
  remove REFFILES prerequisite for some tests in t1405 and t2017
  t3210: move to t0601

3 months agoMerge branch 'pb/complete-log-more'
Junio C Hamano [Fri, 2 Feb 2024 19:31:50 +0000 (11:31 -0800)] 
Merge branch 'pb/complete-log-more'

The completion script (in contrib/) learned more options that can
be used with "git log".

* pb/complete-log-more:
  completion: complete missing 'git log' options
  completion: complete --encoding
  completion: complete --patch-with-raw
  completion: complete missing rev-list options

3 months agosparse-index: pass string length to index_file_exists()
Jeff Hostetler [Fri, 2 Feb 2024 18:04:54 +0000 (18:04 +0000)] 
sparse-index: pass string length to index_file_exists()

The call to index_file_exists() in the loop in expand_to_path() passes
the wrong string length.  Let's fix that.

The loop in expand_to_path() searches the name-hash for each
sub-directory prefix in the provided pathname. That is, by searching
for "dir1/" then "dir1/dir2/" then "dir1/dir2/dir3/" and so on until
it finds a cache-entry representing a sparse directory.

The code creates "strbuf path_mutable" to contain the working pathname
and modifies the buffer in-place by temporarily replacing the character
following each successive "/" with NUL for the duration of the call to
index_file_exists().

It does not update the strbuf.len during this substitution.

Pass the patched length of the prefix path instead.

Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoimap-send: add missing "strbuf.h" include under NO_CURL
Philippe Blain [Fri, 2 Feb 2024 00:18:33 +0000 (00:18 +0000)] 
imap-send: add missing "strbuf.h" include under NO_CURL

Building with NO_CURL is currently broken since imap-send.c uses things
defined in "strbuf.h" wihtout including it.

The inclusion of that header was removed in eea0e59ffb (treewide: remove
unnecessary includes in source files, 2023-12-23), which failed to
notice that "strbuf.h" was transitively included in imap-send.c via
"http.h", but only if USE_CURL_FOR_IMAP_SEND is defined. Add back the
missing include. Note that it was explicitely added in 3307f7dde2
(imap-send: include strbuf.h, 2023-05-17) after a similar breakage in
ba3d1c73da (treewide: remove unnecessary cache.h includes, 2023-02-24) -
see the thread starting at [1].

It can be verified by inspection that this is the only case where a
header we include is dependent on a Makefile knob in the files modified
in eea0e59ffb.

[1] https://lore.kernel.org/git/20230517070632.71884-1-list@eworm.de/

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoindex-pack: --fsck-objects to take an optional argument for fsck msgs
John Cai [Thu, 1 Feb 2024 01:38:02 +0000 (01:38 +0000)] 
index-pack: --fsck-objects to take an optional argument for fsck msgs

git-index-pack has a --strict option that can take an optional argument
to provide a list of fsck issues to change their severity.
--fsck-objects does not have such a utility, which would be useful if
one would like to be more lenient or strict on data integrity in a
repository.

Like --strict, allow --fsck-objects to also take a list of fsck msgs to
change the severity.

Remove the "For internal use only" note for --fsck-objects, and document
the option. This won't often be used by the normal end user, but it
turns out it is useful for Git forges like GitLab.

Reviewed-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoindex-pack: test and document --strict=<msg-id>=<severity>...
John Cai [Thu, 1 Feb 2024 01:38:01 +0000 (01:38 +0000)] 
index-pack: test and document --strict=<msg-id>=<severity>...

5d477a334a (fsck (receive-pack): allow demoting errors to warnings,
2015-06-22) allowed a list of fsck msg to downgrade to be passed to
--strict. However this is a hidden argument that was not documented nor
tested. Though it is true that most users would not call this option
directly, (nor use index-pack for that matter) it is still useful to
document and test this feature.

Reviewed-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMakefile: simplify output of the libpath_template
Junio C Hamano [Wed, 31 Jan 2024 17:42:20 +0000 (09:42 -0800)] 
Makefile: simplify output of the libpath_template

If a platform lacks the support to specify the dynamic library path,
there is no suitable value to give to the CC_LD_DYNPATH variable.
Allow them to be set to an empty string to signal that they do not
need to add the usual -Wl,-rpath, or -R or whatever option followed
by a directory name.  This way,

    $(call libpath_template,$(SOMELIBDIR))

would expand to just a single mention of that directory, i.e.

    -L$(SOMELIBDIR)

when CC_LD_DYNPATH is set to an empty string (or a "-L", which
would have repeated the same "-L$(SOMELIBDIR)" twice without any
ill effect).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoci: update FreeBSD cirrus job
Carlo Marcelo Arenas Belón [Wed, 31 Jan 2024 19:13:25 +0000 (11:13 -0800)] 
ci: update FreeBSD cirrus job

FreeBSD 12 is EOL and no longer available, causing errors in this job.

Upgrade to 13.2, which is the next oldest release with support and that
should keep it for at least another 4 months.

This will be upgraded again once 13.3 is released to avoid further
surprises.

The original report [*] of this problem mentions an error message
"Not enough compute credits to prioritize tasks!".  It seems to be
just a reminder that the credit allocate for the Free Tier by Cirrus
is all used up and which might result in additional delays getting a
result.

[*] https://lore.kernel.org/git/d2d7da84-e2a3-a7b2-3f95-c8d53ad4dd5f@gmx.de/

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot/Makefile: get UNIT_TESTS list from C sources
Jeff King [Tue, 30 Jan 2024 05:40:37 +0000 (00:40 -0500)] 
t/Makefile: get UNIT_TESTS list from C sources

We decide on the set of unit tests to run by asking make to expand the
wildcard "t/unit-tests/bin/*". One unfortunate outcome of this is that
we'll run anything in that directory, even if it is leftover cruft from
a previous build. This isn't _quite_ as bad as it sounds, since in
theory the unit tests executables are self-contained (so if they passed
before, they'll pass even though they now have nothing to do with the
checked out version of Git). But at the very least it's wasteful, and if
they _do_ fail it can be quite confusing to understand why they are
being run at all.

This wildcarding presumably came from our handling of the regular
shell-script tests, which use $(wildcard t[0-9][0-9][0-9][0-9]-*.sh).
But the difference there is that those are actual tracked files. So if
you checkout a different commit, they'll go away. Whereas the contents
of unit-tests/bin are ignored (so not only do they stick around, but you
are not even warned of the stale files via "git status").

This patch fixes the situation by looking for the actual unit-test
source files and then massaging those names into the final executable
names. This has two additional benefits:

  1. It will notice if we failed to build one or more unit-tests for
     some reason (whereas the current code just runs whatever made it to
     the bin/ directory).

  2. The wildcard should avoid other build cruft, like the pdb files we
     worked around in 0df903d402 (unit-tests: do not mistake `.pdb`
     files for being executable, 2023-09-25).

Our new wildcard does make an assumption that unit tests are built from
C sources. It would be a bit cleaner if we consulted UNIT_TEST_PROGRAMS
from the top-level Makefile. But doing so is tricky unless we reorganize
that Makefile to split the source file lists into include-able subfiles.
That might be worth doing in general, but in the meantime, the
assumptions made by the wildcard here seems reasonable.

Note that we do need to include config.mak.uname either way, though, as
we need the value of $(X) to compute the correct executable names (which
would be true even if we had access to the top-level's UNIT_TEST_PROGRAMS
variable).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMakefile: reduce repetitive library paths
Junio C Hamano [Wed, 31 Jan 2024 17:42:19 +0000 (09:42 -0800)] 
Makefile: reduce repetitive library paths

When we take a library package we depend on (e.g., LIBPCRE) from a
directory other than the default location of the system, we add the
same directory twice on the linker command like, like so:

  EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)

Introduce a template "libpath_template" that takes the path to the
directory, which can be used like so:

  EXTLIBS += $(call libpath_template,$(LIBPCREDIR)/$(lib))

and expand it into the "-L$(DIR) $(CC_LD_DYNPATH)$(DIR)" form.
Hopefully we can reduce the chance of typoes this way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agowin32: special-case `ENOSPC` when writing to a pipe
Johannes Schindelin [Tue, 30 Jan 2024 21:36:59 +0000 (21:36 +0000)] 
win32: special-case `ENOSPC` when writing to a pipe

Since c6d3cce6f3c4 (pipe_command(): handle ENOSPC when writing to a
pipe, 2022-08-17), one `write()` call that results in an `errno` value
`ENOSPC` (which typically indicates out of disk space, which makes
little sense in the context of a pipe) is treated the same as `EAGAIN`.

However, contrary to expectations, as diagnosed in
https://github.com/python/cpython/issues/101881#issuecomment-1428667015,
when writing to a non-blocking pipe on Windows, an `errno` value of
`ENOSPC` means something else: the write _fails_. Completely. Because
more data was provided than the internal pipe buffer can handle.
Somewhat surprising, considering that `write()` is allowed to write less
than the specified amount, e.g. by writing only as much as fits in that
buffer. But it doesn't, it writes no byte at all in that instance.

Let's handle this by manually detecting when an `ENOSPC` indicates that
a pipe's buffer is smaller than what needs to be written, and re-try
using the pipe's buffer size as `size` parameter.

It would be plausible to try writing the entire buffer in a loop,
feeding pipe buffer-sized chunks, but experiments show that trying to
write more than one buffer-sized chunk right after that will immediately
fail because the buffer is unlikely to be drained as fast as `write()`
could write again. And the whole point of a non-blocking pipe is to be
non-blocking.

Which means that the logic that determines the pipe's buffer size
unfortunately has to be run potentially many times when writing large
amounts of data to a non-blocking pipe, as there is no elegant way to
cache that information between `write()` calls. It's the best we can do,
though, so it has to be good enough.

This fix is required to let t3701.60 (handle very large filtered diff)
pass with the MSYS2 runtime provided by the MSYS2 project: Without this
patch, the failed write would result in an infinite loop. This patch is
not required with Git for Windows' variant of the MSYS2 runtime only
because Git for Windows added an ugly work-around specifically to avoid
a hang in that test case.

The diff is slightly chatty because it extends an already-existing
conditional that special-cases a _different_ `errno` value for pipes,
and because this patch needs to account for the fact that
`_get_osfhandle()` potentially overwrites `errno`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>