]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 weeks agofast-import: add mode to sign commits with invalid signatures
Justin Tobler [Fri, 13 Mar 2026 01:39:38 +0000 (20:39 -0500)] 
fast-import: add mode to sign commits with invalid signatures

With git-fast-import(1), handling of signed commits is controlled via
the `--signed-commits=<mode>` option. When an invalid signature is
encountered, a user may want the option to sign the commit again as
opposed to just stripping the signature. To facilitate this, introduce a
"sign-if-invalid" mode for the `--signed-commits` option. Optionally, a
key ID may be explicitly provided in the form
`sign-if-invalid[=<keyid>]` to specify which signing key should be used
when signing invalid commit signatures.

Note that to properly support interoperability mode when signing commit
signatures, the commit buffer must be created in both the repository and
compatability object formats to generate the appropriate signatures
accordingly. As currently implemented, the commit buffer for the
compatability object format is not reconstructed and thus signing
commits in interoperability mode is not yet supported. Support may be
added in the future.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 weeks agogpg-interface: allow sign_buffer() to use default signing key
Justin Tobler [Fri, 13 Mar 2026 01:39:37 +0000 (20:39 -0500)] 
gpg-interface: allow sign_buffer() to use default signing key

The `sign_commit_to_strbuf()` helper in "commit.c" provides fallback
logic to get the default configured signing key when a key is not
provided and handles generating the commit signature accordingly. This
signing operation is not really specific to commits as any arbitrary
buffer can be signed. Also, in a subsequent commit, this same logic is
reused by git-fast-import(1) when signing commits with invalid
signatures.

Remove the `sign_commit_to_strbuf()` helper from "commit.c" and extend
`sign_buffer()` in "gpg-interface.c" to support using the default key as
a fallback when the `SIGN_BUFFER_USE_DEFAULT_KEY` flag is provided. Call
sites are updated accordingly.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 weeks agocommit: remove unused forward declaration
Justin Tobler [Fri, 13 Mar 2026 01:39:36 +0000 (20:39 -0500)] 
commit: remove unused forward declaration

In 6206089cbd (commit: write commits for both hashes, 2023-10-01),
`sign_with_header()` was removed, but its forward declaration in
"commit.h" was left. Remove the unused declaration.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 weeks agoThe 13th batch
Junio C Hamano [Mon, 9 Mar 2026 21:35:46 +0000 (14:35 -0700)] 
The 13th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 weeks agoMerge branch 'jk/repo-structure-cleanup'
Junio C Hamano [Mon, 9 Mar 2026 21:36:56 +0000 (14:36 -0700)] 
Merge branch 'jk/repo-structure-cleanup'

Code clean-up.

* jk/repo-structure-cleanup:
  repo: remove unnecessary variable shadow

4 weeks agoMerge branch 'lp/diff-stat-utf8-display-width-fix'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'lp/diff-stat-utf8-display-width-fix'

"git log --graph --stat" did not count the display width of colored
graph part of its own output correctly, which has been corrected.

* lp/diff-stat-utf8-display-width-fix:
  t4052: test for diffstat width when prefix contains ANSI escape codes
  diff: handle ANSI escape codes in prefix when calculating diffstat width

4 weeks agoMerge branch 'cs/add-skip-submodule-ignore-all'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'cs/add-skip-submodule-ignore-all'

"git add <submodule>" has been taught to honor
submodule.<name>.ignore that is set to "all" (and requires "git add
-f" to override it).

* cs/add-skip-submodule-ignore-all:
  Documentation: update add --force option + ignore=all config
  tests: fix existing tests when add an ignore=all submodule
  tests: t2206-add-submodule-ignored: ignore=all and add --force tests
  read-cache: submodule add need --force given ignore=all configuration
  read-cache: update add_files_to_cache take param ignored_too

4 weeks agoMerge branch 'ps/refs-for-each'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'ps/refs-for-each'

Code refactoring around refs-for-each-* API functions.

* ps/refs-for-each:
  refs: replace `refs_for_each_fullref_in()`
  refs: replace `refs_for_each_namespaced_ref()`
  refs: replace `refs_for_each_glob_ref()`
  refs: replace `refs_for_each_glob_ref_in()`
  refs: replace `refs_for_each_rawref_in()`
  refs: replace `refs_for_each_rawref()`
  refs: replace `refs_for_each_ref_in()`
  refs: improve verification for-each-ref options
  refs: generalize `refs_for_each_fullref_in_prefixes()`
  refs: generalize `refs_for_each_namespaced_ref()`
  refs: speed up `refs_for_each_glob_ref_in()`
  refs: introduce `refs_for_each_ref_ext`
  refs: rename `each_ref_fn`
  refs: rename `do_for_each_ref_flags`
  refs: move `do_for_each_ref_flags` further up
  refs: move `refs_head_ref_namespaced()`
  refs: remove unused `refs_for_each_include_root_ref()`

4 weeks agoMerge branch 'ar/run-command-hook-take-2'
Junio C Hamano [Mon, 9 Mar 2026 21:36:55 +0000 (14:36 -0700)] 
Merge branch 'ar/run-command-hook-take-2'

Use the hook API to replace ad-hoc invocation of hook scripts via
the run_command() API.

* ar/run-command-hook-take-2:
  builtin/receive-pack: avoid spinning no-op sideband async threads
  receive-pack: convert receive hooks to hook API
  receive-pack: convert update hooks to new API
  run-command: poll child input in addition to output
  hook: add jobs option
  reference-transaction: use hook API instead of run-command
  transport: convert pre-push to hook API
  hook: allow separate std[out|err] streams
  hook: convert 'post-rewrite' hook in sequencer.c to hook API
  hook: provide stdin via callback
  run-command: add stdin callback for parallelization
  run-command: add helper for pp child states
  t1800: add hook output stream tests

4 weeks ago.mailmap: update email address for Tian Yuchen
Tian Yuchen [Sun, 8 Mar 2026 04:33:44 +0000 (12:33 +0800)] 
.mailmap: update email address for Tian Yuchen

Map my old Gmail address to my new custom address in .mailmap.

Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoThe 12th batch
Junio C Hamano [Thu, 5 Mar 2026 18:04:35 +0000 (10:04 -0800)] 
The 12th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoMerge branch 'ps/fsck-stream-from-the-right-object-instance'
Junio C Hamano [Thu, 5 Mar 2026 18:04:49 +0000 (10:04 -0800)] 
Merge branch 'ps/fsck-stream-from-the-right-object-instance'

"fsck" iterates over packfiles and its access to pack data caused
the list to be permuted, which caused it to loop forever; the code
to access pack data by "fsck" has been updated to avoid this.

* ps/fsck-stream-from-the-right-object-instance:
  pack-check: fix verification of large objects
  packfile: expose function to read object stream for an offset
  object-file: adapt `stream_object_signature()` to take a stream
  t/helper: improve "genrandom" test helper

5 weeks agoMerge branch 'ob/core-attributesfile-in-repository'
Junio C Hamano [Thu, 5 Mar 2026 18:04:48 +0000 (10:04 -0800)] 
Merge branch 'ob/core-attributesfile-in-repository'

The core.attributesfile is intended to be set per repository, but
were kept track of by a single global variable in-core, which has
been corrected by moving it to per-repository data structure.

* ob/core-attributesfile-in-repository:
  environment: move "branch.autoSetupMerge" into `struct repo_config_values`
  environment: stop using core.sparseCheckout globally
  environment: stop storing `core.attributesFile` globally

5 weeks agoMerge branch 'pt/t7527-flake-workaround'
Junio C Hamano [Thu, 5 Mar 2026 18:04:48 +0000 (10:04 -0800)] 
Merge branch 'pt/t7527-flake-workaround'

Test fixup.

* pt/t7527-flake-workaround:
  t7527: fix flaky fsmonitor event tests with retry logic

5 weeks agoThe 11th batch
Junio C Hamano [Wed, 4 Mar 2026 18:50:48 +0000 (10:50 -0800)] 
The 11th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoMerge branch 'cx/fetch-display-ubfix'
Junio C Hamano [Wed, 4 Mar 2026 18:53:02 +0000 (10:53 -0800)] 
Merge branch 'cx/fetch-display-ubfix'

Undefined-behaviour fix in "git fetch".

* cx/fetch-display-ubfix:
  fetch: fix wrong evaluation order in URL trailing-slash trimming

5 weeks agoMerge branch 'ds/config-list-with-type'
Junio C Hamano [Wed, 4 Mar 2026 18:53:02 +0000 (10:53 -0800)] 
Merge branch 'ds/config-list-with-type'

"git config list" is taught to show the values interpreted for
specific type with "--type=<X>" option.

* ds/config-list-with-type:
  config: use an enum for type
  config: restructure format_config()
  config: format colors quietly
  color: add color_parse_quietly()
  config: format expiry dates quietly
  config: format paths gently
  config: format bools or strings in helper
  config: format bools or ints gently
  config: format bools gently
  config: format int64s gently
  config: make 'git config list --type=<X>' work
  config: add 'gently' parameter to format_config()
  config: move show_all_config()

5 weeks agoMerge branch 'en/merge-ort-almost-wo-the-repository'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'en/merge-ort-almost-wo-the-repository'

Mark the marge-ort codebase to prevent more uses of the_repository
from getting added.

* en/merge-ort-almost-wo-the-repository:
  replay: prevent the_repository from coming back
  merge-ort: prevent the_repository from coming back
  merge-ort: replace the_hash_algo with opt->repo->hash_algo
  merge-ort: replace the_repository with opt->repo
  merge-ort: pass repository to write_tree()
  merge,diff: remove the_repository check before prefetching blobs

5 weeks agoMerge branch 'lo/repo-leftover-bits'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'lo/repo-leftover-bits'

Clean-up the code around "git repo info" command.

* lo/repo-leftover-bits:
  Documentation/git-repo: capitalize format descriptions
  Documentation/git-repo: replace 'NUL' with '_NUL_'
  t1901: adjust nul format output instead of expected value
  t1900: rename t1900-repo to t1900-repo-info
  repo: rename struct field to repo_info_field
  repo: replace get_value_fn_for_key by get_repo_info_field
  repo: rename repo_info_fields to repo_info_field
  CodingGuidelines: instruct to name arrays in singular

5 weeks agoMerge branch 'ps/maintenance-geometric-default'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'ps/maintenance-geometric-default'

"git maintenance" starts using the "geometric" strategy by default.

* ps/maintenance-geometric-default:
  builtin/maintenance: use "geometric" strategy by default
  t7900: prepare for switch of the default strategy
  t6500: explicitly use "gc" strategy
  t5510: explicitly use "gc" strategy
  t5400: explicitly use "gc" strategy
  t34xx: don't expire reflogs where it matters
  t: disable maintenance where we verify object database structure
  t: fix races caused by background maintenance

5 weeks agoMerge branch 'jr/apply-directory-normalize'
Junio C Hamano [Wed, 4 Mar 2026 18:53:01 +0000 (10:53 -0800)] 
Merge branch 'jr/apply-directory-normalize'

"git apply --directory=./un/../normalized/path" now normalizes the
given path before using it.

* jr/apply-directory-normalize:
  apply: normalize path in --directory argument

5 weeks agoMerge branch 'sp/tree-diff-wo-the-repository'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'sp/tree-diff-wo-the-repository'

The last uses of the_repository in "tree-diff.c" have been
eradicated.

* sp/tree-diff-wo-the-repository:
  tree-diff: remove the usage of the_hash_algo global

5 weeks agoMerge branch 'pw/no-more-NULL-means-current-worktree'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'pw/no-more-NULL-means-current-worktree'

API clean-up for the worktree subsystem.

* pw/no-more-NULL-means-current-worktree:
  path: remove repository argument from worktree_git_path()
  wt-status: avoid passing NULL worktree

5 weeks agoMerge branch 'bk/mailmap-wo-the-repository'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'bk/mailmap-wo-the-repository'

Wean the mailmap code off of the_repository dependency.

* bk/mailmap-wo-the-repository:
  mailmap: drop global config variables
  mailmap: stop using the_repository

5 weeks agoMerge branch 'dk/meson-regen-config-list'
Junio C Hamano [Wed, 4 Mar 2026 18:53:00 +0000 (10:53 -0800)] 
Merge branch 'dk/meson-regen-config-list'

Fix dependency screw-up in meson-based builds.

* dk/meson-regen-config-list:
  build: regenerate config-list.h when Documentation changes

5 weeks agoMerge branch 'rr/gitweb-mobile'
Junio C Hamano [Wed, 4 Mar 2026 18:52:59 +0000 (10:52 -0800)] 
Merge branch 'rr/gitweb-mobile'

"gitweb" has been taught to be mobile friendly.

* rr/gitweb-mobile:
  gitweb: let page header grow on mobile for long wrapped project names
  gitweb: fix mobile footer overflow by wrapping text and clearing floats
  gitweb: fix mobile page overflow across log/commit/blob/diff views
  gitweb: prevent project search bar from overflowing on mobile
  gitweb: add viewport meta tag for mobile devices

5 weeks agoMerge branch 'sp/shallow-deepen-relative-fix'
Junio C Hamano [Wed, 4 Mar 2026 18:52:59 +0000 (10:52 -0800)] 
Merge branch 'sp/shallow-deepen-relative-fix'

"git fetch --deepen" that tries to go beyond merged branch used to
get confused where the updated shallow points are, which has been
corrected.

* sp/shallow-deepen-relative-fix:
  shallow: handling fetch relative-deepen
  shallow: free local object_array allocations

5 weeks agoMerge branch 'kn/osxkeychain-buildfix'
Junio C Hamano [Wed, 4 Mar 2026 18:52:59 +0000 (10:52 -0800)] 
Merge branch 'kn/osxkeychain-buildfix'

Simplify build procedure for oxskeychain (in contrib/).

* kn/osxkeychain-buildfix:
  osxkeychain: define build targets in the top-level Makefile.

5 weeks agoMerge branch 'kn/ref-location'
Junio C Hamano [Wed, 4 Mar 2026 18:52:58 +0000 (10:52 -0800)] 
Merge branch 'kn/ref-location'

Allow the directory in which reference backends store their data to
be specified.

* kn/ref-location:
  refs: add GIT_REFERENCE_BACKEND to specify reference backend
  refs: allow reference location in refstorage config
  refs: receive and use the reference storage payload
  refs: move out stub modification to generic layer
  refs: extract out `refs_create_refdir_stubs()`
  setup: don't modify repo in `create_reference_database()`

5 weeks agoThe 10th batch
Junio C Hamano [Tue, 3 Mar 2026 19:08:01 +0000 (11:08 -0800)] 
The 10th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoMerge branch 'hy/diff-lazy-fetch-with-break-fix'
Junio C Hamano [Tue, 3 Mar 2026 19:08:13 +0000 (11:08 -0800)] 
Merge branch 'hy/diff-lazy-fetch-with-break-fix'

A prefetch call can be triggered to access a stale diff_queue entry
after diffcore-break breaks a filepair into two and freed the
original entry that is no longer used, leading to a segfault, which
has been corrected.

* hy/diff-lazy-fetch-with-break-fix:
  diffcore-break: avoid segfault with freed entries

5 weeks agoMerge branch 'aa/add-p-no-auto-advance'
Junio C Hamano [Tue, 3 Mar 2026 19:08:13 +0000 (11:08 -0800)] 
Merge branch 'aa/add-p-no-auto-advance'

"git add -p" learned a new mode that allows the user to revisit a
file that was already dealt with.

* aa/add-p-no-auto-advance:
  add-patch: allow interfile navigation when selecting hunks
  add-patch: allow all-or-none application of patches
  add-patch: modify patch_update_file() signature
  interactive -p: add new `--auto-advance` flag

5 weeks agoMerge branch 'lg/t2004-test-path-is-helpers'
Junio C Hamano [Tue, 3 Mar 2026 19:08:13 +0000 (11:08 -0800)] 
Merge branch 'lg/t2004-test-path-is-helpers'

Test code clean-up.

* lg/t2004-test-path-is-helpers:
  t2004: use test_path_is_file instead of test -f

5 weeks agoMerge branch 'ps/simplify-normalize-path-copy-len'
Junio C Hamano [Tue, 3 Mar 2026 19:08:12 +0000 (11:08 -0800)] 
Merge branch 'ps/simplify-normalize-path-copy-len'

Code clean-up.

* ps/simplify-normalize-path-copy-len:
  path: factor out skip_slashes() in normalize_path_copy_len()

5 weeks agoMerge branch 'sc/pack-redundant-leakfix'
Junio C Hamano [Tue, 3 Mar 2026 19:08:12 +0000 (11:08 -0800)] 
Merge branch 'sc/pack-redundant-leakfix'

Leakfix.

* sc/pack-redundant-leakfix:
  pack-redundant: fix memory leak when open_pack_index() fails

5 weeks agoMerge branch 'cs/subtree-split-fixes'
Junio C Hamano [Tue, 3 Mar 2026 19:08:12 +0000 (11:08 -0800)] 
Merge branch 'cs/subtree-split-fixes'

An earlier attempt to optimize "git subtree" discarded too much
relevant histories, which has been corrected.

* cs/subtree-split-fixes:
  contrib/subtree: process out-of-prefix subtrees
  contrib/subtree: test history depth
  contrib/subtree: capture additional test-cases

5 weeks agoThe 9th batch
Junio C Hamano [Tue, 3 Mar 2026 00:05:51 +0000 (16:05 -0800)] 
The 9th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoMerge branch 'jt/object-file-use-container-of'
Junio C Hamano [Tue, 3 Mar 2026 01:06:53 +0000 (17:06 -0800)] 
Merge branch 'jt/object-file-use-container-of'

Code clean-up.

* jt/object-file-use-container-of:
  object-file.c: avoid container_of() of a NULL container
  object-file: use `container_of()` to convert from base types

5 weeks agoMerge branch 'ps/receive-pack-shallow-optim'
Junio C Hamano [Tue, 3 Mar 2026 01:06:53 +0000 (17:06 -0800)] 
Merge branch 'ps/receive-pack-shallow-optim'

The code to accept shallow "git push" has been optimized.

* ps/receive-pack-shallow-optim:
  commit: use commit graph in `lookup_commit_reference_gently()`
  commit: make `repo_parse_commit_no_graph()` more robust
  commit: avoid parsing non-commits in `lookup_commit_reference_gently()`

5 weeks agoMerge branch 'kh/doc-patch-id-4'
Junio C Hamano [Tue, 3 Mar 2026 01:06:53 +0000 (17:06 -0800)] 
Merge branch 'kh/doc-patch-id-4'

Doc update.

* kh/doc-patch-id-4:
  doc: patch-id: see also git-cherry(1)
  doc: patch-id: add script example
  doc: patch-id: emphasize multi-patch processing

5 weeks agoMerge branch 'ps/meson-gitk-git-gui'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'ps/meson-gitk-git-gui'

Plumb gitk/git-gui build and install procedure in meson based
builds.

* ps/meson-gitk-git-gui:
  meson: wire up gitk and git-gui

5 weeks agoMerge branch 'pw/meson-doc-mergetool'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'pw/meson-doc-mergetool'

Update build precedure for mergetool documentation in meson-based builds.

* pw/meson-doc-mergetool:
  meson: fix building mergetool docs

5 weeks agoMerge branch 'kh/doc-am-xref'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'kh/doc-am-xref'

Doc update.

* kh/doc-am-xref:
  doc: am: fill out hook discussion
  doc: am: add missing config am.messageId
  doc: am: say that --message-id adds a trailer
  doc: am: normalize git(1) command links

5 weeks agoMerge branch 'ps/object-info-bits-cleanup'
Junio C Hamano [Tue, 3 Mar 2026 01:06:52 +0000 (17:06 -0800)] 
Merge branch 'ps/object-info-bits-cleanup'

A couple of bugs in use of flag bits around odb API has been
corrected, and the flag bits reordered.

* ps/object-info-bits-cleanup:
  odb: convert `odb_has_object()` flags into an enum
  odb: convert object info flags into an enum
  odb: drop gaps in object info flag values
  builtin/fsck: fix flags passed to `odb_has_object()`
  builtin/backfill: fix flags passed to `odb_has_object()`

5 weeks agoMerge branch 'ag/http-netrc-tests'
Junio C Hamano [Tue, 3 Mar 2026 01:06:51 +0000 (17:06 -0800)] 
Merge branch 'ag/http-netrc-tests'

Additional tests were introduced to see the interaction with netrc
auth with auth failure on the http transport.

* ag/http-netrc-tests:
  t5550: add netrc tests for http 401/403

5 weeks agoMerge branch 'ty/symlinks-use-unsigned-for-bitset'
Junio C Hamano [Tue, 3 Mar 2026 01:06:51 +0000 (17:06 -0800)] 
Merge branch 'ty/symlinks-use-unsigned-for-bitset'

Code clean-up.

* ty/symlinks-use-unsigned-for-bitset:
  symlinks: use unsigned int for flags

5 weeks agoMerge branch 'ps/validate-prefix-in-subtree-split'
Junio C Hamano [Tue, 3 Mar 2026 01:06:51 +0000 (17:06 -0800)] 
Merge branch 'ps/validate-prefix-in-subtree-split'

"git subtree split --prefix=P <commit>" now checks the prefix P
against the tree of the (potentially quite different from the
current working tree) given commit.

* ps/validate-prefix-in-subtree-split:
  subtree: validate --prefix against commit in split

5 weeks agoMerge branch 'uk/signature-is-good-after-key-expires'
Junio C Hamano [Tue, 3 Mar 2026 01:06:50 +0000 (17:06 -0800)] 
Merge branch 'uk/signature-is-good-after-key-expires'

A signature on a commit that was GPG signed long time ago ought to
be still valid after the key that was used to sign it has expired,
but we showed them in alarming red.

* uk/signature-is-good-after-key-expires:
  gpg-interface: signatures by expired keys are fine

5 weeks agoMerge branch 'ps/odb-for-each-object'
Junio C Hamano [Tue, 3 Mar 2026 01:06:50 +0000 (17:06 -0800)] 
Merge branch 'ps/odb-for-each-object'

Revamp object enumeration API around odb.

* ps/odb-for-each-object:
  odb: drop unused `for_each_{loose,packed}_object()` functions
  reachable: convert to use `odb_for_each_object()`
  builtin/pack-objects: use `packfile_store_for_each_object()`
  odb: introduce mtime fields for object info requests
  treewide: drop uses of `for_each_{loose,packed}_object()`
  treewide: enumerate promisor objects via `odb_for_each_object()`
  builtin/fsck: refactor to use `odb_for_each_object()`
  odb: introduce `odb_for_each_object()`
  packfile: introduce function to iterate through objects
  packfile: extract function to iterate through objects of a store
  object-file: introduce function to iterate through objects
  object-file: extract function to read object info from path
  odb: fix flags parameter to be unsigned
  odb: rename `FOR_EACH_OBJECT_*` flags

5 weeks agobuiltin/receive-pack: avoid spinning no-op sideband async threads
Adrian Ratiu [Mon, 2 Mar 2026 19:17:04 +0000 (21:17 +0200)] 
builtin/receive-pack: avoid spinning no-op sideband async threads

Exit early if the hooks do not exist, to avoid spinning up/down
sideband async threads which no-op.

It is important to call the hook_exists() API provided by hook.[ch]
because it covers both config-defined hooks and the "traditional"
hooks from the hookdir. find_hook() only covers the hookdir hooks.

The regression happened because the no-op async threads add some
additional overhead which can be measured with the receive-refs test
of the benchmarks suite [1].

Reproduced using:
cd benchmarks/receive-refs && \
./run --revisions /path/to/git \
fc148b146ad41be71a7852c4867f0773cbfe1ff9~,fc148b146ad41be71a7852c4867f0773cbfe1ff9 \
--parameter-list refformat reftable --parameter-list refcount 10000

1: https://gitlab.com/gitlab-org/data-access/git/benchmarks

Fixes: fc148b146ad4 ("receive-pack: convert update hooks to new API")
Reported-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
[jc: avoid duplicated hardcoded hook names]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoThe 8th batch
Junio C Hamano [Fri, 27 Feb 2026 22:19:13 +0000 (14:19 -0800)] 
The 8th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoMerge branch 'ap/use-test-seq-f-more'
Junio C Hamano [Fri, 27 Feb 2026 23:11:55 +0000 (15:11 -0800)] 
Merge branch 'ap/use-test-seq-f-more'

Test clean-up.

* ap/use-test-seq-f-more:
  t: use test_seq -f and pipes in a few more places

5 weeks agoMerge branch 'db/doc-fetch-jobs-auto'
Junio C Hamano [Fri, 27 Feb 2026 23:11:54 +0000 (15:11 -0800)] 
Merge branch 'db/doc-fetch-jobs-auto'

Doc update.

* db/doc-fetch-jobs-auto:
  doc: fetch: document `--jobs=0` behavior

5 weeks agoMerge branch 'mf/format-patch-honor-from-for-cover-letter'
Junio C Hamano [Fri, 27 Feb 2026 23:11:53 +0000 (15:11 -0800)] 
Merge branch 'mf/format-patch-honor-from-for-cover-letter'

"git format-patch --from=<me>" did not honor the command line
option when writing out the cover letter, which has been corrected.

* mf/format-patch-honor-from-for-cover-letter:
  format-patch: fix From header in cover letter

5 weeks agoMerge branch 'jh/alias-i18n'
Junio C Hamano [Fri, 27 Feb 2026 23:11:53 +0000 (15:11 -0800)] 
Merge branch 'jh/alias-i18n'

Extend the alias configuration syntax to allow aliases using
characters outside ASCII alphanumeric (plus '-').

* jh/alias-i18n:
  completion: fix zsh alias listing for subsection aliases
  alias: support non-alphanumeric names via subsection syntax
  alias: prepare for subsection aliases
  help: use list_aliases() for alias listing

5 weeks agoMerge branch 'ps/tests-wo-iconv-fixes'
Junio C Hamano [Fri, 27 Feb 2026 23:11:52 +0000 (15:11 -0800)] 
Merge branch 'ps/tests-wo-iconv-fixes'

Some tests assumed "iconv" is available without honoring ICONV
prerequisite, which has been corrected.

* ps/tests-wo-iconv-fixes:
  t6006: don't use iconv(1) without ICONV prereq
  t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
  t4205: improve handling of ICONV prerequisite
  t40xx: don't use iconv(1) without ICONV prereq
  t: don't set ICONV prereq when iconv(1) is missing

5 weeks agoMerge branch 'ps/ci-gitlab-msvc-updates'
Junio C Hamano [Fri, 27 Feb 2026 23:11:52 +0000 (15:11 -0800)] 
Merge branch 'ps/ci-gitlab-msvc-updates'

CI update.

* ps/ci-gitlab-msvc-updates:
  gitlab-ci: handle failed tests on MSVC+Meson job
  gitlab-ci: use "run-test-slice-meson.sh"
  ci: make test slicing consistent across Meson/Make
  github: fix Meson tests not executing at all
  meson: fix MERGE_TOOL_DIR with "--no-bin-wrappers"
  ci: don't skip smallest test slice in GitLab
  ci: handle failures of test-slice helper

5 weeks agoMerge branch 'jc/whitespace-incomplete-line'
Junio C Hamano [Fri, 27 Feb 2026 23:11:52 +0000 (15:11 -0800)] 
Merge branch 'jc/whitespace-incomplete-line'

It does not make much sense to apply the "incomplete-line"
whitespace rule to symbolic links, whose contents almost always
lack the final newline.  "git apply" and "git diff" are now taught
to exclude them for a change to symbolic links.

* jc/whitespace-incomplete-line:
  whitespace: symbolic links usually lack LF at the end

5 weeks agoMerge branch 'jc/checkout-switch-restore'
Junio C Hamano [Fri, 27 Feb 2026 23:11:51 +0000 (15:11 -0800)] 
Merge branch 'jc/checkout-switch-restore'

"git switch <name>", in an attempt to create a local branch <name>
after a remote tracking branch of the same name gave an advise
message to disambiguate using "git checkout", which has been
updated to use "git switch".

* jc/checkout-switch-restore:
  checkout: tell "parse_remote_branch" which command is calling it
  checkout: pass program-readable token to unified "main"

5 weeks agoMerge branch 'jk/ref-filter-lrstrip-optim'
Junio C Hamano [Fri, 27 Feb 2026 23:11:50 +0000 (15:11 -0800)] 
Merge branch 'jk/ref-filter-lrstrip-optim'

Code clean-up.

* jk/ref-filter-lrstrip-optim:
  ref-filter: clarify lstrip/rstrip component counting
  ref-filter: avoid strrchr() in rstrip_ref_components()
  ref-filter: simplify rstrip_ref_components() memory handling
  ref-filter: simplify lstrip_ref_components() memory handling
  ref-filter: factor out refname component counting

5 weeks agoMerge branch 'ps/history-ergonomics-updates'
Junio C Hamano [Fri, 27 Feb 2026 23:11:50 +0000 (15:11 -0800)] 
Merge branch 'ps/history-ergonomics-updates'

UI improvements for "git history reword".

* ps/history-ergonomics-updates:
  Documentation/git-history: document default for "--update-refs="
  builtin/history: rename "--ref-action=" to "--update-refs="
  builtin/history: replace "--ref-action=print" with "--dry-run"
  builtin/history: check for merges before asking for user input
  builtin/history: perform revwalk checks before asking for user input

5 weeks agoMerge branch 'ps/for-each-ref-in-fixes'
Junio C Hamano [Fri, 27 Feb 2026 23:11:50 +0000 (15:11 -0800)] 
Merge branch 'ps/for-each-ref-in-fixes'

A handful of places used refs_for_each_ref_in() API incorrectly,
which has been corrected.

* ps/for-each-ref-in-fixes:
  bisect: simplify string_list memory handling
  bisect: fix misuse of `refs_for_each_ref_in()`
  pack-bitmap: fix bug with exact ref match in "pack.preferBitmapTips"
  pack-bitmap: deduplicate logic to iterate over preferred bitmap tips

5 weeks agoMerge branch 'lo/repo-info-keys'
Junio C Hamano [Fri, 27 Feb 2026 23:11:49 +0000 (15:11 -0800)] 
Merge branch 'lo/repo-info-keys'

"git repo info" learns "--keys" action to list known keys.

* lo/repo-info-keys:
  repo: add new flag --keys to git-repo-info
  repo: rename the output format "keyvalue" to "lines"

5 weeks agot4052: test for diffstat width when prefix contains ANSI escape codes
LorenzoPegorari [Fri, 27 Feb 2026 21:48:35 +0000 (22:48 +0100)] 
t4052: test for diffstat width when prefix contains ANSI escape codes

Add test checking the calculation of the diffstat display width when the
`line_prefix`, which is text that goes before the diffstat, contains
ANSI escape codes.

This situation happens, for example, when `git log --stat --graph` is
executed:
* `--stat` will create a diffstat for each commit
* `--graph` will stuff `line_prefix` with the graph portion of the log,
  which contains ANSI escape codes to color the text

Signed-off-by: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agodiff: handle ANSI escape codes in prefix when calculating diffstat width
LorenzoPegorari [Fri, 27 Feb 2026 21:45:19 +0000 (22:45 +0100)] 
diff: handle ANSI escape codes in prefix when calculating diffstat width

The diffstat width is calculated by taking the terminal width and
incorrectly subtracting the `strlen()` of `line_prefix`, instead of the
actual display width of `line_prefix`, which may contain ANSI escape
codes (e.g., ANSI-colored strings in `log --graph --stat`).

Utilize the display width instead, obtained via `utf8_strnwidth()` with
the flag `skip_ansi`.

Signed-off-by: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agorepo: remove unnecessary variable shadow
K Jayatheerth [Mon, 23 Feb 2026 13:52:48 +0000 (19:22 +0530)] 
repo: remove unnecessary variable shadow

Avoid redeclaring `entry` inside the conditional block, removing
unnecessary variable shadowing and improving code clarity without
changing behavior.

Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Acked-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agoenvironment: move "branch.autoSetupMerge" into `struct repo_config_values`
Olamide Caleb Bello [Mon, 16 Feb 2026 16:38:27 +0000 (17:38 +0100)] 
environment: move "branch.autoSetupMerge" into `struct repo_config_values`

The config value `branch.autoSetupMerge` is parsed in
`git_default_branch_config()` and stored in the global variable
`git_branch_track`. This global variable can be overwritten
by another repository when multiple Git repos run in the the same process.

Move this value into `struct repo_config_values` in the_repository to
retain current behaviours and move towards libifying Git.
Since the variable is no longer a global variable, it has been renamed to
`branch_track` in the struct `repo_config_values`.

Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agoenvironment: stop using core.sparseCheckout globally
Olamide Caleb Bello [Mon, 16 Feb 2026 16:38:26 +0000 (17:38 +0100)] 
environment: stop using core.sparseCheckout globally

The config value `core.sparseCheckout` is parsed in
`git_default_core_config()` and stored globally in
`core_apply_sparse_checkout`. This could cause it to be overwritten
by another repository when different Git repositories run in the same
process.

Move the parsed value into `struct repo_config_values` in the_repository
to retain current behaviours and move towards libifying Git.

Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agoThe 7th batch
Junio C Hamano [Wed, 25 Feb 2026 18:49:04 +0000 (10:49 -0800)] 
The 7th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agoMerge branch 'ac/string-list-sort-u-and-tests'
Junio C Hamano [Wed, 25 Feb 2026 19:54:18 +0000 (11:54 -0800)] 
Merge branch 'ac/string-list-sort-u-and-tests'

Code clean-up using a new helper function introduced lately.

* ac/string-list-sort-u-and-tests:
  sparse-checkout: use string_list_sort_u

6 weeks agoMerge branch 'mc/tr2-process-ancestry-cleanup'
Junio C Hamano [Wed, 25 Feb 2026 19:54:18 +0000 (11:54 -0800)] 
Merge branch 'mc/tr2-process-ancestry-cleanup'

Add process ancestry data to trace2 on macOS to match what we
already do on Linux and Windows.  Also adjust the way Windows
implementation reports this information to match the other two.

* mc/tr2-process-ancestry-cleanup:
  t0213: add trace2 cmd_ancestry tests
  test-tool: extend trace2 helper with 400ancestry
  trace2: emit cmd_ancestry data for Windows
  trace2: refactor Windows process ancestry trace2 event
  build: include procinfo.c impl for macOS
  trace2: add macOS process ancestry tracing

6 weeks agoMerge branch 'ps/pack-concat-wo-backfill'
Junio C Hamano [Wed, 25 Feb 2026 19:54:17 +0000 (11:54 -0800)] 
Merge branch 'ps/pack-concat-wo-backfill'

"git pack-objects --stdin-packs" with "--exclude-promisor-objects"
fetched objects that are promised, which was not wanted.  This has
been fixed.

* ps/pack-concat-wo-backfill:
  builtin/pack-objects: don't fetch objects when merging packs

6 weeks agoMerge branch 'dk/complete-stash-import-export'
Junio C Hamano [Wed, 25 Feb 2026 19:54:17 +0000 (11:54 -0800)] 
Merge branch 'dk/complete-stash-import-export'

Command line completion (in contrib/) update.

* dk/complete-stash-import-export:
  completion: add stash import, export

6 weeks agoMerge branch 'jc/doc-cg-needswork'
Junio C Hamano [Wed, 25 Feb 2026 19:54:17 +0000 (11:54 -0800)] 
Merge branch 'jc/doc-cg-needswork'

A CodingGuidelines update.

* jc/doc-cg-needswork:
  CodingGuidelines: document NEEDSWORK comments

6 weeks agoMerge branch 'ds/revision-maximal-only'
Junio C Hamano [Wed, 25 Feb 2026 19:54:17 +0000 (11:54 -0800)] 
Merge branch 'ds/revision-maximal-only'

"git rev-list" and friends learn "--maximal-only" to show only the
commits that are not reachable by other commits.

* ds/revision-maximal-only:
  revision: add --maximal-only option

6 weeks agoMerge branch 'cc/lop-filter-auto'
Junio C Hamano [Wed, 25 Feb 2026 19:54:16 +0000 (11:54 -0800)] 
Merge branch 'cc/lop-filter-auto'

"auto filter" logic for large-object promisor remote.

* cc/lop-filter-auto:
  fetch-pack: wire up and enable auto filter logic
  promisor-remote: change promisor_remote_reply()'s signature
  promisor-remote: keep advertised filters in memory
  list-objects-filter-options: support 'auto' mode for --filter
  doc: fetch: document `--filter=<filter-spec>` option
  fetch: make filter_options local to cmd_fetch()
  clone: make filter_options local to cmd_clone()
  promisor-remote: allow a client to store fields
  promisor-remote: refactor initialising field lists

6 weeks agoMerge branch 'pw/commit-msg-sample-hook'
Junio C Hamano [Wed, 25 Feb 2026 19:54:16 +0000 (11:54 -0800)] 
Merge branch 'pw/commit-msg-sample-hook'

Update sample commit-msg hook to complain when a log message has
material mailinfo considers the end of log message in the middle.

* pw/commit-msg-sample-hook:
  templates: detect commit messages containing diffs
  templates: add .gitattributes entry for sample hooks

6 weeks agoMerge branch 'kh/doc-am-format-sendmail'
Junio C Hamano [Wed, 25 Feb 2026 19:54:16 +0000 (11:54 -0800)] 
Merge branch 'kh/doc-am-format-sendmail'

Doc update.

* kh/doc-am-format-sendmail:
  doc: add caveat about round-tripping format-patch

6 weeks agoDocumentation/git-repo: capitalize format descriptions
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:17 +0000 (13:32 -0300)] 
Documentation/git-repo: capitalize format descriptions

The descriptions for the git-repo output formats are in lowercase.
Capitalize these descriptions, making them consistent with the rest of
the documentation.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agoDocumentation/git-repo: replace 'NUL' with '_NUL_'
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:16 +0000 (13:32 -0300)] 
Documentation/git-repo: replace 'NUL' with '_NUL_'

Replace all occurrences of "NUL" by "_NUL_" in git-repo.adoc, following the
convention used by other documentation files.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agot1901: adjust nul format output instead of expected value
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:15 +0000 (13:32 -0300)] 
t1901: adjust nul format output instead of expected value

The test 'keyvalue and nul format', as it description says, test both
`keyvalue` and `nul` format. These formats are similar, differing only in
their field separator (= in the former, LF in the latter) and their
record separator (LF in the former, NUL in the latter). This way, both
formats can be tested using the same expected output and only replacing
the separators in one of the output formats.

However, it is not desirable to have a NUL character in the files
compared by test_cmp because, if that assetion fails, diff will consider
them binary files and won't display the differences properly.

Adjust the output of `git repo structure --format=nul` in t1901, matching the
--format=keyvalue ones. Compare this output against the same value expected
from --format=keyvalue, without using files with NUL characters in
test_cmp.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agot1900: rename t1900-repo to t1900-repo-info
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:14 +0000 (13:32 -0300)] 
t1900: rename t1900-repo to t1900-repo-info

Since the commit bbb2b93348 (builtin/repo: introduce structure subcommand,
2025-10-21), t1901 specifically tests git-repo-structure. Rename
t1900-repo to t1900-repo-info to clarify that it focus solely on
git-repo-info subcommand.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorepo: rename struct field to repo_info_field
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:13 +0000 (13:32 -0300)] 
repo: rename struct field to repo_info_field

Change the name of the struct field to repo_info_field, making it
explicit that it is an internal data type of git-repo-info.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorepo: replace get_value_fn_for_key by get_repo_info_field
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:12 +0000 (13:32 -0300)] 
repo: replace get_value_fn_for_key by get_repo_info_field

Remove the function `get_value_fn_for_key`, which returns a function that
retrieves a value for a certain repo info key. Introduce `get_repo_info_field`
instead, which returns a struct field.

This refactor makes the structure of the function print_fields more consistent
to the function print_all_fields, improving its readability.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorepo: rename repo_info_fields to repo_info_field
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:11 +0000 (13:32 -0300)] 
repo: rename repo_info_fields to repo_info_field

Rename repo_info_fields as repo_info_field, following the CodingGuidelines rule
for naming arrays in singular. Rename all the references to that array
accordingly.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agoCodingGuidelines: instruct to name arrays in singular
Lucas Seiki Oshiro [Wed, 25 Feb 2026 16:32:10 +0000 (13:32 -0300)] 
CodingGuidelines: instruct to name arrays in singular

Arrays should be named in the singular form, ensuring that when
accessing an element within an array (e.g. dog[0]) it's clear that
we're referring to an element instead of a collection.

Add a new rule to CodingGuidelines asking for arrays to be named in
singular instead of plural.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorefs: add GIT_REFERENCE_BACKEND to specify reference backend
Karthik Nayak [Wed, 25 Feb 2026 09:40:46 +0000 (10:40 +0100)] 
refs: add GIT_REFERENCE_BACKEND to specify reference backend

Git allows setting a different object directory via
'GIT_OBJECT_DIRECTORY', but provides no equivalent for references. In
the previous commit we extended the 'extensions.refStorage' config to
also support an URI input for reference backend with location.

Let's also add a new environment variable 'GIT_REFERENCE_BACKEND' that
takes in the same input as the config variable. Having an environment
variable allows us to modify the reference backend and location on the
fly for individual Git commands.

The environment variable also allows usage of alternate reference
directories during 'git-clone(1)' and 'git-init(1)'. Add the config to
the repository when created with the environment variable set.

When initializing the repository with an alternate reference folder,
create the required stubs in the repositories $GIT_DIR. The inverse,
i.e. removal of the ref store doesn't clean up the stubs in the $GIT_DIR
since that would render it unusable. Removal of ref store is only used
when migrating between ref formats and cleanup of the $GIT_DIR doesn't
make sense in such a situation.

Helped-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorefs: allow reference location in refstorage config
Karthik Nayak [Wed, 25 Feb 2026 09:40:45 +0000 (10:40 +0100)] 
refs: allow reference location in refstorage config

The 'extensions.refStorage' config is used to specify the reference
backend for a given repository. Both the 'files' and 'reftable' backends
utilize the $GIT_DIR as the reference folder by default in
`get_main_ref_store()`.

Since the reference backends are pluggable, this means that they could
work with out-of-tree reference directories too. Extend the 'refStorage'
config to also support taking an URI input, where users can specify the
reference backend and the location.

Add the required changes to obtain and propagate this value to the
individual backends. Add the necessary documentation and tests.

Traditionally, for linked worktrees, references were stored in the
'$GIT_DIR/worktrees/<wt_id>' path. But when using an alternate reference
storage path, it doesn't make sense to store the main worktree
references in the new path, and the linked worktree references in the
$GIT_DIR. So, let's store linked worktree references in
'$ALTERNATE_REFERENCE_DIR/worktrees/<wt_id>'. To do this, create the
necessary files and folders while also adding stubs in the $GIT_DIR path
to ensure that it is still considered a Git directory.

Ideally, we would want to pass in a `struct worktree *` to individual
backends, instead of passing the `gitdir`. This allows them to handle
worktree specific logic. Currently, that is not possible since the
worktree code is:

  - Tied to using the global `the_repository` variable.

  - Is not setup before the reference database during initialization of
    the repository.

Add a TODO in 'refs.c' to ensure we can eventually make that change.

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorefs: receive and use the reference storage payload
Karthik Nayak [Wed, 25 Feb 2026 09:40:44 +0000 (10:40 +0100)] 
refs: receive and use the reference storage payload

An upcoming commit will add support for providing an URI via the
'extensions.refStorage' config. The URI will contain the reference
backend and a corresponding payload. The payload can be then used for
providing an alternate locations for the reference backend.

To prepare for this, modify the existing backends to accept such an
argument when initializing via the 'init()' function. Both the files
and reftable backends will parse the information to be filesystem paths
to store references. Given that no callers pass any payload yet this is
essentially a no-op change for now.

To enable this, provide a 'refs_compute_filesystem_location()' function
which will parse the current 'gitdir' and the 'payload' to provide the
final reference directory and common reference directory (if working in
a linked worktree).

The documentation and tests will be added alongside the extension of the
config variable.

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorefs: move out stub modification to generic layer
Karthik Nayak [Wed, 25 Feb 2026 09:40:43 +0000 (10:40 +0100)] 
refs: move out stub modification to generic layer

When creating the reftable reference backend on disk, we create stubs to
ensure that the directory can be recognized as a Git repository. This is
done by calling `refs_create_refdir_stubs()`. Move this to the generic
layer as this is needed for all backends excluding from the files
backends. In an upcoming commit where we introduce alternate reference
backend locations, we'll have to also create stubs in the $GIT_DIR
irrespective of the backend being used. This commit builds the base to
add that logic.

Similarly, move the logic for deletion of stubs to the generic layer.
The files backend recursively calls the remove function of the
'packed-backend', here skip calling the generic function since that
would try to delete stubs.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agorefs: extract out `refs_create_refdir_stubs()`
Karthik Nayak [Wed, 25 Feb 2026 09:40:42 +0000 (10:40 +0100)] 
refs: extract out `refs_create_refdir_stubs()`

For Git to recognize a directory as a Git directory, it requires the
directory to contain:

  1. 'HEAD' file
  2. 'objects/' directory
  3. 'refs/' directory

Here, #1 and #3 are part of the reference storage mechanism,
specifically the files backend. Since then, newer backends such as the
reftable backend have moved to using their own path ('reftable/') for
storing references. But to ensure Git still recognizes the directory as
a Git directory, we create stubs.

There are two locations where we create stubs:

- In 'refs/reftable-backend.c' when creating the reftable backend.
- In 'clone.c' before spawning transport helpers.

In a following commit, we'll add another instance. So instead of
repeating the code, let's extract out this code to
`refs_create_refdir_stubs()` and use it.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agosetup: don't modify repo in `create_reference_database()`
Karthik Nayak [Wed, 25 Feb 2026 09:40:41 +0000 (10:40 +0100)] 
setup: don't modify repo in `create_reference_database()`

The `create_reference_database()` function is used to create the
reference database during initialization of a repository. The function
calls `repo_set_ref_storage_format()` to set the repositories reference
format. This is an unexpected side-effect of the function. More so
because the function is only called in two locations:

  1. During git-init(1) where the value is propagated from the `struct
     repository_format repo_fmt` value.

  2. During git-clone(1) where the value is propagated from the
     `the_repository` value.

The former is valid, however the flow already calls
`repo_set_ref_storage_format()`, so this effort is simply duplicated.
The latter sets the existing value in `the_repository` back to itself.
While this is okay for now, introduction of more fields in
`repo_set_ref_storage_format()` would cause issues, especially
dynamically allocated strings, where we would free/allocate the same
string back into `the_repostiory`.

To avoid all this confusion, clean up the function to no longer take in
and set the repo's reference storage format.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agofetch: fix wrong evaluation order in URL trailing-slash trimming
cuiweixie [Wed, 25 Feb 2026 02:00:57 +0000 (02:00 +0000)] 
fetch: fix wrong evaluation order in URL trailing-slash trimming

if i == -1, url[i] will be UB.

Signed-off-by: cuiweixie <cuiweixie@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agobuild: regenerate config-list.h when Documentation changes
D. Ben Knoble [Tue, 24 Feb 2026 14:39:44 +0000 (09:39 -0500)] 
build: regenerate config-list.h when Documentation changes

The Meson-based build doesn't know when to rebuild config-list.h, so the
header is sometimes stale.

For example, an old build directory might have config-list.h from before
4173df5187 (submodule: introduce extensions.submodulePathConfig,
2026-01-12), which added submodule.<name>.gitdir to the list. Without
it, t9902-completion.sh fails. Regenerating the config-list.h artifact
from sources fixes the artifact and the test.

Since Meson does not have (or want) builtin support for globbing like
Make, teach generate-configlist.sh to also generate a list of
Documentation files its output depends on, and incorporate that into the
Meson build. We honor the undocumented GCC/Clang contract of outputting
empty targets for all the dependencies (like they do with -MP). That is,
generate lines like

    build/config-list.h: $SOURCE_DIR/Documentation/config.adoc
    $SOURCE_DIR/Documentation/config.adoc:

We assume that if a user adds a new file under
Documentation/config then they will also edit one of the existing files
to include that new file, and that will trigger a rebuild. Also mark the
generator script as a dependency.

While we're at it, teach the Makefile to use the same "the script knows
it's dependencies" logic.

For Meson, combining the following commands helps debug dependencies:

    ninja -C <builddir> -t deps config-list.h
    ninja -C <builddir> -t browse config-list.h

The former lists all the dependencies discovered from our output ".d"
file (the config documentation) and the latter shows the dependency on
the script itself, among other useful edges in the dependency graph.

Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agobuiltin/maintenance: use "geometric" strategy by default
Patrick Steinhardt [Tue, 24 Feb 2026 08:45:52 +0000 (09:45 +0100)] 
builtin/maintenance: use "geometric" strategy by default

The git-gc(1) command has been introduced in the early days of Git in
30f610b7b0 (Create 'git gc' to perform common maintenance operations.,
2006-12-27) as the main repository maintenance utility. And while the
tool has of course evolved since then to cover new parts, the basic
strategy it uses has never really changed much.

It is safe to say that since 2006 the Git ecosystem has changed quite a
bit. Repositories tend to be much larger nowadays than they have been
almost 20 years ago, and large parts of the industry went crazy for
monorepos (for various wildly different definitions of "monorepo"). So
the maintenance strategy we used back then may not be the best fit
nowadays anymore.

Arguably, most of the maintenance tasks that git-gc(1) does are still
perfectly fine today: repacking references, expiring various data
structures and things like tend to not cause huge problems. But the big
exception is the way we repack objects.

git-gc(1) by default uses a split strategy: it performs incremental
repacks by default, and then whenever we have too many packs we perform
a large all-into-one repack. This all-into-one repack is what is causing
problems nowadays, as it is an operation that is quite expensive. While
it is wasteful in small- and medium-sized repositories, in large repos
it may even be prohibitively expensive.

We have eventually introduced git-maintenance(1) that was slated as a
replacement for git-gc(1). In contrast to git-gc(1), it is much more
flexible as it is structured around configurable tasks and strategies.
So while its default "gc" strategy still uses git-gc(1) under the hood,
it allows us to iterate.

A second strategy it knows about is the "incremental" strategy, which we
configure when registering a repository for scheduled maintenance. This
strategy isn't really a full replacement for git-gc(1) though, as it
doesn't know to expire unused data structures. In Git 2.52 we have thus
introduced a new "geometric" strategy that is a proper replacement for
the old git-gc(1).

In contrast to the incremental/all-into-one split used by git-gc(1), the
new "geometric" strategy maintains a geometric progression of packfiles,
which significantly reduces the number of all-into-one repacks that we
have to perform in large repositories. It is thus a much better fit for
large repositories than git-gc(1).

Note that the "geometric" strategy isn't perfect though: while we
perform way less all-into-one repacks compared to git-gc(1), we still
have to perform them eventually. But for the largest repositories out
there this may not be an option either, as client machines might not be
powerful enough to perform such a repack in the first place. These cases
would thus still be covered by the "incremental" strategy.

Switch the default strategy away from "gc" to "geometric", but retain
the "incremental" strategy configured when registering background
maintenance with `git maintenance register`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agot7900: prepare for switch of the default strategy
Patrick Steinhardt [Tue, 24 Feb 2026 08:45:51 +0000 (09:45 +0100)] 
t7900: prepare for switch of the default strategy

The t7900 test suite is exercising git-maintenance(1) and is thus of
course heavily reliant on the exact maintenance strategy. This reliance
comes in two flavors:

  - One test explicitly wants to verify that git-gc(1) is run as part of
    `git maintenance run`. This test is adapted by explicitly picking the
    "gc" strategy.

  - The other tests assume a specific shape of the object database,
    which is dependent on whether or not we run auto-maintenance before
    we come to the actual subject under test. These tests are adapted by
    disabling auto-maintenance.

With these changes t7900 passes with both "gc" and "geometric" default
strategies.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agot6500: explicitly use "gc" strategy
Patrick Steinhardt [Tue, 24 Feb 2026 08:45:50 +0000 (09:45 +0100)] 
t6500: explicitly use "gc" strategy

The test in t6500 explicitly wants to exercise git-gc(1) and is thus
highly specific to the actual on-disk state of the repository and
specifically of the object database. An upcoming change modifies the
default maintenance strategy to be the "geometric" strategy though,
which breaks a couple of assumptions.

One fix would arguably be to disable auto-maintenance altogether, as we
do want to explicitly verify git-gc(1) anyway. But as the whole test
suite is about git-gc(1) in the first place it feels more sensible to
configure the default maintenance strategy to be "gc".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agot5510: explicitly use "gc" strategy
Patrick Steinhardt [Tue, 24 Feb 2026 08:45:49 +0000 (09:45 +0100)] 
t5510: explicitly use "gc" strategy

One of the tests in t5510 wants to verify that auto-gc does not lock up
when fetching into a repository. Adapt it to explicitly pick the "gc"
strategy for auto-maintenance.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agot5400: explicitly use "gc" strategy
Patrick Steinhardt [Tue, 24 Feb 2026 08:45:48 +0000 (09:45 +0100)] 
t5400: explicitly use "gc" strategy

In t5400 we verify that git-receive-pack(1) runs automated repository
maintenance in the remote repository. The check is performed indirectly
by observing an effect that git-gc(1) would have, namely to prune a
temporary object from the object database. In a subsequent commit we're
about to switch to the "geometric" strategy by default though, and here
we stop observing that effect.

Adapt the test to explicitly use the "gc" strategy to prepare for that
upcoming change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agot34xx: don't expire reflogs where it matters
Patrick Steinhardt [Tue, 24 Feb 2026 08:45:47 +0000 (09:45 +0100)] 
t34xx: don't expire reflogs where it matters

We have a couple of tests in the t34xx range that rely on reflogs. This
never really used to be a problem, but in a subsequent commit we will
change the default maintenance strategy from "gc" to "geometric", and
this will cause us to drop all reflogs in these tests.

This may seem surprising and like a bug at first, but it's actually not.
The main difference between these two strategies is that the "gc"
strategy will skip all maintenance in case the object database is in a
well-optimized state. The "geometric" strategy has separate subtasks
though, and the conditions for each of these tasks is evaluated on a
case by case basis. This means that even if the object database is in
good shape, we may still decide to expire reflogs.

So why is that a problem? The issue is that Git's test suite hardcodes
the committer and author dates to a date in 2005. Interestingly though,
these hardcoded dates not only impact the commits, but also the reflog
entries. The consequence is that all newly written reflog entries are
immediately considered stale as our reflog expiration threshold is in
the range of weeks, only. It follows that executing `git reflog expire`
will thus immediately purge all reflog entries.

This hasn't been a problem in our test suite by pure chance, as the
repository shapes simply didn't cause us to perform actual garbage
collection. But with the upcoming "geometric" strategy we _will_ start
to execute `git reflog expire`, thus surfacing this issue.

Prepare for this by explicitly disabling reflog expiration in tests
impacted by this upcoming change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>