]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 days agoRelNotes: a few spelling fixes main master
Junio C Hamano [Tue, 27 Jan 2026 20:12:06 +0000 (12:12 -0800)] 
RelNotes: a few spelling fixes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agoGit 2.53-rc2 v2.53.0-rc2
Junio C Hamano [Tue, 27 Jan 2026 06:26:31 +0000 (22:26 -0800)] 
Git 2.53-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoRevert "Merge branch 'cs/rebased-subtree-split'"
Junio C Hamano [Sun, 25 Jan 2026 17:43:29 +0000 (09:43 -0800)] 
Revert "Merge branch 'cs/rebased-subtree-split'"

This reverts commit 79e3055baba32e2952e6e8994cdcd4fc145ba7f0, reversing
changes made to 9813aace1e52765e01e688672cdcdcbe25336ec7.

Regresison report

    https://lore.kernel.org/git/755578cb-07e0-4b40-aa90-aacf4d45ccaa@heusel.eu/

4 days agoMerge branch 'master' of https://github.com/j6t/git-gui
Junio C Hamano [Sun, 25 Jan 2026 17:08:06 +0000 (09:08 -0800)] 
Merge branch 'master' of https://github.com/j6t/git-gui

* 'master' of https://github.com/j6t/git-gui:
  git-gui: mark *.po files at any directory level as UTF-8
  git-gui i18n: Update Bulgarian translation (558t)
  git-gui i18n: Update Bulgarian translation (557t)

4 days agogit-gui: mark *.po files at any directory level as UTF-8
Johannes Sixt [Sun, 25 Jan 2026 09:46:23 +0000 (10:46 +0100)] 
git-gui: mark *.po files at any directory level as UTF-8

When a commit is viewed in Gitk that changes a file in po/glossary, the
patch text shows mojibake instead of correctly decoded UTF-8 text.
Gitk retrieves the encoding attribute to decide how to treat the bytes
that make up the patch text. There is an attribute definition that all
files are US-ASCII, and a later attribute definition overrides this.
But the override, which specifies UTF-8, applies only to *.po files in
directory po/ and does not apply to subdirectories.

Widen the pattern to apply to all directory levels.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
4 days agoMerge branch 'master' of github.com:alshopov/git-gui
Johannes Sixt [Sun, 25 Jan 2026 09:32:21 +0000 (10:32 +0100)] 
Merge branch 'master' of github.com:alshopov/git-gui

* 'master' of github.com:alshopov/git-gui:
  git-gui i18n: Update Bulgarian translation (558t)

5 days agogit-gui i18n: Update Bulgarian translation (558t)
Alexander Shopov [Mon, 19 Jan 2026 09:13:14 +0000 (10:13 +0100)] 
git-gui i18n: Update Bulgarian translation (558t)

- Translate new string (558t)
- Add graves for disambiguation
- Improve glossary translation (96t) and synchonize with git

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
5 days agoMerge branch 'master' of github.com:alshopov/git-gui
Johannes Sixt [Sat, 24 Jan 2026 08:25:29 +0000 (09:25 +0100)] 
Merge branch 'master' of github.com:alshopov/git-gui

* 'master' of github.com:alshopov/git-gui:
  git-gui i18n: Update Bulgarian translation (557t)

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
6 days agoA bit more before -rc2
Junio C Hamano [Fri, 23 Jan 2026 21:34:17 +0000 (13:34 -0800)] 
A bit more before -rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 days agoMerge branch 'dk/replay-doc-omit-irrelevant-rev-list-options'
Junio C Hamano [Fri, 23 Jan 2026 21:34:37 +0000 (13:34 -0800)] 
Merge branch 'dk/replay-doc-omit-irrelevant-rev-list-options'

Documentation clean-up.

* dk/replay-doc-omit-irrelevant-rev-list-options:
  lint-gitlink: preemptively ignore all /ifn?def|endif/ macros
  replay: drop rev-list formatting options from manual

6 days agoMerge branch 'js/symlink-windows'
Junio C Hamano [Fri, 23 Jan 2026 21:34:36 +0000 (13:34 -0800)] 
Merge branch 'js/symlink-windows'

Upstream symbolic link support on Windows from Git-for-Windows.

* js/symlink-windows:
  mingw: special-case index entries for symlinks with buggy size
  mingw: emulate `stat()` a little more faithfully
  mingw: try to create symlinks without elevated permissions
  mingw: add support for symlinks to directories
  mingw: implement basic `symlink()` functionality (file symlinks only)
  mingw: implement `readlink()`
  mingw: allow `mingw_chdir()` to change to symlink-resolved directories
  mingw: support renaming symlinks
  mingw: handle symlinks to directories in `mingw_unlink()`
  mingw: add symlink-specific error codes
  mingw: change default of `core.symlinks` to false
  mingw: factor out the retry logic
  mingw: compute the correct size for symlinks in `mingw_lstat()`
  mingw: teach dirent about symlinks
  mingw: let `mingw_lstat()` error early upon problems with reparse points
  mingw: drop the separate `do_lstat()` function
  mingw: implement `stat()` with symlink support
  mingw: don't call `GetFileAttributes()` twice in `mingw_lstat()`

6 days agoMerge branch 'pw/mailmap-self'
Junio C Hamano [Fri, 23 Jan 2026 21:34:36 +0000 (13:34 -0800)] 
Merge branch 'pw/mailmap-self'

Unify entries in .mailmap file for Phillip Wood.

* pw/mailmap-self:
  mailmap: add an entry for Phillip Wood

6 days agoMerge branch 'js/ci-leak-skip-svn'
Junio C Hamano [Fri, 23 Jan 2026 21:34:36 +0000 (13:34 -0800)] 
Merge branch 'js/ci-leak-skip-svn'

Dscho observed that SVN tests are taking too much time in CI leak
checking tasks, but most time is spent not in our code but in libsvn
code (which happen to be written in Perl), whose leaks have little
value to discover for us.  Skip SVN, P4, and CVS tests in the leak
checking tasks.

* js/ci-leak-skip-svn:
  ci: skip CVS and P4 tests in leaks job, too
  ci(*-leaks): skip the git-svn tests to save time

6 days agoMerge branch 'jx/build-options-gettext'
Junio C Hamano [Fri, 23 Jan 2026 21:34:36 +0000 (13:34 -0800)] 
Merge branch 'jx/build-options-gettext'

"git bugreport" and "git version --build-options" learned to
include use of 'gettext' feature, to make it easier to diagnose
problems around l10n.

* jx/build-options-gettext:
  help: report on whether or not gettext is enabled

6 days agoMerge branch 'ty/t1005-test-path-is-helpers'
Junio C Hamano [Fri, 23 Jan 2026 21:34:36 +0000 (13:34 -0800)] 
Merge branch 'ty/t1005-test-path-is-helpers'

Test clean-up.

* ty/t1005-test-path-is-helpers:
  t1005: modernize "! test -f" to "test_path_is_missing"

6 days agoMerge branch 'rj/cygwin-test-fixes-for-2.53'
Junio C Hamano [Fri, 23 Jan 2026 21:34:35 +0000 (13:34 -0800)] 
Merge branch 'rj/cygwin-test-fixes-for-2.53'

Test fixup.

* rj/cygwin-test-fixes-for-2.53:
  t0610-reftable-basics: mitigate a flaky test on cygwin
  t9700/test.pl: fix path type expectation on cygwin

6 days agoMerge branch 'sb/doc-update-ref-markup-fix'
Junio C Hamano [Fri, 23 Jan 2026 21:34:35 +0000 (13:34 -0800)] 
Merge branch 'sb/doc-update-ref-markup-fix'

Doc mark-up fix.

* sb/doc-update-ref-markup-fix:
  doc: fix `update-ref` `symref-create` formatting

6 days agoMerge branch 'kh/mailmap-avila'
Junio C Hamano [Fri, 23 Jan 2026 21:34:35 +0000 (13:34 -0800)] 
Merge branch 'kh/mailmap-avila'

* kh/mailmap-avila:
  .mailmap: fix and expand mappings for Jean-Noël Avila

6 days agogit-gui i18n: Update Bulgarian translation (557t)
Alexander Shopov [Mon, 19 Jan 2026 09:13:14 +0000 (10:13 +0100)] 
git-gui i18n: Update Bulgarian translation (557t)

Fix the meaning of a string

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
7 days agoA few on top of -rc1
Junio C Hamano [Wed, 21 Jan 2026 21:58:08 +0000 (13:58 -0800)] 
A few on top of -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 days agoMerge branch 'rs/tree-wo-the-repository'
Junio C Hamano [Thu, 22 Jan 2026 00:16:28 +0000 (16:16 -0800)] 
Merge branch 'rs/tree-wo-the-repository'

Remove implicit reliance on the_repository global in the APIs
around tree objects and make it explicit which repository to work
in.

* rs/tree-wo-the-repository:
  cocci: remove obsolete the_repository rules
  cocci: convert parse_tree functions to repo_ variants
  tree: stop using the_repository
  tree: use repo_parse_tree()
  path-walk: use repo_parse_tree_gently()
  pack-bitmap-write: use repo_parse_tree()
  delta-islands: use repo_parse_tree()
  bloom: use repo_parse_tree()
  add-interactive: use repo_parse_tree_indirect()
  tree: add repo_parse_tree*()
  environment: move access to core.maxTreeDepth into repo settings

7 days agoMerge branch 'ps/config-doc-get-urlmatch-fix'
Junio C Hamano [Thu, 22 Jan 2026 00:16:27 +0000 (16:16 -0800)] 
Merge branch 'ps/config-doc-get-urlmatch-fix'

Docfix.

* ps/config-doc-get-urlmatch-fix:
  Documentation/config: fix replacement for --get-urlmatch

7 days agoMerge branch 'tb/midx-write-corrupt-checksum-fix'
Junio C Hamano [Thu, 22 Jan 2026 00:16:27 +0000 (16:16 -0800)] 
Merge branch 'tb/midx-write-corrupt-checksum-fix'

The logic that avoids reusing MIDX files with a wrong checksum was
broken, which has been corrected.

* tb/midx-write-corrupt-checksum-fix:
  midx-write.c: assume checksum-invalid MIDXs require an update
  t/t5319-multi-pack-index.sh: drop early 'test_done'

7 days agoMerge branch 'ps/geometric-repacking-with-promisor-remotes'
Junio C Hamano [Thu, 22 Jan 2026 00:16:27 +0000 (16:16 -0800)] 
Merge branch 'ps/geometric-repacking-with-promisor-remotes'

"git repack --geometric" did not work with promisor packs, which
has been corrected.

* ps/geometric-repacking-with-promisor-remotes:
  builtin/repack: handle promisor packs with geometric repacking
  repack-promisor: extract function to remove redundant packs
  repack-promisor: extract function to finalize repacking
  repack-geometry: extract function to compute repacking split
  builtin/pack-objects: exclude promisor objects with "--stdin-packs"

7 days ago.mailmap: fix and expand mappings for Jean-Noël Avila
Kristoffer Haugsbakk [Wed, 21 Jan 2026 21:51:09 +0000 (22:51 +0100)] 
.mailmap: fix and expand mappings for Jean-Noël Avila

The latest release candidate notes say that there is a new contributor:

    Jean-Noël Avila via GitGitGadget, ...

But this is a familiar face, just in a G.G. Gadget trench coat.

Also map the rest of the idents in the history.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agoGit 2.53-rc1 v2.53.0-rc1
Junio C Hamano [Tue, 20 Jan 2026 23:22:31 +0000 (15:22 -0800)] 
Git 2.53-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agoMerge branch 'js/prep-symlink-windows'
Junio C Hamano [Wed, 21 Jan 2026 16:29:00 +0000 (08:29 -0800)] 
Merge branch 'js/prep-symlink-windows'

Further preparation to upstream symbolic link support on Windows.

* js/prep-symlink-windows:
  trim_last_path_component(): avoid hard-coding the directory separator
  strbuf_readlink(): support link targets that exceed 2*PATH_MAX
  strbuf_readlink(): avoid calling `readlink()` twice in corner-cases
  init: do parse _all_ core.* settings early
  mingw: do resolve symlinks in `getcwd()`

8 days agoMerge branch 'ps/read-object-info-improvements'
Junio C Hamano [Wed, 21 Jan 2026 16:29:00 +0000 (08:29 -0800)] 
Merge branch 'ps/read-object-info-improvements'

The object-info API has been cleaned up.

* ps/read-object-info-improvements:
  packfile: drop repository parameter from `packed_object_info()`
  packfile: skip unpacking object header for disk size requests
  packfile: disentangle return value of `packed_object_info()`
  packfile: always populate pack-specific info when reading object info
  packfile: extend `is_delta` field to allow for "unknown" state
  packfile: always declare object info to be OI_PACKED
  object-file: always set OI_LOOSE when reading object info

8 days agoMerge branch 'ps/packfile-store-in-odb-source'
Junio C Hamano [Wed, 21 Jan 2026 16:28:58 +0000 (08:28 -0800)] 
Merge branch 'ps/packfile-store-in-odb-source'

The packfile_store data structure is moved from object store to odb
source.

* ps/packfile-store-in-odb-source:
  packfile: move MIDX into packfile store
  packfile: refactor `find_pack_entry()` to work on the packfile store
  packfile: inline `find_kept_pack_entry()`
  packfile: only prepare owning store in `packfile_store_prepare()`
  packfile: only prepare owning store in `packfile_store_get_packs()`
  packfile: move packfile store into object source
  packfile: refactor misleading code when unusing pack windows
  packfile: refactor kept-pack cache to work with packfile stores
  packfile: pass source to `prepare_pack()`
  packfile: create store via its owning source

8 days agoMerge branch 'kt/http-backend-errors'
Junio C Hamano [Wed, 21 Jan 2026 16:28:58 +0000 (08:28 -0800)] 
Merge branch 'kt/http-backend-errors'

Some error messages from the http transport layer lacked the
terminating newline, which has been corrected.

* kt/http-backend-errors:
  http-backend: write newlines to stderr when responding with errors

8 days agoMerge branch 'ps/t1410-cleanup'
Junio C Hamano [Wed, 21 Jan 2026 16:28:58 +0000 (08:28 -0800)] 
Merge branch 'ps/t1410-cleanup'

Test clean-up.

* ps/t1410-cleanup:
  t1410: use test helpers in reflog rewind test

8 days agoMerge branch 'ps/ref-consistency-checks'
Junio C Hamano [Wed, 21 Jan 2026 16:28:58 +0000 (08:28 -0800)] 
Merge branch 'ps/ref-consistency-checks'

Update code paths that check data integrity around refs subsystem.
cf. <CAOLa=ZShPP3BPXa=YnC-vuX4zF=pUTFdUidZwOdna8bfVTNM9w@mail.gmail.com>

* ps/ref-consistency-checks:
  builtin/fsck: drop `fsck_head_link()`
  builtin/fsck: move generic HEAD check into `refs_fsck()`
  builtin/fsck: move generic object ID checks into `refs_fsck()`
  refs/reftable: introduce generic checks for refs
  refs/reftable: fix consistency checks with worktrees
  refs/reftable: extract function to retrieve backend for worktree
  refs/reftable: adapt includes to become consistent
  refs/files: introduce function to perform normal ref checks
  refs/files: extract generic symref target checks
  fsck: drop unused fields from `struct fsck_ref_report`
  refs/files: perform consistency checks for root refs
  refs/files: improve error handling when verifying symrefs
  refs/files: extract function to check single ref
  refs/files: remove useless indirection
  refs/files: remove `refs_check_dir` parameter
  refs/files: move fsck functions into global scope
  refs/files: simplify iterating through root refs

8 days agoMerge branch 'tb/macos-iconv-workarounds'
Junio C Hamano [Wed, 21 Jan 2026 16:28:57 +0000 (08:28 -0800)] 
Merge branch 'tb/macos-iconv-workarounds'

The iconv library on macOS fails to correctly handle stateful
ISO/IEC 2022 encoded strings.  Work it around instead of replacing
it wholesale from homebrew.

* tb/macos-iconv-workarounds:
  utf8.c: enable workaround for iconv under macOS 14/15
  utf8.c: prepare workaround for iconv under macOS 14/15

8 days agoMerge branch 'cs/rebased-subtree-split'
Junio C Hamano [Wed, 21 Jan 2026 16:28:57 +0000 (08:28 -0800)] 
Merge branch 'cs/rebased-subtree-split'

The split command in "git subtree" (in contrib/) has been taught to
deal better with rebased history.

* cs/rebased-subtree-split:
  contrib/subtree: detect rewritten subtree commits

8 days agoMerge branch 'je/doc-reset'
Junio C Hamano [Wed, 21 Jan 2026 16:28:57 +0000 (08:28 -0800)] 
Merge branch 'je/doc-reset'

Documentation updates.

* je/doc-reset:
  doc: git-reset: clarify `git reset <pathspec>`
  doc: git-reset: clarify `git reset [mode]`
  doc: git-reset: clarify intro
  doc: git-reset: reorder the forms

8 days agoMerge branch 'en/fsck-snapshot-ref-state'
Junio C Hamano [Wed, 21 Jan 2026 16:28:57 +0000 (08:28 -0800)] 
Merge branch 'en/fsck-snapshot-ref-state'

"git fsck" used inconsistent set of refs to show a confused
warning, which has been corrected.

* en/fsck-snapshot-ref-state:
  fsck: snapshot default refs before object walk

8 days agolint-gitlink: preemptively ignore all /ifn?def|endif/ macros
Jean-Noël Avila [Wed, 21 Jan 2026 13:27:05 +0000 (14:27 +0100)] 
lint-gitlink: preemptively ignore all /ifn?def|endif/ macros

Instead of testing if the macro name is ifn?def:: as if it were a inline
macro, it is faster and safer to just ignore such block macro lines before
hand.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agoreplay: drop rev-list formatting options from manual
D. Ben Knoble [Tue, 20 Jan 2026 14:05:57 +0000 (09:05 -0500)] 
replay: drop rev-list formatting options from manual

The rev-list options in our manuals are quite long; git-replay's manual
is no exception. Since replay doesn't use the formatting options at all
(it has its own output format), drop them.

This is the first time we have needed compound tests [1] for if[n]def in
our documentation:

    git grep '^ifn\?def::' Documentation | grep '[,+]'

[1]: https://docs.asciidoctor.org/asciidoc/latest/directives/ifdef-ifndef/

For both ifdef and ifndef, the "," takes on the intuitive meaning:
- ifdef: if any of the listed attributes are set…
- ifndef: unless any of the listed attributes are set

(Use "+" for "all".)

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agomailmap: add an entry for Phillip Wood
Phillip Wood [Tue, 20 Jan 2026 11:01:55 +0000 (11:01 +0000)] 
mailmap: add an entry for Phillip Wood

While all my commits appear under the same address, other addresses
appear in some commit trailers. Map those addresses to the canonical
one.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 days agoci: skip CVS and P4 tests in leaks job, too
Junio C Hamano [Sat, 17 Jan 2026 18:34:17 +0000 (10:34 -0800)] 
ci: skip CVS and P4 tests in leaks job, too

Looking at the CI logs, the p4 and cvs tests account for another 24
minutes of test time and they offer minimal value for quite a
similar reason as the previous step.

Let's introduce and use a mechanism to skip these tests to save
some resources.

Suggested-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agoci(*-leaks): skip the git-svn tests to save time
Johannes Schindelin [Fri, 16 Jan 2026 17:31:16 +0000 (17:31 +0000)] 
ci(*-leaks): skip the git-svn tests to save time

I noticed recently that the leak-checking jobs still take a lot of time,
and upon analysis, the git-svn tests contribute significantly to this.

Analyzing a recent CI run, I saw that the Git test suite contains
1,017 tests, running for approximately 5¼ hours total. Of these, 65
git-svn-related tests (~6% of test count) took 42.24 minutes combined,
accounting for ~13.% of the total runtime. This implies that the git-svn
tests are roughly twice as expernsive compared to the other tests.

However, testing git-svn in the leak-checking jobs provides minimal
value: git-svn is implemented as a Perl script, and leak checking only
handles C code. While git-svn does call into Git's built-in commands
that are implemented in C, these are standard Git operations that are
already thoroughly exercised elsewhere in the test suite. Therefore,
running the git-svn tests in the leak-checking jobs only adds to the
overall run time with little value in return.

Given that the leak-checking jobs are particularly time-intensive and
these 42+ minutes of SVN tests per job provide no additional leak
detection value, skip them in the *-leaks jobs to reduce CI runtime.

Assisted-by: Claude Sonnet 4.5
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agot1005: modernize "! test -f" to "test_path_is_missing"
Tian Yuchen [Sat, 17 Jan 2026 06:25:15 +0000 (14:25 +0800)] 
t1005: modernize "! test -f" to "test_path_is_missing"

Replace instances of "! test -f <file>" with "test_path_is_missing <file>".
This macro provides better diagnostics when the test fails (it prints
"Path exists:" instead of silently failing).

Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agohelp: report on whether or not gettext is enabled
Jiang Xin [Sat, 17 Jan 2026 13:59:38 +0000 (21:59 +0800)] 
help: report on whether or not gettext is enabled

When users report that Git has no localized output, we need to check not
only their locale settings, but also whether Git was built with GETTEXT
support in the first place.

Expose this information via the existing build info output by adding a
"gettext: enabled" line to `git version --build-options` (and therefore
also to `git bugreport`) when `NO_GETTEXT` is not defined at build time.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agot0610-reftable-basics: mitigate a flaky test on cygwin
Ramsay Jones [Fri, 16 Jan 2026 20:39:56 +0000 (20:39 +0000)] 
t0610-reftable-basics: mitigate a flaky test on cygwin

Test #29 ('ref transaction: corrupted tables cause failure') started to
fail intermittently for me (from v2.52.0-rc0) when running the testsuite
with '-j8'. (Also, having moved to a new laptop and windows 11, rather
than windows 10). If the test is run by hand, or without any parallelism,
then it passes without issue.

When the test fails (e.g. 1 out of 32 parallel runs) the cause is due to
a permission error while corrupting a table file:

  ./test-lib.sh: line 1010: .git/reftable/0x000000000001-0x000000000002-d89bb8ee.ref: Permission denied

This corruption is done in a shell loop, directly after a 'test_commit',
which uses an ': >"$f"' expression to truncate the file. Adding a sleep
of one second after the 'test_commit' and before the shell loop fixes
the test (it is not clear why). Replacing the redirection shell expression
with a 'test-tool truncate "$f" 0' invocation also provides a fix, which
could simply be another way to change the timing sufficiently to win the
race.

During a debug session, I tried looking at the strace output for the
shell redirection:

  $ rm /tmp/hello; echo hello >/tmp/hello; ls -l /tmp/hello
  -rw-r--r-- 1 ramsay None 6 Nov 10 17:25 /tmp/hello
  $

  $ strace -o zzz bash -c ': >/tmp/hello'
  $

Similarly, for the test-tool solution:

  $ strace -o xxx ./t/helper/test-tool truncate /tmp/hello 0
  $

When comparing the output, the differences seemed to be what you would
expect and, if anything, the shell redirect probably would have taken
longer than the test-tool solution (many fcntl() calls to dup the stdout
to the <fd>).  The call to the win32 api NtCreateFile() was identical,
apart from the first (FileHandle) parameter, of course.

In order to fix this flaky test on cygwin, despite not knowing why it
works, replace the shell redirection with the above 'test-tool truncate'
invocation.

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agot9700/test.pl: fix path type expectation on cygwin
Ramsay Jones [Fri, 16 Jan 2026 20:39:44 +0000 (20:39 +0000)] 
t9700/test.pl: fix path type expectation on cygwin

Commit 4ec7ac101b ("t9700: accommodate for Windows paths", 2025-12-17)
changed the type of the absolute path to the git directory from unix to
win32 for both GfW and cygwin. This fixed the test for GfW but causes
new failures on cygwin, since the test expectation is that it uses unix
paths on cygwin. In order to not break cygwin, disable the new code by
removing the "or $^O eq 'cygwin'" sub-expression from the conditional
part of the fix.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agoMerge a handful more topics after -rc0
Junio C Hamano [Fri, 16 Jan 2026 19:34:19 +0000 (11:34 -0800)] 
Merge a handful more topics after -rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agoMerge branch 'ml/doc-blame-markup'
Junio C Hamano [Fri, 16 Jan 2026 20:40:28 +0000 (12:40 -0800)] 
Merge branch 'ml/doc-blame-markup'

Doc mark-up update.

* ml/doc-blame-markup:
  doc: git-blame: convert to new doc format
  doc: blame-options: convert to new doc format

13 days agoMerge branch 'kh/doc-patch-id'
Junio C Hamano [Fri, 16 Jan 2026 20:40:28 +0000 (12:40 -0800)] 
Merge branch 'kh/doc-patch-id'

"git patch-id" documentation updates.

* kh/doc-patch-id:
  doc: patch-id: --verbatim locks in --stable
  doc: patch-id: spell out the git-diff-tree(1) form
  doc: patch-id: use definite article for the result
  patch-id: use “patch ID” throughout
  doc: patch-id: capitalize Git version
  doc: patch-id: don’t use semicolon between bullet points

13 days agoMerge branch 'bc/doc-stash-import-export'
Junio C Hamano [Fri, 16 Jan 2026 20:40:27 +0000 (12:40 -0800)] 
Merge branch 'bc/doc-stash-import-export'

Update a FAQ entry on synching two separate repositories using the
"git stash export/import" recently introduced.

* bc/doc-stash-import-export:
  gitfaq: document using stash import/export to sync working tree

13 days agoMerge branch 'kj/t7101-modernize'
Junio C Hamano [Fri, 16 Jan 2026 20:40:27 +0000 (12:40 -0800)] 
Merge branch 'kj/t7101-modernize'

Test update.

* kj/t7101-modernize:
  t7101: modernize test path checks

13 days agoMerge branch 'ds/builtin-doc-update'
Junio C Hamano [Fri, 16 Jan 2026 20:40:27 +0000 (12:40 -0800)] 
Merge branch 'ds/builtin-doc-update'

Update in-code comment doc to match the current API.

* ds/builtin-doc-update:
  builtin.h: update documentation

13 days agoMerge branch 'ac/t1420-use-more-direct-check'
Junio C Hamano [Fri, 16 Jan 2026 20:40:27 +0000 (12:40 -0800)] 
Merge branch 'ac/t1420-use-more-direct-check'

Test update.

* ac/t1420-use-more-direct-check:
  t1420: modernize the lost-found test

13 days agoMerge branch 'jk/cat-file-avoid-bitmap-when-unneeded'
Junio C Hamano [Fri, 16 Jan 2026 20:40:26 +0000 (12:40 -0800)] 
Merge branch 'jk/cat-file-avoid-bitmap-when-unneeded'

Fix for a performance regression in "git cat-file".

* jk/cat-file-avoid-bitmap-when-unneeded:
  cat-file: only use bitmaps when filtering

13 days agoMerge branch 'jk/t-perf-fixes'
Junio C Hamano [Fri, 16 Jan 2026 20:40:26 +0000 (12:40 -0800)] 
Merge branch 'jk/t-perf-fixes'

Perf-test fixes.

* jk/t-perf-fixes:
  t/perf/run: preserve GIT_PERF_* from environment
  t/perf/perf-lib: fix assignment of TEST_OUTPUT_DIRECTORY

2 weeks agococci: remove obsolete the_repository rules
René Scharfe [Thu, 15 Jan 2026 22:01:25 +0000 (23:01 +0100)] 
cocci: remove obsolete the_repository rules

035c7de9e9e (cocci: apply the "revision.h" part of
"the_repository.pending", 2023-03-28) removed the last of the repo-less
functions and macros mentioned in the_repository.cocci at the time.  No
stragglers appeared since then.  Remove the applied rules now that they
have outlived their usefulness.

Also add a reminder to eventually remove the just added rules for
tree.h.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoRevert "Merge branch 'ar/run-command-hook'"
Junio C Hamano [Thu, 15 Jan 2026 19:12:53 +0000 (11:12 -0800)] 
Revert "Merge branch 'ar/run-command-hook'"

This reverts commit f406b8955295d01089ba2baf35eceadff2d11cae,
reversing changes made to 1627809eeff75e6ec936fc609e7be46d5eb2fa9e.

It seems to have caused a few regressions, two of the three known
ones we have proposed solutions for.  Let's give ourselves a bit
more room to maneuver during the pre-release freeze period and
restart once the 2.53 ships.

2 weeks agoGit 2.53-rc0 v2.53.0-rc0
Junio C Hamano [Thu, 15 Jan 2026 13:59:37 +0000 (05:59 -0800)] 
Git 2.53-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoMerge branch 'ps/clar-integers'
Junio C Hamano [Thu, 15 Jan 2026 15:12:41 +0000 (07:12 -0800)] 
Merge branch 'ps/clar-integers'

Import newer version of "clar", unit testing framework.

* ps/clar-integers:
  gitattributes: disable blank-at-eof errors for clar test expectations
  t/unit-tests: demonstrate use of integer comparison assertions
  t/unit-tests: update clar to 39f11fe

2 weeks agoMerge branch 'kh/replay-invalid-onto-advance'
Junio C Hamano [Thu, 15 Jan 2026 15:12:41 +0000 (07:12 -0800)] 
Merge branch 'kh/replay-invalid-onto-advance'

Improve the error message when a bad argument is given to the
`--onto` option of "git replay".  Test coverage of "git replay" has
been improved.

* kh/replay-invalid-onto-advance:
  t3650: add more regression tests for failure conditions
  replay: die if we cannot parse object
  replay: improve code comment and die message
  replay: die descriptively when invalid commit-ish is given
  replay: find *onto only after testing for ref name
  replay: remove dead code and rearrange

2 weeks agoMerge branch 'ps/odb-misc-fixes'
Junio C Hamano [Thu, 15 Jan 2026 15:12:40 +0000 (07:12 -0800)] 
Merge branch 'ps/odb-misc-fixes'

Miscellaneous fixes on object database layer.

* ps/odb-misc-fixes:
  odb: properly close sources before freeing them
  builtin/gc: fix condition for whether to write commit graphs

2 weeks agoMerge branch 'pt/t7800-difftool-test-racefix'
Junio C Hamano [Thu, 15 Jan 2026 15:12:40 +0000 (07:12 -0800)] 
Merge branch 'pt/t7800-difftool-test-racefix'

Test fixup.

* pt/t7800-difftool-test-racefix:
  t7800: fix racy "difftool --dir-diff syncs worktree" test

2 weeks agoDocumentation/config: fix replacement for --get-urlmatch
Pushkar Singh [Thu, 15 Jan 2026 11:08:05 +0000 (11:08 +0000)] 
Documentation/config: fix replacement for --get-urlmatch

The documentation claims that --get-urlmatch is replaced by

  git config get --all --show-names --url=<URL> <name>

However, --url cannot be combined with --all, and this command
fails in practice.

Update the replacement to use only --url, which matches the
actual behavior of --get-urlmatch.

Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agobuiltin/repack: handle promisor packs with geometric repacking
Patrick Steinhardt [Mon, 5 Jan 2026 13:16:45 +0000 (14:16 +0100)] 
builtin/repack: handle promisor packs with geometric repacking

When performing a fetch with an object filter, we mark the resulting
packfile as a promisor pack. An object part of such a pack may miss any
of its referenced objects, and Git knows to handle this case by fetching
any such missing objects from the promisor remote.

The "promisor" property needs to be retained going forward. So every
time we pack a promisor object, the resulting pack must be marked as a
promisor pack. git-repack(1) does this already: when a repository has a
promisor remote, it knows to pass "--exclude-promisor-objects" to the
git-pack-objects(1) child process. Promisor packs are written separately
when doing an all-into-one repack via `repack_promisor_objects()`.

But we don't support promisor objects when doing a geometric repack yet.
Promisor packs do not get any special treatment there, as we simply
merge promisor and non-promisor packs. The resulting pack is not even
marked as a promisor pack, which essentially corrupts the repository.

This corruption couldn't happen in the real world though: we pass both
"--exclude-promisor-objects" and "--stdin-packs" to git-pack-objects(1)
if a repository has a promisor remote, but as those options are mutually
exclusive we always end up dying. And while we made those flags
compatible with one another in a preceding commit, we still end up dying
in case git-pack-objects(1) is asked to repack a promisor pack.

There's multiple ways to fix this:

  - We can exclude promisor packs from the geometric progression
    altogether. This would have the consequence that we never repack
    promisor packs at all. But in a partial clone it is quite likely
    that the user generates a bunch of promisor packs over time, as
    every backfill fetch would create another one. So this doesn't
    really feel like a sensible option.

  - We can adapt git-pack-objects(1) to support repacking promisor packs
    and include them in the normal geometric progression. But this would
    mean that the set of promisor objects expands over time as the packs
    are merged with normal packs.

  - We can use a separate geometric progression to repack promisor
    packs.

The first two options both have significant downsides, so they aren't
really feasible. But the third option fixes both of these downsides: we
make sure that promisor packs get merged, and at the same time we never
expand the set of promisor objects beyond the set of objects that are
already marked as promisor objects.

Implement this strategy so that geometric repacking works in partial
clones.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorepack-promisor: extract function to remove redundant packs
Patrick Steinhardt [Mon, 5 Jan 2026 13:16:44 +0000 (14:16 +0100)] 
repack-promisor: extract function to remove redundant packs

We're about to add a second caller that wants to remove redundant packs
after a geometric repack. Split out the function which does this to
prepare for that.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorepack-promisor: extract function to finalize repacking
Patrick Steinhardt [Mon, 5 Jan 2026 13:16:43 +0000 (14:16 +0100)] 
repack-promisor: extract function to finalize repacking

We're about to add a second caller that wants to finalize repacking of
promisor objects. Split out the function which does this to prepare for
that.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorepack-geometry: extract function to compute repacking split
Patrick Steinhardt [Mon, 5 Jan 2026 13:16:42 +0000 (14:16 +0100)] 
repack-geometry: extract function to compute repacking split

We're about to add a second caller that wants to compute the repacking
split for a set of packfiles. Split out the function that computes this
split to prepare for that.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agobuiltin/pack-objects: exclude promisor objects with "--stdin-packs"
Patrick Steinhardt [Mon, 5 Jan 2026 13:16:41 +0000 (14:16 +0100)] 
builtin/pack-objects: exclude promisor objects with "--stdin-packs"

It is currently not possible to combine "--exclude-promisor-objects"
with "--stdin-packs" because both flags want to set up a revision walk
to enumerate the objects to pack. In a subsequent commit though we want
to extend geometric repacks to support promisor objects, and for that we
need to handle the combination of both flags.

There are two cases we have to think about here:

  - "--stdin-packs" asks us to pack exactly the objects part of the
    specified packfiles. It is somewhat questionable what to do in the
    case where the user asks us to exclude promisor objects, but at the
    same time explicitly passes a promisor pack to us. For now, we
    simply abort the request as it is self-contradicting. As we have
    also been dying before this commit there is no regression here.

  - "--stdin-packs=follow" does the same as the first flag, but it also
    asks us to include all objects transitively reachable from any
    object in the packs we are about to repack. This is done by doing
    the revision walk mentioned further up. Luckily, fixing this case is
    trivial: we only need to modify the revision walk to also set the
    `exclude_promisor_objects` field.

Note that we do not support the "--exclude-promisor-objects-best-effort"
flag for now as we don't need it to support geometric repacking with
promisor objects.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agomidx-write.c: assume checksum-invalid MIDXs require an update
Taylor Blau [Mon, 12 Jan 2026 23:45:06 +0000 (18:45 -0500)] 
midx-write.c: assume checksum-invalid MIDXs require an update

In 6ce9d558ced (midx-write: skip rewriting MIDX with `--stdin-packs`
unless needed, 2025-12-10), the MIDX machinery learned how to optimize
out unnecessary writes with "--stdin-packs".

In order to do this, it compares the contents of the in-progress write
against a MIDX loaded directly from the object store. We load a separate
MIDX (as opposed to checking our update relative to "ctx.m") because the
MIDX code does not reuse an existing MIDX with --stdin-packs, and always
leaves "ctx.m" as NULL. See commit 0c5a62f14bc (midx-write.c: do not
read existing MIDX with `packs_to_include`, 2024-06-11) for details on
why.

If "ctx.m" is non-NULL, however, it is guaranteed to be checksum-valid,
since we only assign "ctx.m" when "midx_checksum_valid()" returns true.
Since the same guard does not exist for the MIDX we pass to
"midx_needs_update()", we may ignore on-disk corruption when determining
whether or not we can optimize out the write.

Add a similar guard within "midx_needs_update()" to prevent such an
issue.

A more robust fix would involve revising 0c5a62f14bc and teaching the
MIDX generation code how to reuse an existing MIDX even when invoked
with "--stdin-packs", such that we could avoid side-loading the MIDX
directly from the object store in order to call "midx_needs_update()".
For now, pursue the minimal fix.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agot/t5319-multi-pack-index.sh: drop early 'test_done'
Taylor Blau [Mon, 12 Jan 2026 23:45:03 +0000 (18:45 -0500)] 
t/t5319-multi-pack-index.sh: drop early 'test_done'

In 6ce9d558ced (midx-write: skip rewriting MIDX with `--stdin-packs`
unless needed, 2025-12-10), an extra 'test_done' was added, causing the
test script to finish before having run all of its tests.

Dropping this extraneous 'test_done' exposes a bug from commit
6ce9d558ced that causes a subsequent test to fail. Mark that test with a
'test_expect_failure' for now, and the subsequent commit will explain
and fix the bug.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoMerge branch 'ps/repack-avoid-noop-midx-rewrite' into tb/midx-write-corrupt-checksum-fix
Junio C Hamano [Tue, 13 Jan 2026 13:21:09 +0000 (05:21 -0800)] 
Merge branch 'ps/repack-avoid-noop-midx-rewrite' into tb/midx-write-corrupt-checksum-fix

* ps/repack-avoid-noop-midx-rewrite:
  midx-write: skip rewriting MIDX with `--stdin-packs` unless needed
  midx-write: extract function to test whether MIDX needs updating
  midx: fix `BUG()` when getting preferred pack without a reverse index

2 weeks agoutf8.c: enable workaround for iconv under macOS 14/15
Torsten Bögershausen [Mon, 12 Jan 2026 16:25:53 +0000 (17:25 +0100)] 
utf8.c: enable workaround for iconv under macOS 14/15

The previous commit introduced a workaround in utf8.c to deal
with broken iconv implementations.

It is enabled when a MacOS version is used that has a buggy
iconv library and there is no external library provided
(and linked against) from neither MacPorts nor Homebrew nor Fink.
For Homebrew, MacPorts and Fink we check if libiconv exist.
Introduce 2 new macros: HAS_GOOD_LIBICONV and NEEDS_GOOD_LIBICONV.

For Homebrew HAS_GOOD_LIBICONV is set when the libiconv directory
exist.
MacPorts can be installed with or without libiconv, so check if
libiconv.dylib exists (which is a softlink)

Fink compiles and installs libiconv by default.
Note that a fresh installation of Fink now defaults to /opt/sw.
Older versions used /sw as default, so leave the check and setting
of BASIC_CFLAGS and BASIC_LDFLAGS as is.
For the new default check for the existance of /opt/sw as well.
Add a check for /opt/sw/lib/libiconv.dylib which sets HAS_GOOD_LIBICONV

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoutf8.c: prepare workaround for iconv under macOS 14/15
Torsten Bögershausen [Mon, 12 Jan 2026 16:25:51 +0000 (17:25 +0100)] 
utf8.c: prepare workaround for iconv under macOS 14/15

MacOS14 (Sonoma) has started to ship an iconv library with bugs.
The same bugs exists even in MacOS 15 (Sequoia)

A bug report running the Git test suite says:

three tests of t3900 fail on macOS 26.1 for me:

  not ok 17 - ISO-2022-JP should be shown in UTF-8 now
  not ok 25 - ISO-2022-JP should be shown in UTF-8 now
  not ok 38 - commit --fixup into ISO-2022-JP from UTF-8

Here's the verbose output of the first one:

=================
expecting success of 3900.17 'ISO-2022-JP should be shown in UTF-8 now':
                compare_with ISO-2022-JP "$TEST_DIRECTORY"/t3900/2-UTF-8.txt

 --- /Users/x/src/git/t/t3900/2-UTF-8.txt 2024-10-01 19:43:24.605230684 +0000
 +++ current     2025-12-08 21:52:45.786161909 +0000
@@ -1,5 +1,5 @@
 はれひほふ

 しているのが、いるので。
 -濱浜ほれぷりぽれまびぐりろへ。
 +濱浜ほれぷりぽれまび$0$j$m$X!#
not ok 17 - ISO-2022-JP should be shown in UTF-8 now
1..17
=================

compare_with runs git show to display a commit message, which in this
case here was encoded using ISO-2022-JP and is supposed to be reencoded
to UTF-8, but git show only does that half-way -- the "$0$j$m$X!#" part
is from the original ISO-2022-JP representation.

That botched conversion is done by utf8.c::reencode_string_iconv().  It
calls iconv(3) to do the actual work, initially with an output buffer of
the same size as the input.  If the output needs more space the function
enlarges the buffer and calls iconv(3) again.

iconv(3) won't tell us how much space it needs, but it will report what
part it already managed to convert, so we can increase the buffer and
continue from there.  ISO-2022-JP has escape codes for switching between
character sets, so it's a stateful encoding.  I guess the iconv(3) on my
machine forgets the state at the end of part one and then messes up part
two.

[end of citation]

Working around the buggy iconv shipped with the OS can be done in
two  ways:
a) Link Git against a different version of iconv
b) Improve the handling when iconv needs a larger output buffer

a) is already done by default when either Fink [1] or MacPorts [2]
   or Homebrew [3] is installed.
b) is implemented here, in case that no fixed iconv is available:
   When the output buffer is too short, increase it (as before)
   and start from scratch (this is new).

This workound needs to be enabled with
'#define ICONV_RESTART_RESET'
and a makefile knob will be added in the next commit

Suggested-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
[1] https://www.finkproject.org/
[2] https://www.macports.org/
[3] https://brew.sh/

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agobuiltin/fsck: drop `fsck_head_link()`
Patrick Steinhardt [Mon, 12 Jan 2026 09:03:06 +0000 (10:03 +0100)] 
builtin/fsck: drop `fsck_head_link()`

The function `fsck_head_link()` was historically used to perform a
couple of consistency checks for refs. (Almost) all of these checks have
now been moved into the refs subsystem. There's only a single check
remaining that verifies whether `refs_resolve_ref_unsafe()` returns a
`NULL` pointer. This may happen in a couple of cases:

  - When `refs_is_safe()` declares the ref to be unsafe. We already have
    checks for this as we verify refnames with `check_refname_format()`.

  - When the ref doesn't exist. A repository without "HEAD" is
    completely broken though, and we would notice this error ahead of
    time already.

  - In case the caller passes `RESOLVE_REF_READING` and the ref is a
    symref that doesn't resolve. We don't pass this flag though.

As such, this check doesn't cover anything anymore that isn't already
covered by `refs_fsck()`. Drop it, which also allows us to inline the
call to `refs_resolve_ref_unsafe()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agobuiltin/fsck: move generic HEAD check into `refs_fsck()`
Patrick Steinhardt [Mon, 12 Jan 2026 09:03:05 +0000 (10:03 +0100)] 
builtin/fsck: move generic HEAD check into `refs_fsck()`

Move the check that detects "HEAD" refs that do not point at a branch
into `refs_fsck()`. This follows the same motivation as the preceding
commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agobuiltin/fsck: move generic object ID checks into `refs_fsck()`
Patrick Steinhardt [Mon, 12 Jan 2026 09:03:04 +0000 (10:03 +0100)] 
builtin/fsck: move generic object ID checks into `refs_fsck()`

While most of the logic that verifies the consistency of refs is
driven by `refs_fsck()`, we still have a small handful of checks in
`fsck_head_link()`. These checks don't use the git-fsck(1) reporting
infrastructure, and as such it's impossible to for example disable
some of those checks.

One such check detects refs that point to the all-zeroes object ID.
Extract this check into the generic `refs_fsck_ref()` function that is
used by both the "files" and "reftable" backends.

Note that this will cause us to not return an error code from
`fsck_head_link()` anymore in case this error was detected. This is fine
though: the only caller of this function does not check the error code
anyway. To demonstrate this, adapt the function to drop its return value
altogether. The function will be removed in a subsequent commit anyway.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/reftable: introduce generic checks for refs
Patrick Steinhardt [Mon, 12 Jan 2026 09:03:03 +0000 (10:03 +0100)] 
refs/reftable: introduce generic checks for refs

In a preceding commit we have extracted generic checks for both direct
and symbolic refs that apply for all backends. Wire up those checks for
the "reftable" backend.

Note that this is done by iterating through all refs manually with the
low-level reftable ref iterator. We explicitly don't want to use the
higher-level iterator that is exposed to users of the reftable backend
as that iterator may swallow for example broken refs.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/reftable: fix consistency checks with worktrees
Patrick Steinhardt [Mon, 12 Jan 2026 09:03:02 +0000 (10:03 +0100)] 
refs/reftable: fix consistency checks with worktrees

The ref consistency checks are driven via `cmd_refs_verify()`. That
function loops through all worktrees (including the main worktree) and
then checks the ref store for each of them individually. It follows that
the backend is expected to only verify refs that belong to the specified
worktree.

While the "files" backend handles this correctly, the "reftable" backend
doesn't. In fact, it completely ignores the passed worktree and instead
verifies refs of _all_ worktrees. The consequence is that we'll end up
every ref store N times, where N is the number of worktrees.

Or rather, that would be the case if we actually iterated through the
worktree reftable stacks correctly. But we use `strmap_for_each_entry()`
to iterate through the stacks, but the map is in fact not even properly
populated. So instead of checking stacks N^2 times, we actually only end
up checking the reftable stack of the main worktree.

Fix this bug by only verifying the stack of the passed-in worktree and
constructing the backends via `backend_for_worktree()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/reftable: extract function to retrieve backend for worktree
Patrick Steinhardt [Mon, 12 Jan 2026 09:03:01 +0000 (10:03 +0100)] 
refs/reftable: extract function to retrieve backend for worktree

Pull out the logic to retrieve a backend for a given worktree. This
function will be used in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/reftable: adapt includes to become consistent
Patrick Steinhardt [Mon, 12 Jan 2026 09:03:00 +0000 (10:03 +0100)] 
refs/reftable: adapt includes to become consistent

Adapt the includes to be sorted and to use include paths that are
relative to the "refs/" directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: introduce function to perform normal ref checks
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:59 +0000 (10:02 +0100)] 
refs/files: introduce function to perform normal ref checks

In a subsequent commit we'll introduce new generic checks for direct
refs. These checks will be independent of the actual backend.

Introduce a new function `refs_fsck_ref()` that will be used for this
purpose. At the current point in time it's still empty, but it will get
populated in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: extract generic symref target checks
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:58 +0000 (10:02 +0100)] 
refs/files: extract generic symref target checks

The consistency checks for the "files" backend contain a couple of
verifications for symrefs that verify generic properties of the target
reference. These properties need to hold for every backend, no matter
whether it's using the "files" or "reftable" backend.

Reimplementing these checks for every single backend doesn't really make
sense. Extract it into a generic `refs_fsck_symref()` function that can
be used by other backends, as well. The "reftable" backend will be wired
up in a subsequent commit.

While at it, improve the consistency checks so that we don't complain
about refs pointing to a non-ref target in case the target refname
format does not verify. Otherwise it's very likely that we'll generate
both error messages, which feels somewhat redundant in this case.

Note that the function has a couple of `UNUSED` parameters. These will
become referenced in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agofsck: drop unused fields from `struct fsck_ref_report`
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:57 +0000 (10:02 +0100)] 
fsck: drop unused fields from `struct fsck_ref_report`

The `struct fsck_ref_report` has a couple fields that are intended to
improve the error reporting for broken ref reports by showing which
object ID or target reference the ref points to. These fields are never
set though and are thus essentially unused.

Remove them.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: perform consistency checks for root refs
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:56 +0000 (10:02 +0100)] 
refs/files: perform consistency checks for root refs

While the "files" backend already knows to perform consistency checks
for the "refs/" hierarchy, it doesn't verify any of its root refs. Plug
this omission.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: improve error handling when verifying symrefs
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:55 +0000 (10:02 +0100)] 
refs/files: improve error handling when verifying symrefs

The error handling when verifying symbolic refs is a bit on the wild
side:

  - `fsck_report_ref()` can be told to ignore specific errors. If an
    error has been ignored and a previous check raised an unignored
    error, then assigning `ret = fsck_report_ref()` will cause us to
    swallow the previous error.

  - When the target reference is not valid we bail out early without
    checking for other errors.

Fix both of these issues by consistently or'ing the return value and not
bailing out early.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: extract function to check single ref
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:54 +0000 (10:02 +0100)] 
refs/files: extract function to check single ref

When checking the consistency of references we create a directory
iterator and then verify each single reference in a loop. The logic to
perform the actual checks is embedded into that loop, which makes it
hard to reuse. But In a subsequent commit we're about to introduce a
second path that wants to verify references.

Prepare for this by extracting the logic to check a single reference
into a standalone function.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: remove useless indirection
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:53 +0000 (10:02 +0100)] 
refs/files: remove useless indirection

The function `files_fsck_refs()` only has a single callsite and forwards
all of its arguments as-is, so it's basically a useless indirection.
Inline the function call.

While at it, also remove the bitwise or that we have for return values.
We don't really want to or them at all, but rather just want to return
an error in case either of the functions has failed.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: remove `refs_check_dir` parameter
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:52 +0000 (10:02 +0100)] 
refs/files: remove `refs_check_dir` parameter

The parameter `refs_check_dir` determines which directory we want to
check references for. But as we always want to check the complete
refs hierarchy, this parameter is always set to "refs".

Drop the parameter and hardcode it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: move fsck functions into global scope
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:51 +0000 (10:02 +0100)] 
refs/files: move fsck functions into global scope

When performing consistency checks we pass the functions that perform
the verification down the calling stack. This is somewhat unnecessary
though, as the set of functions doesn't ever change.

Simplify the code by moving the array into global scope and remove the
parameter.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs/files: simplify iterating through root refs
Patrick Steinhardt [Mon, 12 Jan 2026 09:02:50 +0000 (10:02 +0100)] 
refs/files: simplify iterating through root refs

When iterating through root refs we first need to determine the
directory in which the refs live. This is done by retrieving the root of
the loose refs via `refs->loose->root->name`, and putting it through
`files_ref_path()` to derive the final path.

This is somewhat redundant though: the root name of the loose files
cache is always going to be the empty string. As such, we always end up
passing that empty string to `files_ref_path()` as the ref hierarchy we
want to start. And this actually makes sense: `files_ref_path()` already
computes the location of the root directory, so of course we need to
pass the empty string for the ref hierarchy itself. So going via the
loose ref cache to figure out that the root of a ref hierarchy is empty
is only causing confusion.

But next to the added confusion, it can also lead to a segfault. The
loose ref cache is populated lazily, so it may not always be set. It
seems to be sheer luck that this is a condition we do not currently hit.
The right thing to do would be to call `get_loose_ref_cache()`, which
knows to populate the cache if required.

Simplify the code and fix the potential segfault by simply removing the
indirection via the loose ref cache completely.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agopackfile: drop repository parameter from `packed_object_info()`
Patrick Steinhardt [Mon, 12 Jan 2026 09:00:47 +0000 (10:00 +0100)] 
packfile: drop repository parameter from `packed_object_info()`

The function `packed_object_info()` takes a packfile and offset and
returns the object info for the corresponding object. Despite these two
parameters though it also takes a repository pointer. This is redundant
information though, as `struct packed_git` already has a repository
pointer that is always populated.

Drop the redundant parameter.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agopackfile: skip unpacking object header for disk size requests
Patrick Steinhardt [Mon, 12 Jan 2026 09:00:46 +0000 (10:00 +0100)] 
packfile: skip unpacking object header for disk size requests

While most of the object info requests for a packed object require us to
unpack its headers, reading its disk size doesn't. We still unpack the
object header in that case though, which is unnecessary work.

Skip reading the header if only the disk size is requested. This leads
to a small speedup when reading disk size, only. The following benchmark
was done in the Git repository:

    Benchmark 1: ./git rev-list --disk-usage HEAD (rev = HEAD~)
      Time (mean ± σ):     105.2 ms ±   0.6 ms    [User: 91.4 ms, System: 13.3 ms]
      Range (min … max):   103.7 ms … 106.0 ms    27 runs

    Benchmark 2: ./git rev-list --disk-usage HEAD (rev = HEAD)
      Time (mean ± σ):      96.7 ms ±   0.4 ms    [User: 86.2 ms, System: 10.0 ms]
      Range (min … max):    96.2 ms …  98.1 ms    30 runs

    Summary
      ./git rev-list --disk-usage HEAD (rev = HEAD) ran
        1.09 ± 0.01 times faster than ./git rev-list --disk-usage HEAD (rev = HEAD~)

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agopackfile: disentangle return value of `packed_object_info()`
Patrick Steinhardt [Mon, 12 Jan 2026 09:00:45 +0000 (10:00 +0100)] 
packfile: disentangle return value of `packed_object_info()`

The `packed_object_info()` function returns the type of the packed
object. While we use an `enum object_type` to store the return value,
this type is not to be confused with the actual object type. It _may_
contain the object type, but it may just as well encode that the given
packed object is stored as a delta.

We have removed the only caller that relied on this returned object type
in the preceding commit, so let's simplify semantics and return either 0
on success or a negative error code otherwise.

This unblocks a small optimization where we can skip reading the object
type altogether.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agopackfile: always populate pack-specific info when reading object info
Patrick Steinhardt [Mon, 12 Jan 2026 09:00:44 +0000 (10:00 +0100)] 
packfile: always populate pack-specific info when reading object info

When reading object information via `packed_object_info()` we may not
populate the object info's packfile-specific fields. This leads to
inconsistent object info depending on whether the info was populated via
`packfile_store_read_object_info()` or `packed_object_info()`.

Fix this inconsistency so that we can always assume the pack info to be
populated when reading object info from a pack.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agopackfile: extend `is_delta` field to allow for "unknown" state
Patrick Steinhardt [Mon, 12 Jan 2026 09:00:43 +0000 (10:00 +0100)] 
packfile: extend `is_delta` field to allow for "unknown" state

The `struct object_info::u::packed::is_delta` field determines whether
or not a specific object is stored as a delta. It only stores whether or
not the object is stored as delta, so it is treated as a boolean value.

This boolean is insufficient though: when reading a packed object via
`packfile_store_read_object_info()` we know to skip parsing the actual
object when the user didn't request any object-specific data. In that
case we won't read the object itself, but will only look up its position
in the packfile. Consequently, we do not know whether it is a delta or
not.

This isn't really an issue right now, as the check for an empty request
is broken. But a subsequent commit will fix it, and once we do we will
have the need to also represent an "unknown" delta state.

Prepare for this change by introducing a new enum that encodes the
object type. We don't use the "unknown" state just yet, but will start
to do so in a subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agopackfile: always declare object info to be OI_PACKED
Patrick Steinhardt [Mon, 12 Jan 2026 09:00:42 +0000 (10:00 +0100)] 
packfile: always declare object info to be OI_PACKED

When reading object info via a packfile we yield one of two types:

  - The object can either be OI_PACKED, which is what a caller would
    typically expect.

  - Or it can be OI_DBCACHED if it is stored in the delta base cache.

The latter really is an implementation detail though, and callers
typically don't care at all about the difference. Furthermore, the
information whether or not it is part of the delta base cache can
already be derived via the `is_delta` field, so the fact that we discern
between OI_PACKED and OI_DBCACHED only further complicates the
interface.

There aren't all that many callers that care about the `whence` field in
the first place. In fact, there's only three:

  - `packfile_store_read_object_info()` checks for `whence == OI_PACKED`
    and then populates the packfile information of the object info
    structure. We now start to do this also for deltified objects, which
    gives its callers strictly more information.

  - `repack_local_links()` wants to determine whether the object is part
    of a promisor pack and checks for `whence == OI_PACKED`. If so, it
    verifies that the packfile is a promisor pack. It's arguably wrong
    to declare that an object is not part of a promisor pack only
    because it is stored in the delta base cache.

  - `is_not_in_promisor_pack_obj()` does the same, but checks that a
    specific object is _not_ part of a promisor pack. The same reasoning
    as above applies.

Drop the OI_DBCACHED enum completely. None of the callers seem to care
about the distinction.

Note that this also fixes a segfault introduced in 8c1b84bc97
(streaming: move logic to read packed objects streams into backend,
2025-11-23), which refactors how we stream packed objects. The intent is
to only read packed objects in case they are stored non-deltified as
we'd otherwise have to deflate them first. But the check for whether or
not the object is stored as a delta was unconditionally done via
`oi.u.packed.is_delta`, which is only valid in case `oi.whence` is
`OI_PACKED`. But under some circumstances we got `OI_DBCACHED` here,
which means that none of the `oi.u.packed` fields were initialized at
all. Consequently, we assumed the object was not stored as a delta, and
then try to read the object from `oi.u.packed.pack`, which is a `NULL`
pointer and thus causes a segfault.

Add a test case for this issue so that this cannot regress in the
future anymore.

Reported-by: Matt Smiley <msmiley@gitlab.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoobject-file: always set OI_LOOSE when reading object info
Patrick Steinhardt [Mon, 12 Jan 2026 09:00:41 +0000 (10:00 +0100)] 
object-file: always set OI_LOOSE when reading object info

There are some early returns in `odb_source_loose_read_object_info()`
in cases where we don't have to open the loose object. These return
paths do not set `struct object_info::whence` to `OI_LOOSE` though, so
it becomes impossible for the caller to tell the format of such an
object.

The root cause of this really is that we have so many different return
paths in the function. As a consequence, it's harder than necessary to
make sure that all successful exit paths sot up the `whence` field as
expected.

Address this by refactoring the function to have a single exit path.
Like this, we can trivially set up the `whence` field when we exit
successfully from the function.

Note that we also:

  - Rename `status` to `ret` to match our usual coding style, but also
    to show that the old `status` variable is now always getting the
    expected value. Furthermore, the value is not initialized anymore,
    which has the consequence that most compilers will warn for exit
    paths where we forgot to set it.

  - Move the setup of scratch pointers closer to `parse_loose_header()`
    to show where it's needed.

  - Guard a couple of variables on cleanup so that they only get
    released in case they have been set up.

  - Reset `oi->delta_base_oid` towards the end of the function, together
    with all the other object info pointers.

Overall, all these changes result in a diff that is somewhat hard to
read. But the end result is significantly easier to read and reason
about, so I'd argue this one-time churn is worth it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoThe 17th batch
Junio C Hamano [Mon, 12 Jan 2026 05:54:28 +0000 (21:54 -0800)] 
The 17th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoMerge branch 'js/mailmap-karsten-blees'
Junio C Hamano [Mon, 12 Jan 2026 13:19:52 +0000 (05:19 -0800)] 
Merge branch 'js/mailmap-karsten-blees'

Mailmap update for Karsten

* js/mailmap-karsten-blees:
  .mailmap: replace Karsten Blees' default address

2 weeks agoMerge branch 'ps/t1300-2021-use-test-path-is-helpers'
Junio C Hamano [Mon, 12 Jan 2026 13:19:52 +0000 (05:19 -0800)] 
Merge branch 'ps/t1300-2021-use-test-path-is-helpers'

Test updates.

* ps/t1300-2021-use-test-path-is-helpers:
  t1300: use test helpers instead of `test` command

2 weeks agoMerge branch 'rs/commit-stack'
Junio C Hamano [Mon, 12 Jan 2026 13:19:52 +0000 (05:19 -0800)] 
Merge branch 'rs/commit-stack'

Code clean-up, unifying various hand-rolled "list of commit
objects" and use the commit_stack API.

* rs/commit-stack:
  commit-reach: use commit_stack
  commit-graph: use commit_stack
  commit: add commit_stack_grow()
  shallow: use commit_stack
  pack-bitmap-write: use commit_stack
  commit: add commit_stack_init()
  test-reach: use commit_stack
  remote: use commit_stack for src_commits
  remote: use commit_stack for sent_tips
  remote: use commit_stack for local_commits
  name-rev: use commit_stack
  midx: use commit_stack
  log: use commit_stack
  revision: export commit_stack