]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
24 hours agoThe 8th batch main master
Junio C Hamano [Mon, 27 Jul 2026 16:08:48 +0000 (09:08 -0700)] 
The 8th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
24 hours agoMerge branch 'bc/rust-hash-cleanups'
Junio C Hamano [Mon, 27 Jul 2026 16:09:01 +0000 (09:09 -0700)] 
Merge branch 'bc/rust-hash-cleanups'

A few memory problems in the Rust interface to C hash functions have
been corrected.  The 'Clone' implementation of 'CryptoHasher' now
properly initializes the context before cloning, and its 'Drop'
implementation now discards the context to prevent leaks.

* bc/rust-hash-cleanups:
  rust: discard hash context when finished
  hash: initialize context before cloning

24 hours agoMerge branch 'pw/rebase-drop-notes-with-commit'
Junio C Hamano [Mon, 27 Jul 2026 16:09:00 +0000 (09:09 -0700)] 
Merge branch 'pw/rebase-drop-notes-with-commit'

The rebase post-rewrite notes-copying logic has been corrected.  When
a commit is dropped during rebase (e.g., because its changes are
already upstream), it is no longer recorded as rewritten, preventing
its notes from being copied to an unrelated commit.

* pw/rebase-drop-notes-with-commit:
  sequencer: do not record dropped commits as rewritten
  sequencer: use an enum to represent result of picking a commit
  sequencer: simplify pick_one_commit()
  sequencer: remove unnecessary condition in pick_one_commit()
  sequencer: simplify handling of fixup with conflicts
  sequencer: remove unnecessary "or" in pick_one_commit()
  sequencer: never reschedule on failed commit
  sequencer: be more careful with external merge
  t3400: restore coverage for note copying with apply backend

24 hours agoMerge branch 'ps/copy-wo-the-repository'
Junio C Hamano [Mon, 27 Jul 2026 16:09:00 +0000 (09:09 -0700)] 
Merge branch 'ps/copy-wo-the-repository'

The copy_file() and copy_file_with_time() functions have been
refactored to take a repository parameter, allowing the removal of the
implicit dependency on the global 'the_repository' variable in
'copy.c'.

* ps/copy-wo-the-repository:
  copy: drop dependency on `the_repository`

24 hours agoMerge branch 'sc/wt-status-avoid-quadratic-insertion'
Junio C Hamano [Mon, 27 Jul 2026 16:09:00 +0000 (09:09 -0700)] 
Merge branch 'sc/wt-status-avoid-quadratic-insertion'

The enumeration of untracked and ignored files in 'git status' has
been optimized by avoiding quadratic complexity when inserting into
string lists, reducing the construction cost from O(n^2) to O(n log
n).

* sc/wt-status-avoid-quadratic-insertion:
  wt-status: avoid repeated insertion for untracked paths

24 hours agoMerge branch 'ps/refspec-wo-the-repository'
Junio C Hamano [Mon, 27 Jul 2026 16:09:00 +0000 (09:09 -0700)] 
Merge branch 'ps/refspec-wo-the-repository'

The dependency on the global 'the_repository' variable in the
'refspec.c' API has been removed by passing the hash algorithm
explicitly to refspec-parsing functions and storing it in 'struct
refspec'.

* ps/refspec-wo-the-repository:
  refspec: stop depending on `the_repository`
  refspec: let callers pass in hash algorithm when parsing items
  refspec: group related structures and functions

24 hours agoMerge branch 'rs/remote-curl-simplify-push-specs'
Junio C Hamano [Mon, 27 Jul 2026 16:08:59 +0000 (09:08 -0700)] 
Merge branch 'rs/remote-curl-simplify-push-specs'

The passing of push destination specifications in the 'remote-curl'
helper has been simplified by removing the explicit 'count' parameter
and relying on the NULL-termination of the array.

* rs/remote-curl-simplify-push-specs:
  remote-curl: simplify passing of push specs

24 hours agoMerge branch 'td/ref-filter-memoize-contains'
Junio C Hamano [Mon, 27 Jul 2026 16:08:59 +0000 (09:08 -0700)] 
Merge branch 'td/ref-filter-memoize-contains'

'git branch --contains' and 'git for-each-ref --contains' have been
optimized to use the memoized commit traversal previously used only by
'git tag --contains', significantly speeding up connectivity checks
across many candidate refs with shared history.

* td/ref-filter-memoize-contains:
  commit-reach: die on contains walk errors
  ref-filter: memoize --contains with generations
  commit-reach: reject cycles in contains walk

24 hours agoMerge branch 'ps/refs-wo-the-repository'
Junio C Hamano [Mon, 27 Jul 2026 16:08:59 +0000 (09:08 -0700)] 
Merge branch 'ps/refs-wo-the-repository'

The ref subsystem and the worktree API have been refactored to pass a
repository pointer down the call chain, allowing them to drop
references to the global 'the_repository' variable.  As part of this,
the handling of the 'core.packedRefsTimeout' configuration has been
moved into the per-repository ref store structure.

* ps/refs-wo-the-repository:
  refs: remove remaining uses of `the_repository`
  worktree: pass repository to public functions
  worktree: pass repository to file-local functions
  worktree: refactor code to use available repositories
  refs/files: drop `USE_THE_REPOSITORY_VARIABLE`
  refs/packed: de-globalize handling of "core.packedRefsTimeout"

24 hours agoMerge branch 'jc/submodule-helper-avoid-zu'
Junio C Hamano [Mon, 27 Jul 2026 16:08:58 +0000 (09:08 -0700)] 
Merge branch 'jc/submodule-helper-avoid-zu'

An accidental use of the '%zu' format specifier in 'git
submodule--helper' has been corrected to use 'PRIuMAX' and cast the
value to 'uintmax_t' to avoid portability issues.

* jc/submodule-helper-avoid-zu:
  submodule--helper: avoid use of %zu for now

24 hours agoMerge branch 'ps/shift-root-in-graph'
Junio C Hamano [Mon, 27 Jul 2026 16:08:58 +0000 (09:08 -0700)] 
Merge branch 'ps/shift-root-in-graph'

'git log --graph' has been modified to visually distinguish parentless
'root' commits (and commits that become roots due to history
simplification) by indenting them, preventing them from appearing
falsely related to unrelated commits rendered immediately above them.

* ps/shift-root-in-graph:
  graph: add --[no-]graph-indent and log.graphIndent
  graph: move config reading into graph_read_config()
  graph: wrap cascading commits after 4 columns
  graph: indent visual root in graph
  graph: add a 2 commit buffer for lookahead
  revision: add next_commit_to_show()
  lib-log-graph: move check_graph function

5 days agoThe 7th batch
Junio C Hamano [Wed, 22 Jul 2026 17:30:43 +0000 (10:30 -0700)] 
The 7th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 days agoMerge branch 'kk/no-walk-pathspec-fix'
Junio C Hamano [Wed, 22 Jul 2026 17:30:55 +0000 (10:30 -0700)] 
Merge branch 'kk/no-walk-pathspec-fix'

The 'git rev-list --no-walk' command has been corrected to restore
pathspec filtering, which was lost when the streaming walk was
refactored.

* kk/no-walk-pathspec-fix:
  revision: fix --no-walk path filtering regression

5 days agoMerge branch 'sk/t7614-do-not-hide-git-exit-status'
Junio C Hamano [Wed, 22 Jul 2026 17:30:54 +0000 (10:30 -0700)] 
Merge branch 'sk/t7614-do-not-hide-git-exit-status'

The test script 't/t7614-merge-signoff.sh' has been updated to avoid
suppressing the exit code of 'git' commands in a pipe.

* sk/t7614-do-not-hide-git-exit-status:
  t7614: avoid hiding git's exit code in a pipe

5 days agoMerge branch 'sk/t1100-modernize'
Junio C Hamano [Wed, 22 Jul 2026 17:30:54 +0000 (10:30 -0700)] 
Merge branch 'sk/t1100-modernize'

The test script 't/t1100-commit-tree-options.sh' has been modernized
by converting test cases to the modern style (using single quotes and
tab indentation) and moving the creation of the expected file inside
the setup test so it runs under the protection of the test harness.

* sk/t1100-modernize:
  t1100: move creation of expected output into setup test
  t1100: modernize test style

5 days agoMerge branch 'ps/odb-for-each-object-filter'
Junio C Hamano [Wed, 22 Jul 2026 17:30:54 +0000 (10:30 -0700)] 
Merge branch 'ps/odb-for-each-object-filter'

The object database enumeration interface odb_for_each_object() has
been taught to accept object filters, allowing the underlying backends
to optimize the traversal by using reachability bitmaps when
available.  'git cat-file --batch-all-objects' has been updated to use
this generic interface, simplifying its code and avoiding direct
access to ODB backend internals.

* ps/odb-for-each-object-filter:
  builtin/cat-file: filter objects via object database
  odb: introduce object filters to `odb_for_each_object()`
  pack-bitmap: introduce function to open bitmap for a single source
  pack-bitmap: drop `_1` suffix from functions that open bitmaps
  pack-bitmap: iterate object sources when opening bitmaps
  pack-bitmap: allow aborting iteration of bitmapped objects
  pack-objects: drop unused return value from add_object_entry()
  pack-bitmap: mark object filter as `const`
  odb/source-packed: improve lookup when enumerating objects

5 days agoMerge branch 'rs/strbuf-avoid-redundant-reset'
Junio C Hamano [Wed, 22 Jul 2026 17:30:54 +0000 (10:30 -0700)] 
Merge branch 'rs/strbuf-avoid-redundant-reset'

A redundant strbuf_reset() call in the 'HAVE_GETDELIM' path of
strbuf_getwholeline() has been removed, as getdelim() overwrites the
buffer and the length is updated afterward.

* rs/strbuf-avoid-redundant-reset:
  strbuf: avoid redundant reset in strbuf_getwholeline()

5 days agoMerge branch 'cc/doc-fast-export-synopsis-fix'
Junio C Hamano [Wed, 22 Jul 2026 17:30:53 +0000 (10:30 -0700)] 
Merge branch 'cc/doc-fast-export-synopsis-fix'

The usage string and SYNOPSIS for 'git fast-export' have been
standardized to make them consistent with each other and with other
commands.

* cc/doc-fast-export-synopsis-fix:
  fast-export: standardize usage string and SYNOPSIS

5 days agoMerge branch 'ml/t9811-replace-test-f'
Junio C Hamano [Wed, 22 Jul 2026 17:30:53 +0000 (10:30 -0700)] 
Merge branch 'ml/t9811-replace-test-f'

The test script 't/t9811-git-p4-label-import.sh' has been
modernized to use 'test_path_is_file' and 'test_path_is_missing'
instead of raw 'test -f' and '! test -f' calls.

* ml/t9811-replace-test-f:
  t9811: replace 'test -f' and '! test -f' with 'test_path_*'
  t9811: break long && chains into multiple lines

5 days agoMerge branch 'jt/receive-pack-use-odb-transactions'
Junio C Hamano [Wed, 22 Jul 2026 17:30:53 +0000 (10:30 -0700)] 
Merge branch 'jt/receive-pack-use-odb-transactions'

'git receive-pack' has been refactored to use ODB transaction
interfaces instead of directly managing 'tmp_objdir' for staging
incoming objects, bringing it closer to being ODB backend agnostic.

* jt/receive-pack-use-odb-transactions:
  builtin/receive-pack: stage incoming objects via ODB transactions
  builtin/receive-pack: drop redundant tmpdir env
  odb/transaction: introduce ODB transaction flags
  odb/transaction: add transaction env interface
  odb/transaction: propagate commit errors
  odb/transaction: propagate begin errors
  object-file: propagate files transaction errors
  object-file: drop check for inflight transactions
  object-file: embed transaction flush logic in commit function
  object-file: rename files transaction fsync function
  object-file: rename files transaction prepare function

5 days agoMerge branch 'cl/conditional-config-on-worktree-path'
Junio C Hamano [Wed, 22 Jul 2026 17:30:52 +0000 (10:30 -0700)] 
Merge branch 'cl/conditional-config-on-worktree-path'

The '[includeIf "condition"]' conditional inclusion facility for
configuration files has been taught to use the location of the
worktree in its condition.

* cl/conditional-config-on-worktree-path:
  config: add "worktree" and "worktree/i" includeIf conditions
  config: refactor include_by_gitdir() into include_by_path()

5 days agoMerge branch 'dm/submodule-update-i-shorthand'
Junio C Hamano [Wed, 22 Jul 2026 17:30:52 +0000 (10:30 -0700)] 
Merge branch 'dm/submodule-update-i-shorthand'

The '-i' shorthand for the '--init' option, which was accepted by the
'git submodule update' command until it was broken in a modernization
of the option-parsing code, has been restored.

* dm/submodule-update-i-shorthand:
  submodule--helper: accept '-i' shorthand for update --init

6 days agoThe 6th batch
Junio C Hamano [Tue, 21 Jul 2026 17:18:29 +0000 (10:18 -0700)] 
The 6th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 days agoMerge branch 'cl/b4-cover-change-id'
Junio C Hamano [Tue, 21 Jul 2026 17:18:37 +0000 (10:18 -0700)] 
Merge branch 'cl/b4-cover-change-id'

The in-tree 'b4' cover letter template has been updated to include the
'change-id' trailer, ensuring that sent tags generated by 'b4' contain
the required tracking information for subsequent runs.

* cl/b4-cover-change-id:
  b4: include change-id in cover template

6 days agoMerge branch 'ps/odb-stream-double-close-fix'
Junio C Hamano [Tue, 21 Jul 2026 17:18:36 +0000 (10:18 -0700)] 
Merge branch 'ps/odb-stream-double-close-fix'

The stream-based object signature verification path has been
corrected to avoid double-closing the stream on read errors.

* ps/odb-stream-double-close-fix:
  object-file: fix closing object stream twice

8 days agorust: discard hash context when finished
brian m. carlson [Sun, 19 Jul 2026 01:08:42 +0000 (01:08 +0000)] 
rust: discard hash context when finished

When we allocate a context but then abandon it, we never discard it,
which means that the underlying crypto library context may leak.  This
doesn't happen with our default block code, but it may with OpenSSL.
Note that we do call git_hash_free, which frees the memory we called
from git_hash_alloc, but doesn't discard the underlying context itself.

This can be seen with the following command when compiling with OpenSSL
and running with nightly Rust:

    RUSTFLAGS='-Z sanitizer=leak' cargo test

Discard the context in our context handler.  Note that it is fine to do
so even after finalizing the context, so our final functions which take
self instead of &mut self will not mishandle memory.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agohash: initialize context before cloning
brian m. carlson [Sun, 19 Jul 2026 01:08:41 +0000 (01:08 +0000)] 
hash: initialize context before cloning

Our C-based clone helper requires that the context be initialized, but
we neglect to do that in our Clone implementation for CryptoHasher.
This does not matter when using our default block SHA-256
implementation, but it does cause a crash when using OpenSSL as the
backend.  Fix this by properly initializing the context before cloning
into it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agowt-status: avoid repeated insertion for untracked paths
Sahitya Chandra [Sat, 18 Jul 2026 08:14:49 +0000 (13:44 +0530)] 
wt-status: avoid repeated insertion for untracked paths

wt_status_collect_untracked() copies entries from dir.entries and
dir.ignored into string_lists using string_list_insert(). At first glance
this seems quadratic, because inserting into the sorted list may shift the
backing array, incurring O(n) work for each insert.

In practice, though, the entries in the dir struct are already sorted, so
we should not have to shift the array and only pay the O(log n) lookup cost
for each insertion. But this is subtle and depends on the behavior of
fill_directory().

Collect the entries with string_list_append() instead, then sort and
deduplicate each list once with string_list_sort_u(). This preserves the
sorted, duplicate-free result while making the collection strategy explicit.

Signed-off-by: Sahitya Chandra <sahityajb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agoThe 5th batch
Junio C Hamano [Sun, 19 Jul 2026 17:42:01 +0000 (10:42 -0700)] 
The 5th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 days agoMerge branch 'js/coverity-fixes-null-safety'
Junio C Hamano [Sun, 19 Jul 2026 17:42:20 +0000 (10:42 -0700)] 
Merge branch 'js/coverity-fixes-null-safety'

Various code paths have been hardened against potential NULL-pointer
dereferences and invalid file descriptor accesses flagged by
Coverity.

* js/coverity-fixes-null-safety:
  shallow: give write_one_shallow() its own hex buffer
  shallow: fix NULL dereference
  bisect: ensure non-NULL `head` before using it
  pack-bitmap: handle missing bitmap for base MIDX
  revision: avoid dereferencing NULL in `add_parents_only()`
  replay: die when --onto does not peel to a commit
  bisect: handle NULL commit in `bisect_successful()`
  mailsplit: move NULL check before first use of file handle
  reftable/stack: guard against NULL list_file in stack_destroy
  remote: guard `remote_tracking()` against NULL remote
  diff: handle NULL return from repo_get_commit_tree()
  diffcore-break: guard against NULLed queue entries in merge loop

8 days agoMerge branch 'kk/reftable-tombstone-quadratic-fix'
Junio C Hamano [Sun, 19 Jul 2026 17:42:19 +0000 (10:42 -0700)] 
Merge branch 'kk/reftable-tombstone-quadratic-fix'

The performance of ref updates and reads using the 'reftable' backend
in the presence of many deletion tombstone records has been optimized
by removing the tombstone suppression flag from the merged iterator
and instead skipping tombstones at higher-level call sites where
iteration bounds are known.

* kk/reftable-tombstone-quadratic-fix:
  reftable: fix quadratic behavior in the presence of tombstones
  t/perf: add perf test for ref tombstone scenarios

8 days agoMerge branch 'kk/commit-graph-topo-levels-fix'
Junio C Hamano [Sun, 19 Jul 2026 17:42:19 +0000 (10:42 -0700)] 
Merge branch 'kk/commit-graph-topo-levels-fix'

The 'topo_levels' slab was propagated only to the topmost layer of a
split commit-graph chain, causing topological levels for commits in
base layers to be recomputed during incremental writes.  This has been
corrected.

* kk/commit-graph-topo-levels-fix:
  commit-graph: propagate topo_levels slab to all chain layers
  commit-graph: add trace2 instrumentation for generation DFS

8 days agoMerge branch 'ty/migrate-ignorecase'
Junio C Hamano [Sun, 19 Jul 2026 17:42:19 +0000 (10:42 -0700)] 
Merge branch 'ty/migrate-ignorecase'

The global configuration variable 'ignore_case' (representing the
'core.ignorecase' configuration) has been migrated into 'struct
repo_config_values' to tie it to a specific repository instance.

* ty/migrate-ignorecase:
  config: use repo_ignore_case() to access core.ignorecase
  environment: move ignore_case into repo_config_values

8 days agoMerge branch 'tc/bundle-uri-empty-fix'
Junio C Hamano [Sun, 19 Jul 2026 17:42:19 +0000 (10:42 -0700)] 
Merge branch 'tc/bundle-uri-empty-fix'

The client-side parser of the server-advertised bundle-URI list has
been updated to drain the remaining response in order to avoid
protocol desynchronization when the server sends a misconfigured list.
Also, the server-side has been taught to omit empty configuration
values instead of sending invalid key-value lines.

* tc/bundle-uri-empty-fix:
  bundle-uri: stop sending invalid bundle configuration
  bundle-uri: drain remaining response on invalid bundle-uri lines

8 days agoMerge branch 'hf/unpack-trees-quadratic-scan'
Junio C Hamano [Sun, 19 Jul 2026 17:42:18 +0000 (10:42 -0700)] 
Merge branch 'hf/unpack-trees-quadratic-scan'

The cache-scanning loop in 'next_cache_entry()' has been optimized
to avoid rescanning already-unpacked index entries, preventing a
quadratic performance slow-down when diffing the working tree
against a commit with a pathspec matching early index entries.

* hf/unpack-trees-quadratic-scan:
  unpack-trees: avoid quadratic index scan in next_cache_entry()

8 days agoMerge branch 'wy/doc-myfirstcontribution-trim-quotes'
Junio C Hamano [Sun, 19 Jul 2026 17:42:18 +0000 (10:42 -0700)] 
Merge branch 'wy/doc-myfirstcontribution-trim-quotes'

The contributor guide has been updated to advise new contributors to
trim irrelevant quoted text when replying to review comments, matching
the existing advice given to reviewers.

* wy/doc-myfirstcontribution-trim-quotes:
  MyFirstContribution: mention trimming quoted text in replies

8 days agoMerge branch 'gr/t1410-reflog-exit-code'
Junio C Hamano [Sun, 19 Jul 2026 17:42:18 +0000 (10:42 -0700)] 
Merge branch 'gr/t1410-reflog-exit-code'

The pipelines in 't1410-reflog.sh' have been replaced with the
'test_stdout_line_count' helper to avoid suppressing the exit code of
'git' commands, ensuring failures are not hidden from the test suite.

* gr/t1410-reflog-exit-code:
  t1410-reflog.sh: avoid suppressing git's exit code in pipelines

8 days agoMerge branch 'mm/test-grep-lint'
Junio C Hamano [Sun, 19 Jul 2026 17:42:17 +0000 (10:42 -0700)] 
Merge branch 'mm/test-grep-lint'

The test suite has been updated to use the 'test_grep' helper instead
of bare 'grep' for test assertions, allowing file contents to be
printed on failure for easier debugging.  A new 'greplint' linter has
been introduced to detect and prevent new bare 'grep' assertions from
being added to the test suite.

* mm/test-grep-lint:
  t: add greplint to detect bare grep assertions
  t: convert grep assertions to test_grep
  t: fix Lexer line count for $() inside double-quoted strings
  t: extract chainlint's parser into shared module
  t: fix grep assertions missing file arguments
  t/README: document test_grep helper

8 days agoMerge branch 'sn/osxkeychain-rust-universal'
Junio C Hamano [Sun, 19 Jul 2026 17:42:16 +0000 (10:42 -0700)] 
Merge branch 'sn/osxkeychain-rust-universal'

The build system has been updated to support building universal macOS
binaries when 'Rust' is enabled, by compiling separate static archives
for each target triple listed in 'RUST_TARGETS' and combining them
using the macOS 'lipo' tool.  The 'git-credential-osxkeychain' helper
has been updated to link against '$(RUST_LIB)' when 'Rust' is enabled.

* sn/osxkeychain-rust-universal:
  contrib: wire up osxkeychain in contrib/Makefile on macOS
  Makefile: support universal macOS builds via RUST_TARGETS
  Makefile: add $(RUST_LIB) prerequisite to osxkeychain

8 days agoMerge branch 'bc/parse-options-exit-0-on-help'
Junio C Hamano [Sun, 19 Jul 2026 17:42:16 +0000 (10:42 -0700)] 
Merge branch 'bc/parse-options-exit-0-on-help'

Option parsing with 'git rev-parse --parseopt' and in most 'git'
subcommands has been updated to exit with 0 (instead of 129) when the
help option ('-h' or '--help') is requested directly by the user,
aligning with standard Unix convention.

* bc/parse-options-exit-0-on-help:
  parse-options: exit 0 on -h
  rev-parse: have --parseopt callers exit 0 on --help
  parse-options: add a separate case for help output on error
  t1517: skip svn tests if svn is not installed

8 days agoMerge branch 'jc/submitting-patches-abandoning'
Junio C Hamano [Sun, 19 Jul 2026 17:42:16 +0000 (10:42 -0700)] 
Merge branch 'jc/submitting-patches-abandoning'

The 'SubmittingPatches' document has been updated to explicitly
describe the expectation for contributors to retract or abandon their
patch series when they are no longer pursuing it.

* jc/submitting-patches-abandoning:
  SubmittingPatches: document how to retract a topic

8 days agoMerge branch 'kk/commit-reach-find-all-fix'
Junio C Hamano [Sun, 19 Jul 2026 17:42:16 +0000 (10:42 -0700)] 
Merge branch 'kk/commit-reach-find-all-fix'

The early-exit optimization in 'paint_down_to_common()' has been
gated on the queue being generation-ordered, fixing a bug where
'git merge-base' (without '--all') could return incorrect results
on repositories with v1 commit graphs and clock skew.

* kk/commit-reach-find-all-fix:
  commit-reach: guard !FIND_ALL early exit with generation ordering check
  t6600: add test for merge-base early exit with clock skew

8 days agoMerge branch 'jc/relnotes-2.55-rust-fix'
Junio C Hamano [Sun, 19 Jul 2026 17:42:15 +0000 (10:42 -0700)] 
Merge branch 'jc/relnotes-2.55-rust-fix'

A description in the release notes for Git 2.55.0 has been
retroactively updated to clarify that Rust support is enabled by
default, but still optional, and will become mandatory in Git 3.0.

* jc/relnotes-2.55-rust-fix:
  Rust: fix description in Release Notes to 2.55

8 days agoMerge branch 'ps/setup-split-discovery-and-setup'
Junio C Hamano [Sun, 19 Jul 2026 17:42:15 +0000 (10:42 -0700)] 
Merge branch 'ps/setup-split-discovery-and-setup'

The repository discovery and repository configuration phases, which
were previously intertwined in 'setup.c', have been split.  Repository
discovery has been updated to populate a 'struct repo_discovery'
without modifying the repository state, which is then taken by
repository configuration to initialize the repository, paving the way
for clean unification of repository configuration.

* ps/setup-split-discovery-and-setup:
  setup: mark `set_git_work_tree()` as file-local
  setup: pass worktree to `init_db()`
  setup: drop redundant configuration of `startup_info->have_repository`
  setup: make repository discovery self-contained
  setup: propagate prefix via repository discovery
  setup: drop static `cwd` variable
  setup: move prefix into repository
  setup: embed repository format in discovery
  setup: introduce explicit repository discovery
  setup: split up concerns of `setup_git_env_internal()`
  setup: unify setup of shallow file
  setup: mark bogus worktree in `apply_repository_format()`
  setup: rename `check_repository_format_gently()`

8 days agoMerge branch 'ps/reftable-hardening'
Junio C Hamano [Sun, 19 Jul 2026 17:42:14 +0000 (10:42 -0700)] 
Merge branch 'ps/reftable-hardening'

The 'reftable' code has been hardened against corrupted tables by
fixing out-of-bounds writes, out-of-bounds reads, and abort calls
during parsing.

* ps/reftable-hardening:
  reftable/table: fix OOB read on truncated table
  reftable/table: fix NULL pointer access when seeking to bogus offsets
  reftable/block: fix OOB read with bogus restart offset
  reftable/block: fix use of uninitialized memory when binsearch fails
  reftable/block: fix OOB read with bogus restart count
  reftable/block: fix OOB read with bogus block size
  reftable/block: fix OOB write with bogus inflated log size
  t/unit-tests: introduce test helper to write reftable blocks
  reftable/record: don't abort when decoding invalid ref value type
  reftable/basics: fix OOB read on binary search of empty range
  oss-fuzz: add fuzzer for parsing reftables
  meson: support building fuzzers with libFuzzer

11 days agoThe 4th batch for Git 2.56
Junio C Hamano [Fri, 17 Jul 2026 04:31:50 +0000 (21:31 -0700)] 
The 4th batch for Git 2.56

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoMerge branch 'mm/sideband-ansi-sgr-colon-fix'
Junio C Hamano [Fri, 17 Jul 2026 06:05:48 +0000 (23:05 -0700)] 
Merge branch 'mm/sideband-ansi-sgr-colon-fix'

The sideband demultiplexer has been updated to recognize ANSI SGR
escape sequences that use colon-separated subfields (e.g., for
256-color or true-color codes).

* mm/sideband-ansi-sgr-colon-fix:
  sideband: allow ANSI SGR with colon-separated subfields

11 days agoMerge branch 'jk/git-hash-cleanups'
Junio C Hamano [Fri, 17 Jul 2026 06:05:48 +0000 (23:05 -0700)] 
Merge branch 'jk/git-hash-cleanups'

The 'git_hash_*()' wrappers have been updated to be used consistently
across the codebase instead of direct calls to members of 'struct
git_hash_algo', and 'git_hash_discard()' has been made idempotent to
simplify cleanups.

* jk/git-hash-cleanups:
  hash: check ctx->active flag in all wrapper functions
  http: use idempotent git_hash_discard()
  csum-file: use idempotent git_hash_discard()
  hash: make git_hash_discard() idempotent
  hash: document function pointers and wrappers
  hash: convert remaining direct function calls
  hash: use git_hash_init() consistently

11 days agoMerge branch 'ih/precompose-flex-array'
Junio C Hamano [Fri, 17 Jul 2026 06:05:47 +0000 (23:05 -0700)] 
Merge branch 'ih/precompose-flex-array'

The UTF-8 precomposition wrapper on macOS has been updated to use a
flexible array member to represent the name of a directory entry,
preventing fortified libc checks from failing when the name is
reallocated to be larger than 'NAME_MAX' bytes.

* ih/precompose-flex-array:
  precompose_utf8: use a flex array for d_name

11 days agoMerge branch 'ps/t-fixes-for-git-test-long'
Junio C Hamano [Fri, 17 Jul 2026 06:05:47 +0000 (23:05 -0700)] 
Merge branch 'ps/t-fixes-for-git-test-long'

Various test scripts have been updated to clean up large temporary
files and repositories, reducing peak disk usage during testing.
Also, expensive tests have been disabled on platforms that lack
sufficient resources (like 32-bit platforms and Windows CI runners),
and the long test suite has been enabled in GitLab CI.

* ps/t-fixes-for-git-test-long:
  gitlab-ci: enable "GIT_TEST_LONG"
  gitlab-ci: disable RAM disk on macOS jobs
  t: use `test_bool_env` to parse GIT_TEST_LONG
  t7900: clean up large EXPENSIVE repository
  t7508: skip EXPENSIVE test that is broken without SIZE_T_IS_64BIT
  t5608: reduce maximum disk usage
  t4141: fix inefficient use of dd(1)
  t0021: skip EXPENSIVE test that is broken without SIZE_T_IS_64BIT
  README: add GitLab CI badge to make it more discoverable

11 days agoMerge branch 'js/ci-dockerized-pid-limit'
Junio C Hamano [Fri, 17 Jul 2026 06:05:47 +0000 (23:05 -0700)] 
Merge branch 'js/ci-dockerized-pid-limit'

Dockerized CI jobs running in private GitHub repositories have been
adjusted to use explicit process and file limits, preventing resource
exhaustion errors on private runners.

* js/ci-dockerized-pid-limit:
  ci(dockerized): raise the PID limit for private repositories

11 days agoMerge branch 'js/coverity-fixes'
Junio C Hamano [Fri, 17 Jul 2026 06:05:47 +0000 (23:05 -0700)] 
Merge branch 'js/coverity-fixes'

Various resource leaks, invalid file descriptor closures, and process
handle ownership issues flagged by Coverity have been fixed.

* js/coverity-fixes:
  mingw: make `exit_process()` own the process handle on all paths
  fsmonitor: plug token-data leak on early daemon-startup failures
  reftable/table: release filter on error path
  imap-send: avoid leaking the IMAP upload buffer
  worktree: fix resource leaks when branch creation fails
  submodule: fix cwd leak in `get_superproject_working_tree()`
  dir: free allocations on parse-error paths in `read_one_dir()`
  line-log: avoid redundant copy that leaks in process_ranges
  run-command: avoid `close(-1)` in `start_command()` error paths
  download_https_uri_to_file(): do not leak fd upon failure
  loose: avoid closing invalid fd on error path
  load_one_loose_object_map(): fix resource leak

11 days agoMerge branch 'jk/hash-algo-leak-fixes'
Junio C Hamano [Fri, 17 Jul 2026 06:05:46 +0000 (23:05 -0700)] 
Merge branch 'jk/hash-algo-leak-fixes'

Various code paths that initialize a cryptographic hash context but
bail out or finish without calling 'git_hash_final()' have been taught
to call 'git_hash_discard()' to release allocated resources, fixing
memory leaks when Git is built with non-default backends like
'OpenSSL' or 'libgcrypt'.

* jk/hash-algo-leak-fixes:
  hash: add platform-specific discard functions
  hash: fix memory leak copying sha256 gcrypt handles
  http: discard hash in dumb-http http_object_request
  check_stream_oid(): discard hash on read error
  patch-id: discard hash when done
  csum-file: provide a function to release checkpoints
  csum-file: always finalize or discard hash
  hash: add discard primitive
  csum-file: drop discard_hashfile()

11 days agoMerge branch 'js/wincred-fixes'
Junio C Hamano [Fri, 17 Jul 2026 06:05:46 +0000 (23:05 -0700)] 
Merge branch 'js/wincred-fixes'

The wincred credential helper has been updated to avoid memory
corruption when erasing credentials and to prevent silent
credential loss when storing OAuth tokens, by correcting buffer
allocations and arguments passed to safe-CRT APIs.

* js/wincred-fixes:
  wincred: prevent silent credential loss when storing OAuth tokens
  wincred: avoid memory corruption when erasing a credential

11 days agocopy: drop dependency on `the_repository`
Patrick Steinhardt [Thu, 16 Jul 2026 15:28:23 +0000 (17:28 +0200)] 
copy: drop dependency on `the_repository`

When copying a file we need to potentially adapt permissions of the new
file based on whether or not "core.shared" is enabled. Parsing this
configuration makes us implicitly depend on `the_repository`.

Refactor the code to instead require the caller to pass in a repository
so that we can remove `USE_THE_REPOSITORY_VARIABLE`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agorefspec: stop depending on `the_repository`
Patrick Steinhardt [Thu, 16 Jul 2026 12:38:04 +0000 (14:38 +0200)] 
refspec: stop depending on `the_repository`

The only remaining user of `the_hash_algo` in "refspec.c" is
`refspec_append()`, which needs to know the hash algorithm so that it
can parse the appended refspec item. In contrast to the functions
adapted in the preceding commit, this function always operates on a
`struct refspec`. As that structure is expected to only ever contain
refspecs that all use the same hash function it doesn't make sense
though to adapt each caller.

Instead, adapt the structure itself so that it gets initialized with a
hash function and use that hash function to parse new refspec items.
Adapt callers accordingly.

This removes the final dependency on the global repository variable in
"refspec.c", so we can drop `USE_THE_REPOSITORY_VARIABLE`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agorefspec: let callers pass in hash algorithm when parsing items
Patrick Steinhardt [Thu, 16 Jul 2026 12:38:03 +0000 (14:38 +0200)] 
refspec: let callers pass in hash algorithm when parsing items

When parsing a refspec item we need to know about the hash algorithm
used by the repository so that we can decide whether or not a given
string is an exact object ID. We use `the_hash_algo` for this, which
makes the code implicitly depend on `the_repository`.

Refactor `refspec_item_init_fetch()`, `refspec_item_init_push()` and
`valid_fetch_refspec()` so that callers have to pass in the hash
algorithm explicitly and adapt callers accordingly. For now, all of
the callers simply pass `the_hash_algo`, so there is no change in
behaviour.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agorefspec: group related structures and functions
Patrick Steinhardt [Thu, 16 Jul 2026 12:38:02 +0000 (14:38 +0200)] 
refspec: group related structures and functions

Reorganize the refspec header a bit so that structures and their related
functions are grouped closer together. While at it, fix a couple of
style violations.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agowincred: prevent silent credential loss when storing OAuth tokens
Johannes Schindelin [Thu, 16 Jul 2026 14:27:51 +0000 (14:27 +0000)] 
wincred: prevent silent credential loss when storing OAuth tokens

When `git credential approve` hands the wincred helper a password
together with an `oauth_refresh_token`, the OAuth branch of
`store_credential()` writes one WCHAR past the allocation while
formatting both fields into a single `CredentialBlob`. On Windows
this trips heap verification and tears the helper down with status
`0xC0000374`; `approve` masks the failure, so the credential the
user meant to save never reaches `CredWriteW()` and the next
session prompts for it again.

The bug has the same shape as the one fixed in the previous commit:
the allocation leaves no room for the terminating NUL, and the
`sizeOfBuffer` argument to `_snwprintf_s()` is a byte count where
the API expects a WCHAR count, which lets the safe-CRT runtime
write the terminator out of bounds.

Apply the same remedy d22a488482 (wincred: avoid memory corruption,
2025-11-17) applied in `get_credential()`: allocate `(wlen + 1) *
sizeof(WCHAR)` bytes and pass `wlen + 1` as the destination
capacity in WCHARs.

This closes the second of the two heap writes tracked under
GHSA-rxqw-wxqg-g7hw.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agowincred: avoid memory corruption when erasing a credential
Johannes Schindelin [Thu, 16 Jul 2026 14:27:50 +0000 (14:27 +0000)] 
wincred: avoid memory corruption when erasing a credential

The earlier d22a488482 (wincred: avoid memory corruption, 2025-11-17)
repaired only get_credential(); match_cred_password() has the same
defect and is reached on `git credential reject`. When Git asks the
helper to erase a stored credential whose password was supplied by
the caller, the helper copies the candidate's password into a freshly
allocated buffer for comparison. That copy overruns the allocation
by one WCHAR of NUL, which on uninstrumented Windows manifests as
process termination with status 0xC0000374. Because the helper can
die before reaching CredDeleteW(), `git credential reject` masks the
failure and the rejected credential remains stored.

CredentialBlobSize is documented as a byte count, so for an N-WCHAR
blob it equals N * sizeof(WCHAR). The pre-fix code allocated that
many bytes and asked wcsncpy_s to copy N wide characters, but
wcsncpy_s always appends a terminating NUL WCHAR, writing one WCHAR
past the allocation. The destination-capacity argument was also
passed in bytes rather than in WCHAR elements as the API requires,
so the safe-CRT runtime never rejected the copy.

See GHSA-rxqw-wxqg-g7hw.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agorevision: fix --no-walk path filtering regression
Kristofer Karlsson [Thu, 16 Jul 2026 10:47:58 +0000 (10:47 +0000)] 
revision: fix --no-walk path filtering regression

Since dd4bc01c0a (revision: use priority queue for non-limited
streaming walks, 2026-05-27), "git rev-list --no-walk <commit>
-- <path>" ignores the path arguments and outputs all commits
regardless of whether they touch the given paths.

That commit introduced a REV_WALK_NO_WALK enum value to separate
--no-walk from the streaming walk in get_revision_1(). The new
case skips process_parents(), which is correct for not enqueuing
parents, but also skips try_to_simplify_commit() which
process_parents() calls to evaluate whether each commit touches
the given paths.

Add a call to try_to_simplify_commit() for the
REV_WALK_NO_WALK case, folding it into the existing
REV_WALK_REFLOG case which already does the same.

Add tests for --no-walk path filtering to t6017. The
"single commit, match" test is defensive and passes without
the fix, while the other two fail without it.

Reported-by: Peter Colberg <pcolberg@redhat.com>
Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoMerge branch 'kk/streaming-walk-pqueue' into kk/no-walk-pathspec-fix
Junio C Hamano [Thu, 16 Jul 2026 17:53:00 +0000 (10:53 -0700)] 
Merge branch 'kk/streaming-walk-pqueue' into kk/no-walk-pathspec-fix

* kk/streaming-walk-pqueue: (280 commits)
  revision: use priority queue for non-limited streaming walks
  revision: introduce rev_walk_mode to clarify get_revision_1()
  pack-objects: call release_revisions() after cruft traversal
  The 9th batch
  The 8th batch
  The 7th batch
  Start preparing for 2.54.1
  The 6th batch
  send-pack: pass negotiation config in push
  remote: add remote.*.negotiationInclude config
  fetch: add --negotiation-include option for negotiation
  negotiator: add have_sent() interface
  remote: add remote.*.negotiationRestrict config
  transport: rename negotiation_tips
  fetch: add --negotiation-restrict option
  t5516: fix test order flakiness
  repack: allow `--write-midx=incremental` without `--geometric`
  repack: introduce `--write-midx=incremental`
  repack: implement incremental MIDX repacking
  packfile: ensure `close_pack_revindex()` frees in-memory revindex
  ...

11 days agoMerge branch 'master' of https://github.com/j6t/git-gui
Junio C Hamano [Thu, 16 Jul 2026 17:48:52 +0000 (10:48 -0700)] 
Merge branch 'master' of https://github.com/j6t/git-gui

* 'master' of https://github.com/j6t/git-gui:
  git-gui: allow larger width for the commit message field
  git-gui: reduce complexity of the quiet msgfmt rule
  git-gui: drop msgfmt --statistics output
  git-gui i18n: Update Bulgarian translation (562t)

11 days agoMerge branch 'master' of https://github.com/j6t/gitk
Junio C Hamano [Thu, 16 Jul 2026 17:47:40 +0000 (10:47 -0700)] 
Merge branch 'master' of https://github.com/j6t/gitk

* 'master' of https://github.com/j6t/gitk:
  gitk: make "make -s" silent
  gitk i18n: Update Bulgarian translation (329t)
  gitk: spanish translations

12 days agorefs: remove remaining uses of `the_repository`
Patrick Steinhardt [Thu, 16 Jul 2026 05:33:07 +0000 (07:33 +0200)] 
refs: remove remaining uses of `the_repository`

There are still a couple of callsites that use `the_repository`. Convert
these to instead use a repository injected by the caller. This allows us
to remove `USE_THE_REPOSITORY_VARIABLE`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agoworktree: pass repository to public functions
Patrick Steinhardt [Thu, 16 Jul 2026 05:33:06 +0000 (07:33 +0200)] 
worktree: pass repository to public functions

Refactor remaining public functions that still depend on
`the_repository` to instead receive a repository as parameter. This
allows us to get rid of `USE_THE_REPOSITORY_VARIABLE`.

Adapt callers accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agoworktree: pass repository to file-local functions
Patrick Steinhardt [Thu, 16 Jul 2026 05:33:05 +0000 (07:33 +0200)] 
worktree: pass repository to file-local functions

We have a bunch of file-local functions that use `the_repository`.
Adapt them so that the repository is instead passed as a parameter so
that we can get rid of this dependency.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agoworktree: refactor code to use available repositories
Patrick Steinhardt [Thu, 16 Jul 2026 05:33:04 +0000 (07:33 +0200)] 
worktree: refactor code to use available repositories

In "worktree.c" we have lots of users of `the_repository` that already
have a repository available to them. Convert all of them to use that
repository instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agorefs/files: drop `USE_THE_REPOSITORY_VARIABLE`
Patrick Steinhardt [Thu, 16 Jul 2026 05:33:03 +0000 (07:33 +0200)] 
refs/files: drop `USE_THE_REPOSITORY_VARIABLE`

We have a bunch of users of `the_repository` in the "files" backend, all
of which are trivial to convert to instead use the backend's own repo.
Do so.

There is one more dependency on global state though via `ignore_case`,
and thus we can't trivially remove `USE_THE_REPOSITORY_VARIABLE`. But
this is the only use of global state, and we want to ensure that we
don't unwittingly reintroduce a dependency on `the_repository` going
forward.

Add an extern declaration for `ignore_case` so that it becomes
accessible even without `USE_THE_REPOSITORY_VARIABLE` and drop the
define itself.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agorefs/packed: de-globalize handling of "core.packedRefsTimeout"
Patrick Steinhardt [Thu, 16 Jul 2026 05:33:02 +0000 (07:33 +0200)] 
refs/packed: de-globalize handling of "core.packedRefsTimeout"

When locking the "packed-refs" file we allow the user to configure a
timeout for how long we try taking the lock. This is configurable via
"core.packedRefsTimeout", which we parse in `packed_refs_lock()`.

The parsed value is stored in function-static variables though, which of
course has the effect that we'll only ever use the timeout configured in
the first packed reference store that we see. Consequently, if we ever
were to handle stores from different repositories, then we'd use the
same configuration for both stores even if they diverge.

This is of course a somewhat theoretical concern -- we don't typically
handle multiple packed stores, and even if we did it's very unlikely
that the user has configured different timeout values for each of them.
But still, this is a code smell, and an unnecessary one, too.

Fix the issue by moving the value into `struct packed_ref_store` so that
it can be parsed per store.

This removes the last callsite that still used `the_repository`, so drop
the `USE_THE_REPOSITORY_VARIABLE` define.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agoMerge branch 'master' of github.com:alshopov/git-gui
Johannes Sixt [Thu, 16 Jul 2026 09:05:03 +0000 (11:05 +0200)] 
Merge branch 'master' of github.com:alshopov/git-gui

* 'master' of github.com:alshopov/git-gui:
  git-gui: allow larger width for the commit message field

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
12 days agoMerge branch 'hn/silence-make-s'
Johannes Sixt [Thu, 16 Jul 2026 09:02:20 +0000 (11:02 +0200)] 
Merge branch 'hn/silence-make-s'

* hn/silence-make-s:
  git-gui: reduce complexity of the quiet msgfmt rule
  git-gui: drop msgfmt --statistics output

12 days agoMerge branch 'spanish_pr_bis' of github.com:basuradeluis/gitkbis
Johannes Sixt [Thu, 16 Jul 2026 08:53:01 +0000 (10:53 +0200)] 
Merge branch 'spanish_pr_bis' of github.com:basuradeluis/gitkbis

* 'spanish_pr_bis' of github.com:basuradeluis/gitkbis:
  gitk: spanish translations

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
12 days agoremote-curl: simplify passing of push specs
René Scharfe [Wed, 15 Jul 2026 04:41:17 +0000 (06:41 +0200)] 
remote-curl: simplify passing of push specs

The push specs are kept in a strvec, whose array is NULL-terminated.
Pass only that to the protocol handlers, which avoids dealing with item
counts and their conversions from size_t to int, slightly simplifying
the code.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agoThe 3rd batch for Git 2.56
Junio C Hamano [Wed, 15 Jul 2026 20:24:06 +0000 (13:24 -0700)] 
The 3rd batch for Git 2.56

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agoMerge branch 'rs/blame-abbrev-marks'
Junio C Hamano [Wed, 15 Jul 2026 20:24:19 +0000 (13:24 -0700)] 
Merge branch 'rs/blame-abbrev-marks'

The alignment of commit object name abbreviations in 'git blame'
output has been optimized to reserve a column for marks (caret,
question mark, or asterisk) only when such marks are actually shown.

* rs/blame-abbrev-marks:
  blame: reserve mark column only if necessary

12 days agoMerge branch 'mg/meson-hook-list-buildfix'
Junio C Hamano [Wed, 15 Jul 2026 20:24:19 +0000 (13:24 -0700)] 
Merge branch 'mg/meson-hook-list-buildfix'

A racy build failure under Meson has been corrected by ensuring that
the generated header file 'hook-list.h' is built before compiling
files in 'builtin_sources' that depend on it.

* mg/meson-hook-list-buildfix:
  meson: restore hook-list.h to builtin_sources

12 days agoMerge branch 'jk/bloom-leak-fixes'
Junio C Hamano [Wed, 15 Jul 2026 20:24:19 +0000 (13:24 -0700)] 
Merge branch 'jk/bloom-leak-fixes'

Various memory leaks in the Bloom-filter code paths that are exposed
when running tests with the 'GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1'
environment variable have been plugged.

* jk/bloom-leak-fixes:
  line-log: drop extra copy of range with bloom filters
  revision: avoid leaking bloom keyvecs with multiple traversals
  bloom: make bloom-filter slab initialization idempotent

12 days agoMerge branch 'ps/history-drop'
Junio C Hamano [Wed, 15 Jul 2026 20:24:18 +0000 (13:24 -0700)] 
Merge branch 'ps/history-drop'

The experimental 'git history' command has been taught a new 'drop'
subcommand to remove a commit, with its descendants replayed onto its
parent.

* ps/history-drop:
  builtin/history: implement "drop" subcommand
  builtin/history: split handling of ref updates into two phases
  replay: expose `replay_result_queue_update()`
  reset: stop assuming that the caller passes in a clean index
  reset: allow the caller to specify the current HEAD object
  reset: introduce ability to skip updating HEAD
  reset: introduce dry-run mode
  reset: modernize flags passed to `reset_working_tree()`
  reset: rename `reset_head()`
  reset: drop `USE_THE_REPOSITORY_VARIABLE`
  read-cache: split out function to drop unmerged entries to stage 0

12 days agoMerge branch 'ps/odb-drop-whence'
Junio C Hamano [Wed, 15 Jul 2026 20:24:18 +0000 (13:24 -0700)] 
Merge branch 'ps/odb-drop-whence'

The 'whence' field in 'struct object_info' has been removed.  The
backend-specific object information retrieval has been refactored into
an opt-in 'struct object_info_source' structure.

* ps/odb-drop-whence:
  odb: document object info fields
  odb: drop `whence` field from object info
  treewide: convert users of `whence` to the new source field
  odb: add `source` field to struct object_info_source
  odb: make backend-specific fields optional
  packfile: thread odb_source_packed through packed_object_info()

12 days agoMerge branch 'ps/refs-writing-subcommands'
Junio C Hamano [Wed, 15 Jul 2026 20:24:18 +0000 (13:24 -0700)] 
Merge branch 'ps/refs-writing-subcommands'

The 'git refs' toolbox has been extended with new 'create', 'delete',
'update', and 'rename' subcommands to create, delete, update, and
rename references, respectively.

* ps/refs-writing-subcommands:
  builtin/refs: add "rename" subcommand
  builtin/refs: add "create" subcommand
  builtin/refs: add "update" subcommand
  builtin/refs: add "delete" subcommand
  builtin/refs: drop `the_repository`

12 days agoMerge branch 'jc/history-message-prep-fix'
Junio C Hamano [Wed, 15 Jul 2026 20:24:18 +0000 (13:24 -0700)] 
Merge branch 'jc/history-message-prep-fix'

A write file stream resource leak has been fixed as part of a code
cleanup.

* jc/history-message-prep-fix:
  history: streamline message preparation and plug file stream leak

12 days agosubmodule--helper: avoid use of %zu for now
Junio C Hamano [Wed, 15 Jul 2026 20:10:06 +0000 (13:10 -0700)] 
submodule--helper: avoid use of %zu for now

Since d7d850e2b9 (CodingGuidelines: mention C99 features we can't
use, 2022-10-10), our CodingGuidelines document has explicitly
forbidden the use of '%z' and '%zu' printf() format specifiers,
even though C99 does support them.  However, a new instance crept
in via 82c36fa0a9 (submodule: hash the submodule name for the
gitdir path, 2026-01-12).

We could claim that this is an unintentional weather balloon that
nobody has complained about for the past six months since Git 2.54,
proving that it is now safe to use these format specifiers.  But
(1) it is probably too early to make that claim, as distributions
often stick to a stale version for several releases, and (2) it is
unlikely that a failure in this code path would manifest as a
major user-visible breakage that would trigger a failure report to
percolate down to us.

Instead, let's stick to the established workaround recommended by
our CodingGuidelines, which is to cast the value to (uintmax_t) and
format it with PRIuMAX, at least for now.  Even if we eventually
perform a bulk update using a Coccinelle script to transition to %z
and %zu in the future, adding one more instance to the pile that
will need such a conversion is hardly a tragedy.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agot7614: avoid hiding git's exit code in a pipe
Shlok Kulshreshtha [Wed, 15 Jul 2026 11:33:44 +0000 (17:03 +0530)] 
t7614: avoid hiding git's exit code in a pipe

The exit code of the upstream command in a pipe is ignored, so in

git cat-file commit HEAD | sed -e "1,/^\$/d" >actual

a crash of "git cat-file" would go unnoticed: the exit code of the
pipeline is that of "sed", which happily succeeds on empty input. The
test would thus pass even though "git cat-file" failed.

Write the output of "git cat-file" to a file first and run "sed" on
that file, so that the exit codes of both commands are checked by the
&&-chain.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: do not record dropped commits as rewritten
Phillip Wood [Wed, 15 Jul 2026 15:22:03 +0000 (16:22 +0100)] 
sequencer: do not record dropped commits as rewritten

If a commit gets dropped because its changes are already upstream
then we should not record it as rewritten. As well as confusing any
post-rewrite hooks, it means we end up copying the notes from the
dropped commit to the commit that was picked immediately before the
one that was dropped.

While we do not want to record the dropped commit as rewritten, if
it is the final commit in a chain of fixups then we need to flush
the list of rewritten commits. The behavior of an "edit" command
where the commit is dropped is changed so that "rebase --continue"
will not amend the previous pick. However, as the code comment notes
it will still be erroneously recorded as rewritten when the rebase
continues. That will need to be addressed separately along with not
recording skipped commits as rewritten.

The initialization of "drop_commit" is moved to ensure it is initialized
when rewording a fast-forwarded commit.

Reported-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Tested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: use an enum to represent result of picking a commit
Phillip Wood [Wed, 15 Jul 2026 15:22:02 +0000 (16:22 +0100)] 
sequencer: use an enum to represent result of picking a commit

Rather than using an integer where -1 is an error, 0 is success and 1
indicates there were conflicts, use an enum. This is clearer and lets
us add a separate return value for commits that are dropped because
they become empty in the next commit.

Note we continue to use "return error(...)" to return errors and
take advantage of C's lax typing of enums

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: simplify pick_one_commit()
Phillip Wood [Wed, 15 Jul 2026 15:22:01 +0000 (16:22 +0100)] 
sequencer: simplify pick_one_commit()

Unless we're rebasing, all we do in pick_one_commit() is call
do_pick_commit() and return its result. Simplify the code by returning
early if we're not rebasing so that we don't have to repeatedly call
is_rebase_i() in the rest of the function. Note that there are a couple
of conditions that do not call is_rebase_i() but they check for either
an "edit" or a "fixup" command, both of which imply we're rebasing.

The only block that does not return early is the one guarded by
"!res". Move the return into that block to make it clear that after
recording the commit as rewritten, all we do is return from the
function.

As the conditional blocks are all mutually exclusive (either the
conditions are mutually exclusive, or an earlier conditional block
that would match a later one contains a "return" statement) chain
them together with "else if" to make that clear.

While we could remove "res" from the conditions below "if (!res)"
they are left alone because, when we start using an enum in the next
commit, it makes it clear that these clauses are handling cases where
there are conflicts.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: remove unnecessary condition in pick_one_commit()
Phillip Wood [Wed, 15 Jul 2026 15:22:00 +0000 (16:22 +0100)] 
sequencer: remove unnecessary condition in pick_one_commit()

item->commit holds the commit to be picked and so it must be non-NULL
otherwise pick_one_commit() would not know which commit to pick.
It is also unconditionally dereferenced in do_pick_commit() which is
called at the top of this function. Therefore the check to see if it
is non-NULL is superfluous.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: simplify handling of fixup with conflicts
Phillip Wood [Wed, 15 Jul 2026 15:21:59 +0000 (16:21 +0100)] 
sequencer: simplify handling of fixup with conflicts

Commit e032abd5a0 (rebase: fix rewritten list for failed pick,
2023-09-06) introduced an early return when res == -1, so if
we enter this conditional block then res is positive. After the
last couple of commits the only possible positive value is 1. That
means we can simplify the code by removing the conditional call to
intend_to_amend() and have error_failed_squash() request that it is
called in error_with_patch() instead.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: remove unnecessary "or" in pick_one_commit()
Phillip Wood [Wed, 15 Jul 2026 15:21:58 +0000 (16:21 +0100)] 
sequencer: remove unnecessary "or" in pick_one_commit()

If error_with_patch(..., res, ...) succeeds then it returns "res", if
it fails then it returns -1. This means that or-ing the return value
with "res" is pointless as the result is the same as the return value.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: never reschedule on failed commit
Phillip Wood [Wed, 15 Jul 2026 15:21:57 +0000 (16:21 +0100)] 
sequencer: never reschedule on failed commit

If "git commit" fails to run then run_git_commit() returns -1 which
causes the current command to be rescheduled. This is incorrect as
we have successfully picked the commit and have written all the state
files we need to successfully commit when the user continues. Fix this
by converting -1 to 1 which matches what do_merge() does.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agosequencer: be more careful with external merge
Phillip Wood [Wed, 15 Jul 2026 15:21:56 +0000 (16:21 +0100)] 
sequencer: be more careful with external merge

If an external merge strategy cannot merge (for example because it
would overwrite an untracked file) it exits with a non-zero exit
code other than 1. This should be treated differently from a merge
with conflicts, which is signaled by an exit code of 1, because, as
the merge failed, we need to reschedule the last pick. The caller
expects us to return -1 in this case. Also reschedule without trying
to merge if the commit message cannot be written as that prevents us
from successfully picking the commit.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 days agot3400: restore coverage for note copying with apply backend
Phillip Wood [Wed, 15 Jul 2026 15:21:55 +0000 (16:21 +0100)] 
t3400: restore coverage for note copying with apply backend

Now that the merge backend is the default, we have lost coverage for
"git rebase --apply" copying notes. Fix this by replacing "-m" with
"--apply" as the previous test which uses the default backend now
checks the merge backend.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agobuiltin/cat-file: filter objects via object database
Patrick Steinhardt [Wed, 15 Jul 2026 06:22:39 +0000 (08:22 +0200)] 
builtin/cat-file: filter objects via object database

When batching all objects, git-cat-file(1) reaches into the internals of
the object database and manually manages bitmaps to apply object
filters. This creates coupling between the command and the internals of
the respective backend.

Refactor git-cat-file(1) to use the new object filter option when
batching all objects. This significantly simplifies the logic and
ensures that we don't have to reach into internals of the "files" source
anymore.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agoodb: introduce object filters to `odb_for_each_object()`
Patrick Steinhardt [Wed, 15 Jul 2026 06:22:38 +0000 (08:22 +0200)] 
odb: introduce object filters to `odb_for_each_object()`

The function `for_each_bitmapped_object()` can be used to iterate
through all objects covered by a bitmap. The benefit of this function is
that it allows the caller to efficiently handle some object filters. For
example, this can be used to filter out objects of a specific type with
some simple bitmap operations. But callers are currently required to
manually wire up the use of bitmaps though, and to do so they have to
reach into internals of a given object database source.

Introduce a new `struct odb_for_each_object_options::filter` field so
that the interface becomes generic. When set, then a backend may
optionally use the filter to skip some objects that it would have
otherwise yielded.

Note that the respective backends are free to ignore this field if they
cannot meaningfully optimize for a given filter, and consequently
callers need to verify whether they actually want the returned objects.
While annoying, we cannot easily lift this restriction anyway as the
object filter infrastructure supports some filters that cannot be
answered by the object database alone.

An alternative might be to limit the filters to only those that _can_ be
answered by backends. But ultimately, the filters that can be answered
efficiently by the "packed" backend are completely disjunct from those
that can be answered by the "loose" backend, and consequently the set of
filters supported by all backends would be empty. Furthermore, it would
require us to make assumptions about capabilities of future backends,
which may be able to efficiently handle more filters than current ones.
So in the end, this alternative would only limit us artificially.

Implement the logic for the "packed" source. Note that we use the new
function `prepare_bitmap_git_for_source()` to open the bitmap: as the
backend operates on a single object source, we must only use bitmaps
that belong to that specific source. Otherwise we might yield objects
that are not part of the source at all, and with multiple sources we
would enumerate the same bitmap once per source.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agopack-bitmap: introduce function to open bitmap for a single source
Patrick Steinhardt [Wed, 15 Jul 2026 06:22:37 +0000 (08:22 +0200)] 
pack-bitmap: introduce function to open bitmap for a single source

The function `prepare_bitmap_git()` opens the first bitmap it can find
in any of the object sources connected to the repository. In a
subsequent commit, the "packed" object database backend will learn to
use bitmaps to answer object filters when enumerating objects. That
backend operates on a single object source though, so using a bitmap
that potentially belongs to a different source would be wrong:

  - The source would yield objects that are not part of the source
    itself.

  - The object source info would be attributed to the wrong source.

  - With multiple sources, each source would enumerate the same bitmap
    another time.

Introduce a new function `prepare_bitmap_git_for_source()` that only
opens bitmaps belonging to the given object source.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agopack-bitmap: drop `_1` suffix from functions that open bitmaps
Patrick Steinhardt [Wed, 15 Jul 2026 06:22:36 +0000 (08:22 +0200)] 
pack-bitmap: drop `_1` suffix from functions that open bitmaps

In the preceding commit we've refactored how we open bitmaps. As part of
the refactoring we have consolidated `open_pack_bitmap()` as well as
`open_midx_bitmap()` into `open_bitmap_for_source()`. Consequently, we
only have their `open_pack_bitmap_1()` and `open_midx_bitmap_1()`
variants left over, where the `_1` suffix doesn't really make much sense
anymore.

Drop the suffix.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agopack-bitmap: iterate object sources when opening bitmaps
Patrick Steinhardt [Wed, 15 Jul 2026 06:22:35 +0000 (08:22 +0200)] 
pack-bitmap: iterate object sources when opening bitmaps

When opening a bitmap for a repository we perform two steps:

  - We first look for a multi-pack index bitmap in any of the object
    sources connected to the repository.

  - We then look for a packfile bitmap in any of the packfiles of any of
    the object sources.

Both of these steps thus iterate through object sources themselves, one
via `odb_prepare_alternates()` and one via `repo_for_each_pack()`. This
layout makes it hard to introduce a way to open the bitmap of one
specific object source, which is functionality that we'll require in a
subsequent commit.

Reverse the loop so that we instead loop through all sources in the
outer loop, and then for each source we try to load its bitmap via
either the multi-pack index or via a packfile.

Note that this changes the precedence of bitmaps in one specific edge
case: when an earlier object source only has a packfile bitmap, but a
later source has a multi-pack index bitmap, we now pick the packfile
bitmap of the earlier source. Previously, a multi-pack index bitmap from
any source would have taken precedence over all packfile bitmaps. Given
that object sources are ordered such that the local source comes first,
this arguably is an improvement, as we now prefer local bitmaps over
bitmaps in alternates. Furthermore, we already warn about repositories
that have multiple bitmaps, so this setup is broken and thus arguably
not worth worrying about too much.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agopack-bitmap: allow aborting iteration of bitmapped objects
Patrick Steinhardt [Wed, 15 Jul 2026 06:22:34 +0000 (08:22 +0200)] 
pack-bitmap: allow aborting iteration of bitmapped objects

In a subsequent commit we'll lift iteration of bitmapped objects into
the "packed" backend and make it accessible via `odb_for_each_object()`.
The calling convention for that function is that the callback may return
a non-zero exit code, and if so we'll abort iteration. This is currently
impossible to realize though, as `for_each_bitmapped_object()` will
ignore any return value and just churn through all objects completely.

This doesn't matter to the callers of `for_each_bitmapped_object()`, as
there's only one of them in git-cat-file(1), and the callbacks we pass
always return zero. But once we move the logic into the generic
infrastructure it becomes a latent bug waiting to happen.

Refactor the code so that the return value of the `show_reach` callback
is not ignored anymore. Instead, returning a non-zero value will cause
us to abort iteration in both `show_objects_for_type()` and in
`for_each_bitmapped_object()`.

Note though that there's a second user of `show_objects_for_type()` with
`traverse_bitmap_commit_list()`, and that function does indeed invoke
callbacks that may return non-zero. This non-zero return value never had
any effect at all though, and the callbacks that return non-zero values
are only ever invoked via `traverse_bitmap_commit_list()`. Consequently,
we adapt them to always return 0.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 days agopack-objects: drop unused return value from add_object_entry()
Jeff King [Wed, 15 Jul 2026 06:22:33 +0000 (08:22 +0200)] 
pack-objects: drop unused return value from add_object_entry()

This function returns 0/1 to its caller to tell them whether we actually
added a new entry (or if we considered it redundant). But nobody has
relied on that behavior since 5379a5c5ee (Thin pack generation:
optimization., 2006-04-05).

The extra return does not hurt much, but it is a bit confusing. We have
a sister function, add_object_entry_from_bitmap(), which has the same
return value semantics. That function is about to change to always return
0 (not void, because it must conform to a callback function interface).
So with that change, we'd have two related functions which both return
an "int" but with different semantics.

Let's drop the unused "int" return from add_object_entry() entirely,
which makes it more clear that the two functions have diverged.

Signed-off-by: Jeff King <peff@peff.net>
[ps: slightly massaged the commit message]
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>