* [PATCH v3 1/3] doc: config: terminate runaway lists
From: Tuomas Ahola @ 2026-06-11 16:19 UTC (permalink / raw)
To: git
Cc: Kristoffer Haugsbakk, Junio C Hamano, Jeff King,
Jean-Noël Avila, Tuomas Ahola
In-Reply-To: <20260611161946.12166-1-taahol@utu.fi>
There are many places in git-config(1) where paragraphs that should
logically come after a list are instead appended to the last item of
the list. This is a well-documented quirk of AsciiDoc, and can be
mitigated by enclosing the list in an open block:
--
* first item
* last item
--
+
New paragraph after the list.
Fix the issue accordingly.
Signed-off-by: Tuomas Ahola <taahol@utu.fi>
---
Notes (doc-diff):
diff --git a/29bd7ed5127255713c1ac2f43b7c6f257d7b4594/home/taahol/share/man/man1/git-config.1 b/c9131b23fd1c8611fde5664fcfd4e6d5283648ad/home/taahol/share/man/man1/git-config.1
index 326782e637..d915897ca5 100644
--- a/29bd7ed5127255713c1ac2f43b7c6f257d7b4594/home/taahol/share/man/man1/git-config.1
+++ b/c9131b23fd1c8611fde5664fcfd4e6d5283648ad/home/taahol/share/man/man1/git-config.1
@@ -234,10 +234,10 @@ OPTIONS
sanity-check is performed to ensure that the given value is
canonicalize-able as an ANSI color, but it is written as-is.
- If the command is in list mode, then the --type <type> argument
- will apply to each listed config value. If the value does not
- successfully parse in that format, then it will be omitted from
- the list.
+ If the command is in list mode, then the --type <type> argument
+ will apply to each listed config value. If the value does not
+ successfully parse in that format, then it will be omitted from the
+ list.
--bool, --int, --bool-or-int, --path, --expiry-date
Historical options for selecting a type specifier. Prefer instead
@@ -841,9 +841,9 @@ CONFIGURATION FILE
Boolean false literals are no, off, false, 0 and the empty
string.
- When converting a value to its canonical form using the
- --type=bool type specifier, git config will ensure that the
- output is "true" or "false" (spelled in lowercase).
+ When converting a value to its canonical form using the --type=bool
+ type specifier, git config will ensure that the output is "true" or
+ "false" (spelled in lowercase).
integer
The value for many variables that specify various sizes can be
@@ -5869,28 +5869,26 @@ CONFIGURATION FILE
exactly match the value advertised by the server for the
"token" field.
- If any of these conditions is not met for any field name listed
- in promisor.checkFields, the advertised remote "foo" is
- rejected.
+ If any of these conditions is not met for any field name listed in
+ promisor.checkFields, the advertised remote "foo" is rejected.
- For the "partialCloneFilter" field, this allows the client to
- ensure that the server’s filter matches what it expects
- locally, preventing inconsistencies in filtering behavior. For
- the "token" field, this can be used to verify that
- authentication credentials match expected values.
+ For the "partialCloneFilter" field, this allows the client to
+ ensure that the server’s filter matches what it expects locally,
+ preventing inconsistencies in filtering behavior. For the "token"
+ field, this can be used to verify that authentication credentials
+ match expected values.
- Field values are compared case-sensitively.
+ Field values are compared case-sensitively.
- The "name" and "url" fields are always checked according to the
- promisor.acceptFromServer policy, independently of this
- setting.
+ The "name" and "url" fields are always checked according to the
+ promisor.acceptFromServer policy, independently of this setting.
- The field names and values should be passed by the server
- through the "promisor-remote" capability by using the
- promisor.sendFields config variable. The fields are checked
- only if the promisor.acceptFromServer config variable is not
- set to "None". If set to "None", this config variable has no
- effect. See gitprotocol-v2(5).
+ The field names and values should be passed by the server through
+ the "promisor-remote" capability by using the promisor.sendFields
+ config variable. The fields are checked only if the
+ promisor.acceptFromServer config variable is not set to "None". If
+ set to "None", this config variable has no effect. See gitprotocol-
+ v2(5).
promisor.storeFields
A comma or space separated list of additional remote related field
@@ -6630,15 +6628,15 @@ CONFIGURATION FILE
the top-level --git-dir command-line option, or the GIT_DIR
environment variable (see git(1)).
- If you do not use bare repositories in your workflow, then it
- may be beneficial to set safe.bareRepository to explicit in
- your global config. This will protect you from attacks that
- involve cloning a repository that contains a bare repository
- and running a Git command within that directory.
+ If you do not use bare repositories in your workflow, then it may
+ be beneficial to set safe.bareRepository to explicit in your global
+ config. This will protect you from attacks that involve cloning a
+ repository that contains a bare repository and running a Git
+ command within that directory.
- This config setting is only respected in protected
- configuration (see the section called “SCOPES”). This prevents
- untrusted repositories from tampering with this value.
+ This config setting is only respected in protected configuration
+ (see the section called “SCOPES”). This prevents untrusted
+ repositories from tampering with this value.
safe.directory
These config entries specify Git-tracked directories that are
Documentation/config.adoc | 4 +++-
Documentation/config/promisor.adoc | 2 ++
Documentation/config/safe.adoc | 2 ++
Documentation/git-config.adoc | 2 ++
4 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/Documentation/config.adoc b/Documentation/config.adoc
index dcea3c0c15..fc48c1c461 100644
--- a/Documentation/config.adoc
+++ b/Documentation/config.adoc
@@ -276,13 +276,15 @@ boolean::
When a variable is said to take a boolean value, many
synonyms are accepted for 'true' and 'false'; these are all
case-insensitive.
-
++
+--
true;; Boolean true literals are `yes`, `on`, `true`,
and `1`. Also, a variable defined without `= <value>`
is taken as true.
false;; Boolean false literals are `no`, `off`, `false`,
`0` and the empty string.
+--
+
When converting a value to its canonical form using the `--type=bool` type
specifier, 'git config' will ensure that the output is "true" or
diff --git a/Documentation/config/promisor.adoc b/Documentation/config/promisor.adoc
index b0fa43b839..39af63dcb8 100644
--- a/Documentation/config/promisor.adoc
+++ b/Documentation/config/promisor.adoc
@@ -63,11 +63,13 @@ If one of these field names (e.g., "token") is being checked for an
advertised promisor remote (e.g., "foo"), three conditions must be met
for the check of this specific field to pass:
+
+--
1. The corresponding local configuration (e.g., `remote.foo.token`)
must be set.
2. The server must advertise the "token" field for remote "foo".
3. The value of the locally configured `remote.foo.token` must exactly
match the value advertised by the server for the "token" field.
+--
+
If any of these conditions is not met for any field name listed in
`promisor.checkFields`, the advertised remote "foo" is rejected.
diff --git a/Documentation/config/safe.adoc b/Documentation/config/safe.adoc
index 2d45c98b12..5ae4476b24 100644
--- a/Documentation/config/safe.adoc
+++ b/Documentation/config/safe.adoc
@@ -2,10 +2,12 @@ safe.bareRepository::
Specifies which bare repositories Git will work with. The currently
supported values are:
+
+--
* `all`: Git works with all bare repositories. This is the default.
* `explicit`: Git only works with bare repositories specified via
the top-level `--git-dir` command-line option, or the `GIT_DIR`
environment variable (see linkgit:git[1]).
+--
+
If you do not use bare repositories in your workflow, then it may be
beneficial to set `safe.bareRepository` to `explicit` in your global
diff --git a/Documentation/git-config.adoc b/Documentation/git-config.adoc
index 00545b2054..8439ce97df 100644
--- a/Documentation/git-config.adoc
+++ b/Documentation/git-config.adoc
@@ -221,6 +221,7 @@ Use `--no-value` to unset _<pattern>_.
+
Valid `<type>`'s include:
+
+--
- 'bool': canonicalize values `true`, `yes`, `on`, and positive
numbers as "true", and values `false`, `no`, `off` and `0` as
"false".
@@ -239,6 +240,7 @@ Valid `<type>`'s include:
escape sequence. When setting a value, a sanity-check is performed to ensure
that the given value is canonicalize-able as an ANSI color, but it is written
as-is.
+--
+
If the command is in `list` mode, then the `--type <type>` argument will apply
to each listed config value. If the value does not successfully parse in that
--
2.30.2
^ permalink raw reply related
* [PATCH v3 3/3] doc: git-config: escape erroneous highlight markup
From: Tuomas Ahola @ 2026-06-11 16:19 UTC (permalink / raw)
To: git
Cc: Kristoffer Haugsbakk, Junio C Hamano, Jeff King,
Jean-Noël Avila, Tuomas Ahola
In-Reply-To: <20260611161946.12166-1-taahol@utu.fi>
Paired octothorpes are used in AsciiDoc to mark highlighted text,
<mark> being the equivalent HTML tag. To use the symbol as a literal
character, it can be escaped with backticks.
Do so in git-config.adoc.
While at it, tweak the text slightly to make it scan better.
Signed-off-by: Tuomas Ahola <taahol@utu.fi>
---
Notes (doc-diff):
diff --git a/ca65211ea4c351071c5e76dabe4700ad074b75d3/home/taahol/share/man/man1/git-config.1 b/e2d0cc8218242cc859daabb179af07ebf96fe459/home/taahol/share/man/man1/git-config.1
index e0e2bf3c36..1e9e49b197 100644
--- a/ca65211ea4c351071c5e76dabe4700ad074b75d3/home/taahol/share/man/man1/git-config.1
+++ b/e2d0cc8218242cc859daabb179af07ebf96fe459/home/taahol/share/man/man1/git-config.1
@@ -113,11 +113,11 @@ OPTIONS
--comment <message>
Append a comment at the end of new or modified lines.
- If <message> begins with one or more whitespaces followed by "", it
- is used as-is. If it begins with "", a space is prepended before it
+ If <message> begins with one or more whitespaces followed by #, it
+ is used as-is. If it begins with #, a space is prepended before it
is used. Otherwise, a string " # " (a space followed by a hash
- followed by a space) is prepended to it. And the resulting string
- is placed immediately after the value defined for the variable. The
+ followed by a space) is prepended to it. The resulting string is
+ placed immediately after the value defined for the variable. The
<message> must not contain linefeed characters (no multi-line
comments are permitted).
Documentation/git-config.adoc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-config.adoc b/Documentation/git-config.adoc
index 8439ce97df..57af010ade 100644
--- a/Documentation/git-config.adoc
+++ b/Documentation/git-config.adoc
@@ -119,10 +119,10 @@ OPTIONS
Append a comment at the end of new or modified lines.
+
If _<message>_ begins with one or more whitespaces followed
-by "#", it is used as-is. If it begins with "#", a space is
-prepended before it is used. Otherwise, a string " # " (a
+by `#`, it is used as-is. If it begins with `#`, a space is
+prepended before it is used. Otherwise, a string `" # "` (a
space followed by a hash followed by a space) is prepended
-to it. And the resulting string is placed immediately after
+to it. The resulting string is placed immediately after
the value defined for the variable. The _<message>_ must
not contain linefeed characters (no multi-line comments are
permitted).
--
2.30.2
^ permalink raw reply related
* Re: What's cooking in git.git (Jun 2026, #03)
From: Junio C Hamano @ 2026-06-11 16:10 UTC (permalink / raw)
To: Phillip Wood; +Cc: git
In-Reply-To: <3f10ac4d-45d1-4ae1-9079-17d7b52cc7e1@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
> Hi Junio
>
> On 09/06/2026 01:56, Junio C Hamano wrote:
>>
>> * pw/status-rebase-todo (2026-05-01) 2 commits
>> - status: improve rebase todo list parsing
>> - sequencer: factor out parsing of todo commands
>>
>> The display of the rebase todo list in "git status" has been
>> improved to correctly abbreviate object IDs for more commands and
>> avoid misinterpreting refs as object IDs.
>>
>> Waiting for response(s) to review comment(s).
>> cf. <xmqqbjdwcsno.fsf@gitster.g>
>
> I replied to that message with
> <4fafee2c-4151-45f4-a842-17d6b77d951c@gmail.com> I'm waiting to hear
> whether you agree that the unambiguous label case is unlikely enough to
> happen that we can ignore it.
Thanks.
I forgot to send the response to the message, so I just have done
so.
^ permalink raw reply
* What's cooking in git.git (Jun 2026, #04)
From: Junio C Hamano @ 2026-06-11 16:08 UTC (permalink / raw)
To: git
Here are the topics that have been cooking in my tree. Commits
prefixed with '+' are in 'next' (being in 'next' is a sign that a
topic is stable enough to be used and is a candidate to be in a
future release). Commits prefixed with '-' are only in 'seen', and
aren't considered "accepted" at all and may be annotated with a URL
to a message that raises issues but they are by no means exhaustive.
A topic without enough support may be discarded after a long period
of no activity (of course they can be resubmitted when new interests
arise).
A preview release Git 2.55-rc0 has been tagged and pushed out. There
may be a few more topics in 'next' and possibly outside 'next' that
we may want to include in the release that I didn't manage or I
forgot (please let me know).
Copies of the source code to Git live in many repositories, and the
following is a list of the ones I push into or their mirrors. Some
repositories have only a subset of branches.
With maint, master, next, seen, todo:
git://git.kernel.org/pub/scm/git/git.git/
git://repo.or.cz/alt-git.git/
https://kernel.googlesource.com/pub/scm/git/git/
https://github.com/git/git/
https://gitlab.com/git-scm/git/
With all the integration branches and topics broken out:
https://github.com/gitster/git/
Even though the preformatted documentation in HTML and man format
are not sources, they are published in these repositories for
convenience (replace "htmldocs" with "manpages" for the manual
pages):
git://git.kernel.org/pub/scm/git/git-htmldocs.git/
https://github.com/gitster/git-htmldocs.git/
Release tarballs are available at:
https://www.kernel.org/pub/software/scm/git/
--------------------------------------------------
[Graduated to 'master']
* gh/jump-auto-mode (2026-05-21) 1 commit
(merged to 'next' on 2026-06-02 at f70dd05c9c)
+ git-jump: pick a mode automatically when invoked without arguments
The 'git-jump' command (in contrib/) has been taught to automatically
pick a mode (merge, diff, or ws) when invoked without arguments.
cf. <20260522052821.GC861761@coredump.intra.peff.net>
source: <pull.2108.v3.git.1779371110195.gitgitgadget@gmail.com>
* hn/macos-linker-warning (2026-06-02) 1 commit
(merged to 'next' on 2026-06-04 at db2ca164c4)
+ config.mak.uname: avoid macOS linker warning on Xcode 16.3+
A linker warning on macOS when building with Xcode 16.3 or newer has
been avoided by passing -fno-common to the compiler when a
sufficiently new linker is detected.
source: <pull.2313.v3.git.git.1780385878555.gitgitgadget@gmail.com>
* ib/doc-push-default-simple (2026-05-25) 1 commit
(merged to 'next' on 2026-06-02 at 5c1ff2a769)
+ doc: clarify push.default=simple behavior
The documentation for `push.default = simple` has been clarified to
better explain its behavior, making it clear that it pushes the
current branch to a same-named branch on the remote, and detailing
the upstream requirements for centralized workflows.
cf. <pull.2115.v2.git.1779767888508.gitgitgadget@gmail.com>
source: <pull.2115.v2.git.1779767888508.gitgitgadget@gmail.com>
* jc/doc-monitor-ghci (2026-05-24) 1 commit
(merged to 'next' on 2026-06-02 at 46fb5fe1c2)
+ SubmittingPatches: proactively monitor GHCI pages
Encourage original authors to monitor the CI status.
source: <xmqq1pf0gpp3.fsf@gitster.g>
* kk/wildmatch-windows-ls-files-prereq (2026-05-28) 1 commit
(merged to 'next' on 2026-06-04 at 6dc748aa63)
+ t3070: skip ls-files tests with backslash patterns on Windows
In t3070-wildmatch, "via ls-files" test variants with patterns
containing backslash escapes are now skipped on Windows, avoiding 36
test failures caused by pathspec separator conversion.
cf. <xmqqecivjn7k.fsf@gitster.g>
source: <pull.2128.git.1779958849319.gitgitgadget@gmail.com>
* lp/http-fetch-pack-index-leak-fix (2026-06-01) 2 commits
(merged to 'next' on 2026-06-04 at f4090b5068)
+ http: fix memory leak in fetch_and_setup_pack_index()
+ http: cleanup function fetch_and_setup_pack_index()
A memory leak in `fetch_and_setup_pack_index()` when verification of
the downloaded pack index fails has been plugged. Also an obsolete
`unlink()` call on parse failure has been cleaned up.
cf. <20260529053659.GC1099450@coredump.intra.peff.net>
source: <cover.1780321770.git.lorenzo.pegorari2002@gmail.com>
* mm/doc-word-diff (2026-05-28) 1 commit
(merged to 'next' on 2026-06-04 at 9fa723ec63)
+ doc: clarify that --word-diff operates on line-level hunks
The documentation for "--word-diff" has been extended with a bit of
implementation detail of where these different words come from.
source: <pull.2113.v2.git.1779996106005.gitgitgadget@gmail.com>
* mm/line-log-cleanup (2026-05-28) 3 commits
(merged to 'next' on 2026-06-04 at 02f8bea278)
+ line-log: allow non-patch diff formats with -L
+ line-log: integrate -L output with the standard log-tree pipeline
+ revision: move -L setup before output_format-to-diff derivation
The `git log -L` implementation has been refactored to use the
standard diff output pipeline, enabling pickaxe and diff-filter to
work as expected. Additionally, metadata-only diff formats like
--raw and --name-only are now supported with -L.
cf. <B59BA5B1-184D-48A8-8BAD-11EB6F8EB50C@gmail.com>
source: <pull.2094.v3.git.1780001267.gitgitgadget@gmail.com>
* ps/odb-source-loose (2026-06-01) 19 commits
(merged to 'next' on 2026-06-04 at 660909ad66)
+ odb/source-loose: drop pointer to the "files" source
+ odb/source-loose: stub out remaining callbacks
+ odb/source-loose: wire up `write_object_stream()` callback
+ object-file: refactor writing objects to use loose source
+ odb/source-loose: wire up `write_object()` callback
+ loose: refactor object map to operate on `struct odb_source_loose`
+ odb/source-loose: wire up `freshen_object()` callback
+ odb/source-loose: drop `odb_source_loose_has_object()`
+ odb/source-loose: wire up `count_objects()` callback
+ odb/source-loose: wire up `find_abbrev_len()` callback
+ odb/source-loose: wire up `for_each_object()` callback
+ odb/source-loose: wire up `read_object_stream()` callback
+ odb/source-loose: wire up `read_object_info()` callback
+ odb/source-loose: wire up `close()` callback
+ odb/source-loose: wire up `reprepare()` callback
+ odb/source-loose: start converting to a proper `struct odb_source`
+ odb/source-loose: store pointer to "files" instead of generic source
+ odb/source-loose: move loose source into "odb/" subsystem
+ Merge branch 'ps/odb-in-memory' into ps/odb-source-loose
(this branch is used by ps/odb-source-packed.)
The loose object source has been refactored into a proper `struct
odb_source`.
source: <20260601-b4-pks-odb-source-loose-v2-0-90ff159430af@pks.im>
* rs/strbuf-add-oid-hex (2026-05-13) 1 commit
(merged to 'next' on 2026-06-02 at 4876f95de0)
+ hex: add and use strbuf_add_oid_hex()
Formatting object name in full hexadecimal form has been optimized
by using a new strbuf_add_oid_hex() helper function.
cf. <20260513160155.GA103037@coredump.intra.peff.net>
source: <183aa0fd-d455-4ec9-9c42-d511fac8b3e4@web.de>
* rs/strbuf-add-uint (2026-05-12) 4 commits
(merged to 'next' on 2026-06-02 at f5be02d8ec)
+ ls-tree: use strbuf_add_uint()
+ ls-files: use strbuf_add_uint()
+ cat-file: use strbuf_add_uint()
+ strbuf: add strbuf_add_uint()
Adding a decimal integer with strbuf_addf("%u") appears commonly;
they have been optimized by using a custom formatter.
cf. <20260512184619.GD70851@coredump.intra.peff.net>
source: <20260512115603.80780-1-l.s.r@web.de>
* st/daemon-sockaddr-fixes (2026-05-27) 3 commits
(merged to 'next' on 2026-06-04 at 17684e6158)
+ daemon: guard NULL REMOTE_PORT in execute() logging
+ daemon: fix IPv6 address truncation in ip2str()
+ daemon: fix IPv6 address corruption in lookup_hostname()
Correct use of sockaddr API in "git daemon".
source: <pull.2300.v3.git.git.1779937016.gitgitgadget@gmail.com>
* tb/bitmap-build-performance (2026-05-27) 9 commits
(merged to 'next' on 2026-06-02 at d1a84a996a)
+ pack-bitmap: build pseudo-merge bitmaps after regular bitmaps
+ pack-bitmap: remember pseudo-merge parents
+ pack-bitmap: sort bitmaps before XORing
+ pack-bitmap: cache object positions during fill
+ pack-bitmap: consolidate `find_object_pos()` success path
+ pack-bitmap: reuse stored selected bitmaps
+ pack-bitmap: check subtree bits before recursing
+ pack-bitmap: pass object position to `fill_bitmap_tree()`
+ Merge branch 'tb/pseudo-merge-bugfixes' into tb/bitmap-build-performance
Reachability bitmap generation has been significantly optimized. By
reordering tree traversal, caching object positions, and refining how
pseudo-merge bitmaps are constructed, the performance of "git repack
--write-midx-bitmaps" is improved, especially for large repositories
and when using pseudo-merges.
cf. <20260529083439.GD1106035@coredump.intra.peff.net>
source: <cover.1779911733.git.me@ttaylorr.com>
* th/promisor-quiet-per-repo (2026-04-06) 1 commit
(merged to 'next' on 2026-06-02 at 02a749d7fe)
+ promisor-remote: fix promisor.quiet to use the correct repository
The "promisor.quiet" configuration variable was not used from
relevant submodules when commands like "grep --recurse-submodules"
triggered a lazy fetch, which has been corrected.
cf. <c87f1f12-d0cc-4150-8f43-4dc9cc1fe24f@malon.dev>
source: <20260406183041.783800-1-vikingtc4@gmail.com>
* ua/push-remote-group (2026-05-03) 3 commits
(merged to 'next' on 2026-06-02 at ba5d6aebaa)
+ push: support pushing to a remote group
+ remote: move remote group resolution to remote.c
+ remote: fix sign-compare warnings in push_cas_option
"git push" learned to take a "remote group" name to push to, which
causes pushes to multiple places, just like "git fetch" would do.
cf. <20260518182721.155070-1-usmanakinyemi202@gmail.com>
source: <20260503153402.1333220-1-usmanakinyemi202@gmail.com>
--------------------------------------------------
[New Topics]
* kk/prio-queue-get-put-fusion (2026-06-08) 2 commits
- prio-queue: fold lazy_queue into prio_queue for automatic get+put fusion
- prio-queue: rename .nr to .nr_ and add accessor helpers
The lazy priority queue optimization pattern (deferring actual removal
in prio_queue_get() to allow get+put fusion) has been folded directly
into prio_queue itself, speeding up commit traversal workflows and
simplifying callers.
Comments?
source: <pull.2140.v4.git.1780945851.gitgitgadget@gmail.com>
* kk/remove-get-reachable-subset (2026-06-11) 1 commit
- commit-reach: remove get_reachable_subset()
API clean-up.
Needs review.
source: <pull.2144.v2.git.1781178567862.gitgitgadget@gmail.com>
* td/ref-filter-memoize-contains (2026-06-08) 2 commits
- ref-filter: memoize --contains with generations
- commit-reach: handle cycles in contains walk
'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.
Waiting for response(s) to review comment(s).
cf. <CAOLa=ZRFSuGrqFXhTuQ7Dk5GCQQGHom++78xwONoiNdt1h_gWQ@mail.gmail.com>
source: <20260608-ref-filter-memoized-contains-v2-0-e72720344a7c@gmail.com>
* tc/replay-linearize (2026-06-10) 3 commits
- replay: offer an option to linearize the commit topology
- replay: add helper to put entry into mapped_commits
- replay: refactor enum replay_mode into a bool
git replay learns --linearize option to drop merge commits and
linearize the replayed history, mimicking git rebase
--no-rebase-merges.
Waiting for response(s) to review comment(s).
cf. <xmqqjys6wcpo.fsf@gitster.g>
source: <20260610-toon-git-replay-drop-merges-v2-0-5714a71c6d83@iotcl.com>
* td/describe-tag-iteration (2026-06-10) 1 commit
- describe: limit default ref iteration to tags
'git describe' has been taught to pass the 'refs/tags/' prefix down to
the ref iterator when '--all' is not requested, avoiding unnecessary
iteration over non-tag refs.
Needs review.
source: <20260610-describe-tag-ref-scope-v3-1-5aa63ab279f7@gmail.com>
* ta/doc-config-adoc-fixes (2026-06-10) 3 commits
- doc: git-config: escape erroneous highlight markup
- doc: config/sideband: fix description list delimiter
- doc: config: terminate runaway lists
Various AsciiDoc markup fixes in 'git config' documentation and
related files to ensure lists and formatting are rendered correctly.
Comments?
cf. <20260611083139.GA2237523@coredump.intra.peff.net>
source: <20260610225513.6269-1-taahol@utu.fi>
* ps/setup-drop-global-state (2026-06-10) 8 commits
- treewide: drop USE_THE_REPOSITORY_VARIABLE
- environment: stop using `the_repository` in `is_bare_repository()`
- environment: split up concerns of `is_bare_repository_cfg`
- builtin/init: stop modifying `is_bare_repository_cfg`
- setup: remove global `git_work_tree_cfg` variable
- builtin/init: simplify logic to configure worktree
- builtin/init: stop modifying global `git_work_tree_cfg` variable
- Merge branch 'ps/setup-centralize-odb-creation' into ps/setup-drop-global-state
(this branch uses ps/setup-centralize-odb-creation.)
Continuation of "setup.c" refactoring to drop remaining global state
(`git_work_tree_cfg`, `is_bare_repository_cfg`). The most notable
outcome is that `is_bare_repository()` has been updated to no longer
implicitly rely on `the_repository`.
Comments?
source: <20260611-b4-pks-setup-drop-global-state-v2-0-a6f7269c841d@pks.im>
* ps/refs-avoid-chdir-notify-reparent (2026-06-10) 10 commits
- refs: always use absolute paths for reference stores
- refs: drop local buffer in `refs_compute_filesystem_location()`
- refs: fix recursing `get_main_ref_store()` with "onbranch" config
- repository: free main reference database
- chdir-notify: drop unused `chdir_notify_reparent()`
- refs: unregister reference stores from "chdir_notify"
- setup: don't apply "GIT_REFERENCE_BACKEND" without a repository
- setup: stop applying repository format twice
- setup: inline `check_and_apply_repository_format()`
- Merge branch 'ps/setup-centralize-odb-creation' into ps/refs-avoid-chdir-notify-reparent
(this branch uses ps/setup-centralize-odb-creation.)
The reference backends have been converted to always use absolute
paths internally. This allows dropping the calls to
`chdir_notify_reparent()` and fixes a memory leak in how the
reference database is constructed with an "onbranch" condition.
Waiting for response(s) to review comment(s).
cf. <20260611065346.GD2191159@coredump.intra.peff.net>
source: <20260610-b4-pks-refs-avoid-chdir-notify-reparent-v1-0-56c864b01c43@pks.im>
* jc/t1400-fifo-cleanup (2026-06-10) 1 commit
- t1400: have fifo test clean after itself
source: <xmqqo6hit6rn.fsf@gitster.g>
--------------------------------------------------
[Stalled]
* cs/subtree-split-recursion (2026-03-05) 3 commits
- contrib/subtree: reduce recursion during split
- contrib/subtree: functionalize split traversal
- contrib/subtree: reduce function side-effects
When processing large history graphs on Debian or Ubuntu, "git
subtree" can die with a "recursion depth reached" error.
Waiting for response(s) to review comment(s) for too long, consider discarding.
cf. <xmqqv7c13o5l.fsf@gitster.g>
source: <20260305-cs-subtree-split-recursion-v2-0-7266be870ba9@howdoi.land>
--------------------------------------------------
[Cooking]
* jd/unpack-trees-wo-the-repository (2026-03-31) 1 commit
- unpack-trees: use repository from index instead of global
A handful of inappropriate uses of the_repository have been
rewritten to use the right repository structure instance in the
unpack-trees.c codepath.
Will merge to 'next'.
cf. <xmqqqzmfz91r.fsf@gitster.g>
source: <pull.2258.v2.git.git.1774971267.gitgitgadget@gmail.com>
* ps/odb-source-packed (2026-06-09) 18 commits
- odb/source-packed: drop pointer to "files" parent source
- midx: refactor interfaces to work on "packed" source
- odb/source-packed: stub out remaining functions
- odb/source-packed: wire up `freshen_object()` callback
- odb/source-packed: wire up `find_abbrev_len()` callback
- odb/source-packed: wire up `count_objects()` callback
- odb/source-packed: wire up `for_each_object()` callback
- odb/source-packed: wire up `read_object_stream()` callback
- odb/source-packed: wire up `read_object_info()` callback
- packfile: use higher-level interface to implement `has_object_pack()`
- odb/source-packed: wire up `reprepare()` callback
- odb/source-packed: wire up `close()` callback
- odb/source-packed: start converting to a proper `struct odb_source`
- odb/source-packed: store pointer to "files" instead of generic source
- packfile: move packed source into "odb/" subsystem
- packfile: split out packfile list logic
- packfile: rename `struct packfile_store` to `odb_source_packed`
- Merge branch 'ps/odb-source-loose' into ps/odb-source-packed
The packed object source has been refactored into a proper struct
odb_source.
Needs review.
source: <20260609-pks-odb-source-packed-v2-0-839089132c8b@pks.im>
* ps/transport-helper-tsan-fix (2026-06-09) 1 commit
- transport-helper: fix TSAN race in transfer_debug()
The TSAN race in transfer_debug() within transport-helper.c has been
resolved by initializing the debug flag early in
bidirectional_transfer_loop() before spawning worker threads, allowing
the removal of a TSAN suppression.
Will merge to 'next'?
cf. <20260609002833.GE358144@coredump.intra.peff.net>
cf. <20260611083320.GI2191159@coredump.intra.peff.net>
source: <20260609134741.4727-2-pushkarkumarsingh1970@gmail.com>
* ta/typofixes (2026-06-04) 1 commit
- docs: fix typos
Typofixes
Will merge to 'next'.
cf. <xmqqh5ncvfsu.fsf@gitster.g>
source: <20260604131457.19215-1-taahol@utu.fi>
* js/win-kill-child-more-gently (2026-06-04) 2 commits
(merged to 'next' on 2026-06-11 at b4a2299e7e)
+ mingw: really handle SIGINT
+ mingw: kill child processes in a gentler way
Advanced emulation of kill() used on Windows in GfW has been
upstreamed to improve the symptoms like left-behind .lock files and
that fails to let the child clean-up itself when it gets killed.
Will merge to 'master'.
source: <pull.2130.git.1780590261.gitgitgadget@gmail.com>
* dl/posix-unused-warning-clang (2026-06-08) 2 commits
- compat/posix.h: simplify GIT_GNUC_PREREQ() comparison
- compat/posix.h: enable UNUSED warning messages for Clang
The UNUSED macro in 'compat/posix.h' has been updated to use a
newly introduced GIT_CLANG_PREREQ macro for compiler version
checks, and the existing GIT_GNUC_PREREQ macro has been modernized
to use explicit major/minor comparisons rather than bit-shifting.
Needs review.
source: <20260608124419.38905-1-dominik.loidolt@univie.ac.at>
* lo/doc-format-patch-subject-prefix (2026-06-04) 1 commit
(merged to 'next' on 2026-06-09 at 58b2a20f6d)
+ Documentation: remove redundant 'instead' in --subject-prefix
Wording used in "format-patch --subject-prefix" documentation
has been improved.
Will merge to 'master'.
source: <20260604163510.36687-2-lucasseikioshiro@gmail.com>
* am/doc-tech-hash-typofix (2026-06-05) 1 commit
(merged to 'next' on 2026-06-09 at aeaf2363f8)
+ doc: fix typo in GIT_ALTERNATE_OBJECT_DIRECTORIES
Typofix.
Will merge to 'master'.
cf. <aiZo9FqsdKrhz0gA@pks.im>
source: <20260605172643.8796-1-amonakov@ispras.ru>
* td/ref-filter-restore-prefix-iteration (2026-06-10) 1 commit
- ref-filter: restore prefix-scoped iteration
Commands that list branches and tags (like git branch and git tag)
have been optimized to pass the namespace prefix when initializing
their ref iterator, avoiding a loose-ref scaling regression in
repositories with many unrelated loose references.
Needs review.
source: <20260610-fix-git-branch-regression-v3-1-6fd48fad7a53@gmail.com>
* ty/move-protect-hfs-ntfs (2026-06-10) 1 commit
- environment.c: move 'protect_hfs' and 'protect_ntfs' into 'repo_config_values'
The global configuration variables protect_hfs and protect_ntfs have
been migrated into struct repo_config_values to tie them to
per-repository configuration state.
Will merge to 'next'?
cf. <CAP8UFD35Tiy1_fqpjq8P-z=ZhzR3MTiThqfCs977652umRoSEQ@mail.gmail.com>
cf. <xmqqse6uwdnz.fsf@gitster.g>
source: <20260610124353.149874-2-cat@malon.dev>
* ds/config-no-includes (2026-06-08) 3 commits
- git: add --no-includes top-level option
- config: add GIT_CONFIG_INCLUDES
- git-config.adoc: fix paragraph break
Two new mechanisms, the GIT_CONFIG_INCLUDES environment variable and
the top-level --no-includes command-line option, have been introduced
to ignore configuration include directives.
Comments?
cf. <20260608225149.GB340696@coredump.intra.peff.net>
source: <pull.2139.git.1780927027.gitgitgadget@gmail.com>
* ps/cat-file-remote-object-info (2026-06-08) 12 commits
- cat-file: make remote-object-info allow-list dynamic
- cat-file: validate remote atoms with allow_list
- cat-file: add remote-object-info to batch-command
- transport: add client support for object-info
- serve: advertise object-info feature
- fetch-pack: move fetch initialization
- connect: refactor packet writing
- fetch-pack: move function to connect.c
- t1006: split test utility functions into new "lib-cat-file.sh"
- cat-file: add declaration of variable i inside its for loop
- git-compat-util: add strtoul_ul() with error handling
- transport-helper: fix memory leak of helper on disconnect
The `remote-object-info` command has been added to `git cat-file
--batch-command`, allowing clients to request object metadata
(currently size) from a remote server via protocol v2 without
downloading the entire object.
The client dynamically filters format placeholders based on
server-advertised capabilities and safely returns empty strings for
inapplicable or unsupported fields.
Comments?
cf. <CA+J6zkQ22en2HgH03EedKOfC+jLcHH2UbwpH0h_bDEAHR6B2pg@mail.gmail.com>
source: <20260608-ps-eric-work-rebase-v12-0-5338b766e658@gmail.com>
* ap/http-redirect-wwwauth-fix (2026-06-02) 1 commit
- http: preserve wwwauth_headers across redirects
When cURL follows a redirect, the WWW-Authenticate headers from the
redirect target were lost because credential_from_url() cleared the
credential state. This has been fixed by preserving the collected
headers across the redirect update.
Expecting a reroll.
cf. <5144a29d-a53f-4446-beff-e1f549345bf9@nvidia.com>
source: <20260602161150.1527493-1-aplattner@nvidia.com>
* ps/doc-recommend-b4 (2026-06-07) 3 commits
- b4: introduce configuration for the Git project
- MyFirstContribution: recommend the use of b4
- MyFirstContribution: recommend shallow threading of cover letters
Project-specific configuration for b4 has been introduced, and the
documentation has been updated to recommend using it as a
streamlined method for submitting patches.
Comments?
cf. <87a4t32a4g.fsf@emacs.iotcl.com>
source: <20260608-pks-b4-v3-0-f5e497d10c56@pks.im>
* kk/streaming-walk-pqueue (2026-05-27) 3 commits
(merged to 'next' on 2026-06-11 at 1466219fc9)
+ 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
Streaming revision walks have been optimized by using a priority queue
for date-sorting commits, speeding up walks repositories with many
merges.
Will merge to 'master'.
source: <pull.2127.git.1779897003.gitgitgadget@gmail.com>
* sn/rebase-update-refs-symrefs (2026-06-03) 1 commit
- rebase: skip branch symref aliases
"git rebase --update-refs" has been taught to resolve local branch
symrefs to their referents before queuing updates. This correctly
skips aliases of the current branch and avoids duplicate updates for
underlying real branches, fixing failures when branch aliases (like a
default branch rename) are present.
Waiting for response(s) to review comment(s).
cf. <f982c386-e329-4ab0-b695-e540bcb9de3d@gmail.com>
source: <pull.2126.v2.git.1780482436865.gitgitgadget@gmail.com>
* jk/describe-contains-all-match-fix (2026-06-01) 1 commit
(merged to 'next' on 2026-06-11 at a95871538b)
+ describe: fix --exclude, --match with --contains and --all
The 'git describe --contains --all' command has been fixed to
properly honor the '--match' and '--exclude' options by passing
them down to 'git name-rev' with the appropriate reference
prefixes.
Will merge to 'master'.
source: <20260601233727.43558-1-jacob.e.keller@intel.com>
* wy/docs-typofixes (2026-05-29) 1 commit
- docs: fix typos and grammar
Various typos, grammatical errors, and duplicated words in both
documentation and code comments have been corrected.
Will merge to 'next'.
source: <7b502e20e9495cd4720496bd6738a1fbeb453410.1780041658.git.wy@wyuan.org>
* ab/index-pack-retain-child-bases (2026-06-02) 1 commit
- index-pack: retain child bases in delta cache
"git index-pack" has been optimized by retaining child bases in the
delta cache instead of immediately freeing them, letting the existing
cache limit policy decide eviction.
Will replace with [v2] and then merge to 'next'.
cf. <20260611065748.GF2191159@coredump.intra.peff.net>
source: <pull.2131.v3.git.1780445118653.gitgitgadget@gmail.com>
* mm/diff-process-hunks (2026-05-29) 6 commits
. blame: consult diff process for no-hunk detection
. diff: bypass diff process with --no-ext-diff and in format-patch
. diff: add long-running diff process via diff.<driver>.process
. sub-process: separate process lifecycle from hashmap management
. userdiff: add diff.<driver>.process config
. xdiff: support external hunks via xpparam_t
A new `diff.<driver>.process` configuration has been introduced to
allow a long-running external process to act as a hunk provider to
allows external tools to control which lines Git considers changed
while leaving all output formatting (word diff, color, blame, etc.) to
Git's standard pipeline.
Expecting a reroll.
cf. <CAC2QwmKNA6wv-jG07fgJj7Xj2J+dzzWEiqV5Q+8HJpjA_GtkFw@mail.gmail.com>
source: <pull.2120.v3.git.1780087700.gitgitgadget@gmail.com>
* tb/pack-path-walk-bitmap-delta-islands (2026-06-02) 5 commits
- pack-objects: support `--delta-islands` with `--path-walk`
- pack-objects: extract `record_tree_depth()` helper
- pack-objects: support reachability bitmaps with `--path-walk`
- t/perf: drop p5311's lookup-table permutation
- Merge branch 'ds/path-walk-filters' into tb/pack-path-walk-bitmap-delta-islands
The pack-objects command now supports using reachability bitmaps and
delta-islands concurrently with the `--path-walk` option, allowing
faster packaging by falling back to path-walk when bitmaps cannot
fully satisfy the request.
Needs review.
source: <cover.1780438896.git.me@ttaylorr.com>
* ty/migrate-trust-executable-bit (2026-06-10) 3 commits
- environment: move trust_executable_bit into repo_config_values
- read-cache: move 'ce_mode_from_stat()' to 'read-cache.c'
- read-cache: remove redundant extern declarations
The 'trust_executable_bit' (coming from 'core.filemode'
configuration) has been migrated into 'repo_config_values' to tie it
to a specific repository instance.
Needs review.
cf. <CAP8UFD1GJ=caPh-M97KLCfB1ZKtpomzosYN0uYBOnay+G23GcA@mail.gmail.com>
cf. <CAP8UFD20yij=1ZEYnR74DoCJ3g=b39yOsUxZecYuuf7nFGaKyA@mail.gmail.com>
source: <20260610093635.139719-1-cat@malon.dev>
* ak/typofixes (2026-05-31) 1 commit
(merged to 'next' on 2026-06-09 at 40de2e7b90)
+ doc: fix typos via codespell
Typofixes.
Will merge to 'master'.
cf. <3398ef40-1547-4324-2cfc-97b9e2b24854@gmx.de>
cf. <xmqq8q8p1ese.fsf@gitster.g>
source: <20260531184428.55905-1-algonell@gmail.com>
source: <20260506101631.18127-1-algonell@gmail.com>
source: <3398ef40-1547-4324-2cfc-97b9e2b24854@gmx.de>
* kk/prio-queue-cascade-sift (2026-06-01) 1 commit
- prio-queue: use cascade-down for faster extract-min
prio_queue_get() has been optimized by using a cascade-down approach
(promoting the smaller child at each level and sifting up the last
element from the leaf vacancy), which halves the number of comparisons
per extract-min operation in the common case.
Expecting a reroll.
cf. <CAL71e4Ob-B5MJ5DPY+_tzpj6nyrbQ5WutxED2T93SWJV6kJGPA@mail.gmail.com>
cf. <CAL71e4MYNiScZjTwkApjDAjRh2LM0_SP59h5HCTywV-Pua03tw@mail.gmail.com>
source: <pull.2132.v2.git.1780301856444.gitgitgadget@gmail.com>
* mm/subprocess-handshake-fix (2026-06-01) 1 commit
- sub-process: use gentle handshake to avoid die() on startup failure
The subprocess handshake during startup has been made gentler by using
packet_read_line_gently() instead of packet_read_line() to prevent the
parent Git process from dying abruptly when a configured subprocess
(e.g., a clean/smudge filter) fails to start.
Will merge to 'next'.
source: <pull.2133.v2.git.1780348848489.gitgitgadget@gmail.com>
* jk/repo-info-path-keys (2026-06-05) 4 commits
- repo: add path.commondir with absolute and relative suffix formatting
- repo: add path.gitdir with absolute and relative suffix formatting
- rev-parse: use format_path for path formatting
- path: introduce format_path() for centralized path formatting
The "git repo info" command has been taught new keys to output both
absolute and relative paths for "gitdir" and "commondir", supported by
a new path-formatting helper extracted from "git rev-parse".
Expecting a reroll.
cf. <CA+rGoLf39iQH9X-xKW7HeTS3sMv-N-QzGiqm0Y=RYGOAqDcaoA@mail.gmail.com>
source: <20260605163012.181089-1-jayatheerthkulkarni2005@gmail.com>
* ps/history-drop (2026-06-10) 10 commits
- builtin/history: implement "drop" subcommand
- builtin/history: split handling of ref updates into two phases
- 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
The experimental "git history" command has been taught a new "drop"
subcommand to remove a commit and replay its descendants onto its
parent.
Needs review.
source: <20260610-b4-pks-history-drop-v4-0-70d5f0ae8c25@pks.im>
* ls/doc-raw-timestamp-prefix (2026-06-02) 1 commit
(merged to 'next' on 2026-06-09 at 7198b6bb9d)
+ doc: document and test `@` prefix for raw timestamps
Documentation and tests have been added to clarify that Git's internal
raw timestamp format requires a `@` prefix for values less than
100,000,000 to prevent ambiguity with other formats like YYYYMMDD.
Will merge to 'master'.
cf. xmqqmrxdxq1r.fsf@gitster.g>
source: <20260602081924.673763-2-dev@luna.gl>
* jk/setup-gitfile-diag-fix (2026-06-01) 1 commit
- read_gitfile_gently(): return non-repo path on error
A regression in the error diagnosis code for invalid .git files has
been fixed, avoiding a potential NULL-pointer crash when reporting
that a .git file does not point to a valid repository.
Expecting a reroll?
cf. <ah6WEtk2pXyViEQA@pks.im>
source: <20260602061159.GA693928@coredump.intra.peff.net>
* jc/submitting-patches-cover-letter (2026-06-02) 2 commits
(merged to 'next' on 2026-06-09 at 42b2538a2a)
+ SubmittingPatches: describe cover letter
+ SubmittingPatches: separate typofixes section
Guidelines on how to write a cover letter for a multi-patch series
have been added to SubmittingPatches, which also got a new marker
to separate the section for typofixes.
Will merge to 'master'.
cf. <c54f3571-ff7b-4caa-b75d-a739ed87ec9d@gmail.com>
cf. <aiEgUdnL8dkszKFn@pks.im>
source: <20260602144304.3341000-1-gitster@pobox.com>
* ps/t7527-fix-tap-output (2026-06-04) 8 commits
(merged to 'next' on 2026-06-11 at b5a4cd26ee)
+ t: let prove fail when parsing invalid TAP output
+ t/lib-git-p4: silence output when killing p4d and its watchdog
+ t/test-lib: silence EBUSY errors on Windows during test cleanup
+ t7810: turn MB_REGEX check into a lazy prereq
+ t7527: fix broken TAP output
+ ci: unify Linux images across GitLab and GitHub
+ gitlab-ci: add missing Linux jobs
+ gitlab-ci: rearrange Linux jobs to match GitHub's order
A recent regression in t7527 that broke TAP output has been fixed,
some other test noise that also broke TAP output has been silenced,
and 'prove' is now configured to fail on invalid TAP output to
prevent future regressions.
Will merge to 'master'.
source: <20260604-pks-t7527-fix-tap-output-v3-0-7d766ed481e4@pks.im>
* ob/more-repo-config-values (2026-06-02) 8 commits
(merged to 'next' on 2026-06-09 at 3d0b057aee)
+ environment: move "warn_on_object_refname_ambiguity" into `struct repo_config_values`
+ environment: move "sparse_expect_files_outside_of_patterns" into `struct repo_config_values`
+ environment: move "core_sparse_checkout_cone" into `struct repo_config_values`
+ environment: move "precomposed_unicode" into `struct repo_config_values`
+ environment: move "pack_compression_level" into `struct repo_config_values`
+ environment: move `zlib_compression_level` into `struct repo_config_values`
+ environment: move "check_stat" into `struct repo_config_values`
+ environment: move "trust_ctime" into `struct repo_config_values`
Many core configuration variables have been migrated from global
variables into 'repo_config_values' to tie them to a specific
repository instance, avoiding cross-repository state leakage.
Will merge to 'master'.
source: <20260602170921.35869-1-belkid98@gmail.com>
* kh/doc-trailers (2026-06-10) 10 commits
- doc: interpret-trailers: document comment line treatment
- doc: interpret-trailers: commit to “trailer block” term
- doc: interpret-trailers: join new-trailers again
- doc: interpret-trailers: add key format example
- doc: interpret-trailers: explain key format
- doc: interpret-trailers: explain the format after the intro
- doc: interpret-trailers: not just for commit messages
- doc: interpret-trailers: use “metadata” in Name as well
- doc: interpret-trailers: replace “lines” with “metadata”
- doc: interpret-trailers: stop fixating on RFC 822
Documentation updates.
Needs review.
source: <V3_CV_doc_int-tr_key_format.8a3@msgid.xyz>
* za/completion-hide-dotfiles (2026-05-26) 1 commit
- completion: hide dotfiles for selected path completion
The path completion for commands like `git rm` and `git mv`, is being
updated to hide dotfiles by default, unless the user explicitly starts
the path with a dot, matching standard shell-completion behavior.
Waiting for response(s) to review comment(s).
cf. <xmqqqzmxlep3.fsf@gitster.g>
source: <pull.2311.v2.git.git.1779808987825.gitgitgadget@gmail.com>
* ec/commit-fixup-options (2026-05-26) 2 commits
- commit: allow -c/-C for all kinds of --fixup
- commit: allow -m/-F for all kinds of --fixup
The -m/-F/-c/-C options to supply commit log message from outside the
editor are now supported for all "git commit --fixup" variations.
Needs review.
source: <cover.1779792311.git.erik@cervined.in>
* ps/setup-centralize-odb-creation (2026-06-04) 9 commits
(merged to 'next' on 2026-06-09 at a1f23cb38c)
+ setup: construct object database in `apply_repository_format()`
+ repository: stop reading loose object map twice on repo init
+ setup: stop initializing object database without repository
+ setup: stop creating the object database in `setup_git_env()`
+ repository: stop initializing the object database in `repo_set_gitdir()`
+ setup: deduplicate logic to apply repository format
+ setup: drop `setup_git_env()`
+ t0001: plug test gaps for git-init(1) with GIT_OBJECT_DIRECTORY
+ Merge branch 'ps/setup-wo-the-repository' into ps/setup-centralize-odb-creation
(this branch is used by ps/refs-avoid-chdir-notify-reparent and ps/setup-drop-global-state.)
The setup logic to discover and configure repositories has been
refactored, and the initialization of the object database has been
centralized.
Will merge to 'master'.
cf. <CAOLa=ZQwVbLsOcajaxQwtkTPm=4St7EiGEEyL6_B0o3Tt1v1pw@mail.gmail.com>
source: <20260604-b4-pks-setup-centralize-odb-creation-v3-0-0691834f318a@pks.im>
* kh/doc-replay-config (2026-06-05) 4 commits
- doc: replay: move “default” to the right-hand side
- doc: replay: use a nested description list
- doc: replay: improve config description
- doc: link to config for git-replay(1)
Doc update for "git replay" to actually refer to its configuration
variables.
Needs review.
source: <V3_CV_doc_replay_config.780@msgid.xyz>
* hn/status-pull-advice-qualified (2026-05-21) 1 commit
- remote: qualify "git pull" advice for non-upstream compareBranches
Advice shown by "git status" when the local branch is behind or has
diverged from its push branch has been updated to suggest "git pull
<remote> <branch>".
Will merge to 'next'?
cf. <xmqq7bo6xuok.fsf@gitster.g>
source: <pull.2301.v4.git.git.1779372367317.gitgitgadget@gmail.com>
* hn/config-typo-advice (2026-06-02) 2 commits
(merged to 'next' on 2026-06-09 at 5149e69e3e)
+ config: improve diagnostic for "set" with missing value
+ config: add git_config_key_is_valid() for quiet validation
"git config foo.bar=baz" is not likely to be a request to read the
value of such a variable with '=' in its name; rather it is plausible
that the user meant "git config set foo.bar baz". Give advice when
giving an error message.
Will merge to 'master'.
cf. <xmqq1penqfg2.fsf@gitster.g>
source: <pull.2302.v6.git.git.1780425808.gitgitgadget@gmail.com>
* jt/config-lock-timeout (2026-05-17) 1 commit
- config: retry acquiring config.lock, configurable via core.configLockTimeout
Configuration file locking now retries for a short period, avoiding
failures when multiple processes attempt to update the configuration
simultaneously.
Waiting for response(s) to review comment(s).
cf. <agrIrGwSMFlKTx9x@pks.im>
source: <20260517132111.1014901-1-joerg@thalheim.io>
* hn/branch-prune-merged (2026-06-09) 6 commits
- branch: add --dry-run for --prune-merged
- branch: add branch.<name>.pruneMerged opt-out
- branch: add --prune-merged <branch>
- branch: prepare delete_branches for a bulk caller
- branch: let delete_branches warn instead of error on bulk refusal
- branch: add --forked filter for --list mode
"git branch" command learned "--prune-merged" option to remove
local branches that have already been merged to the remote-tracking
branches they track.
Needs review.
cf. <1c56bf9c-8273-4499-87c8-16ddf0112dca@gmail.com>
source: <pull.2285.v14.git.git.1780999917.gitgitgadget@gmail.com>
* cc/promisor-auto-config-url-more (2026-05-27) 8 commits
- doc: promisor: improve acceptFromServer entry
- promisor-remote: auto-configure unknown remotes
- promisor-remote: trust known remotes matching acceptFromServerUrl
- promisor-remote: introduce promisor.acceptFromServerUrl
- promisor-remote: add 'local_name' to 'struct promisor_info'
- urlmatch: add url_normalize_pattern() helper
- urlmatch: change 'allow_globs' arg to bool
- t5710: simplify 'mkdir X' followed by 'git -C X init'
The handling of promisor-remote protocol capability has been
loosened to allow the other side to add to the list of promisor
remotes via the promisor.acceptFromServerURL configuration
variable.
Will merge to 'next'?
cf. <877bo7294j.fsf@emacs.iotcl.com>
cf. <xmqqh5naxwfc.fsf@gitster.g>
source: <20260527140820.1438165-1-christian.couder@gmail.com>
* hn/checkout-track-fetch (2026-05-23) 2 commits
- checkout: extend --track with a "fetch" mode to refresh start-point
- branch: expose helpers for finding the remote owning a tracking ref
"git checkout --track=..." learned to optionally fetch the branch
from the remote the new branch will work with.
Needs review.
source: <pull.2281.v13.git.git.1779565714.gitgitgadget@gmail.com>
* mf/revision-max-count-oldest (2026-05-18) 1 commit
(merged to 'next' on 2026-06-09 at 076600fa21)
+ revision.c: implement --max-count-oldest
"git rev-list" (and "git log" family of commands) learned a new "--max-count-oldest"
that picks oldest N commits in the range instead of the usual newest.
Will merge to 'master'.
source: <xmqq4ijm3p2x.fsf@gitster.g>
* en/ort-harden-against-corrupt-trees (2026-04-20) 5 commits
- cache-tree: fix verify_cache() to catch non-adjacent D/F conflicts
- merge-ort: abort merge when trees have duplicate entries
- merge-ort: free diff pairs queue in clear_or_reinit_internal_opts()
- merge-ort: drop unnecessary show_all_errors from collect_merge_info()
- merge-ort: propagate callback errors from traverse_trees_wrapper()
"ort" merge backend handles merging corrupt trees better by
aborting when it should.
Waiting for response(s) to review comment(s).
cf. <xmqqldcy4f07.fsf@gitster.g>
source: <pull.2096.git.1776731171.gitgitgadget@gmail.com>
* pw/status-rebase-todo (2026-05-01) 2 commits
- status: improve rebase todo list parsing
- sequencer: factor out parsing of todo commands
The display of the rebase todo list in "git status" has been
improved to correctly abbreviate object IDs for more commands and
avoid misinterpreting refs as object IDs.
Waiting for response(s) to review comment(s).
cf. <xmqqbjdwcsno.fsf@gitster.g>
source: <cover.1777648598.git.phillip.wood@dunelm.org.uk>
* cl/conditional-config-on-worktree-path (2026-05-24) 2 commits
- config: add "worktree" and "worktree/i" includeIf conditions
- config: refactor include_by_gitdir() into include_by_path()
The [includeIf "condition"] conditional inclusion facility for
configuration files has learned to use the location of worktree
in its condition.
Waiting for response(s) to review comment(s).
cf. <xmqq8q97et9b.fsf@gitster.g>
source: <20260525-includeif-worktree-v5-0-1efe525d025a@black-desk.cn>
* ps/shift-root-in-graph (2026-04-27) 1 commit
- graph: add indentation for commits preceded by a parentless commit
In a history with more than one root commit, "git log --graph
--oneline" stuffed an unrelated commit immediately below a root
commit, which has been corrected by making the spot below a root
unavailable.
Expecting a reroll.
cf. <CAN5EUNQoKRqt3FGLmzRGpPU1nO5jCAogP8Wm9gBZXuPbMNbQAw@mail.gmail.com>
cf. <CAN5EUNSFBC0+aoW1ceGjEiKWBRjzuzUEUjg8Xys5O9rDsJdkjg@mail.gmail.com>
source: <20260427102838.44867-2-pabloosabaterr@gmail.com>
* js/parseopt-subcommand-autocorrection (2026-04-27) 11 commits
- SQUASH???
- doc: document autocorrect API
- parseopt: add tests for subcommand autocorrection
- parseopt: enable subcommand autocorrection for git-remote and git-notes
- parseopt: autocorrect mistyped subcommands
- autocorrect: provide config resolution API
- autocorrect: rename AUTOCORRECT_SHOW to AUTOCORRECT_HINT
- autocorrect: use mode and delay instead of magic numbers
- help: move tty check for autocorrection to autocorrect.c
- help: make autocorrect handling reusable
- parseopt: extract subcommand handling from parse_options_step()
The parse-options library learned to auto-correct misspelled
subcommand names.
Expecting a reroll.
cf. <SY0P300MB0801E50FCB7EB2F45CD15208CE042@SY0P300MB0801.AUSP300.PROD.OUTLOOK.COM>
source: <SY0P300MB0801677A2A1E0FD38D06A841CE2A2@SY0P300MB0801.AUSP300.PROD.OUTLOOK.COM>
* jc/neuter-sideband-post-3.0 (2026-03-05) 2 commits
- sideband: delay sanitizing by default to Git v3.0
- Merge branch 'jc/neuter-sideband-fixup' into jc/neuter-sideband-post-3.0
The final step, split from earlier attempt by Dscho, to loosen the
sideband restriction for now and tighten later at Git v3.0 boundary.
Will retract.
(this branch uses jc/neuter-sideband-fixup.)
source: <20260305233452.3727126-8-gitster@pobox.com>
--------------------------------------------------
[Discarded]
* kk/fetch-store-ref-optimization (2026-05-24) 1 commit
- fetch: pass transport to post-fetch connectivity check
When fetching from a transport that provides a self-contained pack,
pass the transport pointer to the post-fetch `check_connected()` call
to optimize connectivity check.
Retracted.
cf. <CAL71e4MrVqC1=AR6x0_8S=8kVqPdDkhgCZRb4etFsxTzd6s_8Q@mail.gmail.com>
source: <pull.2123.git.1779625693328.gitgitgadget@gmail.com>
* lp/repack-propagate-promisor-debugging-info (2026-04-18) 6 commits
- repack-promisor: add missing headers
- t7703: test for promisor file content after geometric repack
- t7700: test for promisor file content after repack
- repack-promisor: preserve content of promisor files after repack
- repack-promisor add helper to fill promisor file after repack
- pack-write: add explanation to promisor file content
When fetching objects into a lazily cloned repository, .promisor
files are created with information meant to help debugging. "git
repack" has been taught to carry this information forward to
packfiles that are newly created.
Retracted.
cf. <agx_GPfBKpkSc3Gx@lorenzo-VM>
source: <cover.1776384902.git.lorenzo.pegorari2002@gmail.com>
^ permalink raw reply
* Re: [PATCH v2 2/2] status: improve rebase todo list parsing
From: Junio C Hamano @ 2026-06-11 16:08 UTC (permalink / raw)
To: Phillip Wood; +Cc: git, Elijah Newren, Patrick Steinhardt
In-Reply-To: <4fafee2c-4151-45f4-a842-17d6b77d951c@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
> Hi Junio
>
> On 31/05/2026 01:46, Junio C Hamano wrote:
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>
>>> +static void abbrev_oid_in_line(struct repository *r,
>>> + struct strbuf *line, char **pp)
>>> +{
>>> ...
>>> + have_oid = !repo_get_oid(r, p, &oid);
>>> + *end_of_object_name = saved;
>>> + if (!have_oid)
>>> + goto out; /* object name was a label */
>>
>> Can there be a label "deadbeef123" that is unrelated to an object whose
>> object name happens to abbreviate to "deadbeef123"?
>
> In theory yes, but I had assumed it was so unlikely to happen that we
> could ignore it. If we want to be more careful then we could add a "bool
> maybe_label" argument for commands that accept a label or a revision and
> check if "refs/rewritten/$object_name" exists before trying repo_get_oid().
To me, how rare the possibility of such a bug happening is of
secondary importance. What affects the decision more is when the
"rare" failure happens, if it is immediately obvious to the user,
and if the user may be further harmed badly if they used the wrong
information given by the tool due to such a "rare" failure.
It would be a huge plus if the workaround, when such a "rare"
failure triggers, would be immediately obvious to the user.
What we do not want to see is that the tool to create a wrong
result, cascading into more problems, silently. In a sense, it is
even worse if such a bug triggers only rarely, because it would mean
that the users always have to be on the lookout.
Having said all that.
I suspect that the OID in the output generated by "status" after it
parses rebase "todo list" is merely meant as an eye candy, and the
users do not _use_ it to decide further actions based on them.
Or do people stare at "git status" output, find an interesting
object name and go "git show" on it or something? If not, then even
if such a failure were not rare, it would be OK. We may however
want to record i as a limitation of the current implementation in
the end-user facing documentation, though.
Thanks.
^ permalink raw reply
* Shipping 2.55 with stricter "neuter sideband" topic
From: Junio C Hamano @ 2026-06-11 15:48 UTC (permalink / raw)
To: git
In-Reply-To: <20260305233452.3727126-8-gitster@pobox.com>
Junio C Hamano <gitster@pobox.com> writes:
Was: Re: [PATCH v5 7/7] sideband: delay sanitizing by default to Git v3.0
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The sideband sanitization patches allow ANSI color sequences through
> by default, preserving compatibility with pre-receive hooks that
> provide colored output during `git push`.
>
> Even so, there is concern that changing any default behavior in a
> minor release may have unforeseen consequences. To accommodate this,
> defer the secure-by-default behavior to Git v3.0, where breaking
> changes are expected.
>
> This gives users and tooling time to prepare, while committing to
> address CVE-2024-52005 in Git v3.0.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> [jc: adjusted for the removal of 'default' value]
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> Documentation/config/sideband.adoc | 12 ++++++++++--
> sideband.c | 6 +++++-
> t/t5409-colorize-remote-messages.sh | 18 +++++++++++++-----
> 3 files changed, 28 insertions(+), 8 deletions(-)
As some of you may have noticed, Dscho's "be more strict about
control code sequences used in sideband output and pass only the
ANSI color sequences by default" series originally had this "but
until Git 3.0, be loose as before" as the last step. I kept this
step outside 'next' while the remainder graduated to 'master' for
upcoming v2.55.0, hoping that it would give us a chance to measure
how this limiting negatively affects real-world users.
The merge of the stricter version happend about a month ago at
7760f83b (Merge branch 'jc/neuter-sideband-fixup', 2026-05-11).
Luckily, it seems that we haven't heard any complaints after it
happened.
So I plan to hold this step back indefinitely (aka "retract this
step"), which means that the "neuter sideband" topic will ship
in its stricter form in Git 2.55.
Thoughts?
^ permalink raw reply
* Re: [PATCH v2 0/7] setup: drop global state
From: Justin Tobler @ 2026-06-11 15:47 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git
In-Reply-To: <20260611-b4-pks-setup-drop-global-state-v2-0-a6f7269c841d@pks.im>
On 26/06/11 08:44AM, Patrick Steinhardt wrote:
> Hi,
>
> this patch series continues to refactor "setup.c", where the focus is to
> drop remaining global state that we have in "setup.c". The most
> important consequence of this is that we don't need to rely on
> `the_repository` in `is_bare_repository()` anymore.
>
> This series is built on top of 1ff279f340 (The 13th batch, 2026-06-09)
> with ps/setup-centralize-odb-creation at 42b9d3dc9d (setup: construct
> object database in `apply_repository_format()`, 2026-06-04) merged into
> it.
>
> Changes in v2:
> - Improve documentation for some aspects of `check_repository_format_gently()`.
> - Link to v1: https://patch.msgid.link/20260610-b4-pks-setup-drop-global-state-v1-0-5dff3eec8f06@pks.im
>
> Thanks!
>
> Patrick
>
> ---
[snip]
> Range-diff versus v1:
>
> 1: 0281a4bca9 = 1: 96b71f5223 builtin/init: stop modifying global `git_work_tree_cfg` variable
> 2: 6fdc8d77e8 = 2: a51c0ff79d builtin/init: simplify logic to configure worktree
> 3: ce31595ff5 ! 3: e06393ddc5 setup: remove global `git_work_tree_cfg` variable
> @@ Commit message
> Refactor the code so that we instead use the worktree configuration as
> discovered via the repository format. Drop the global variable.
>
> + Note that in `check_repository_format_gently()` we now have to free the
> + candidate work tree variable. This change is required to retain previous
> + semantics: before we essentially had an implicit `else` branch where we
> + set `git_work_tree_cfg = NULL`, but we were able to elide that branch
> + because we already knew that it would be `NULL` anyway. Now that we use
> + the candidate work tree directly to populate the repository's work tree
> + though we have to clear it to retain those semantics.
I find the additional explaination here quite helpful. Thanks.
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
>
> ## setup.c ##
> 4: 6a69dc853c = 4: 628ed54c8c builtin/init: stop modifying `is_bare_repository_cfg`
> 5: afa2d8bbda ! 5: 02ceaf4a20 environment: split up concerns of `is_bare_repository_cfg`
> @@ setup.c: static int check_repository_format_gently(const char *gitdir,
> + * dictate bareness; it is inherited from the main worktree.
> + */
> + candidate->is_bare = -1;
> ++
> ++ /*
> ++ * Furthermore, "core.worktree" is supposed to be ignored when
> ++ * we have a commondir configured, unless it comes from the
> ++ * per-worktree configuration.
> ++ */
> FREE_AND_NULL(candidate->work_tree);
Ok, so when we have a commondir set we need to clear
`candidate->work_tree` since we need to ignore core.worktree
configuration in such cases. Makes sense.
The changes in this version of the series looks good to me.
-Justin
^ permalink raw reply
* Re: [PATCH 5/7] environment: split up concerns of `is_bare_repository_cfg`
From: Justin Tobler @ 2026-06-11 15:33 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git
In-Reply-To: <aip9irJ7WBaICxDa@pks.im>
On 26/06/11 11:19AM, Patrick Steinhardt wrote:
> On Wed, Jun 10, 2026 at 05:22:04PM -0500, Justin Tobler wrote:
> > On 26/06/10 08:56AM, Patrick Steinhardt wrote:
> > > diff --git a/builtin/init-db.c b/builtin/init-db.c
> > > index 52aa92fb0a..566732c9f4 100644
> > > --- a/builtin/init-db.c
> > > +++ b/builtin/init-db.c
> > > @@ -81,7 +81,7 @@ int cmd_init_db(int argc,
> > > const char *template_dir = NULL;
> > > char *template_dir_to_free = NULL;
> > > unsigned int flags = 0;
> > > - int bare = is_bare_repository_cfg;
> > > + int bare = startup_info->force_bare_repository ? 1 : -1;
> >
> > Any particular reason to continue mapping `force_bare_repository=false`
> > to -1? Or was this to just minimize changes?
>
> The `-1` value doesn't mean "false", but it rather means "undecided".
> The effect of this is that "core.bare" will eventually override this.
Ok, so `bare` here is still ultimately a combination of
`force_bare_repository` and `bare_cfg`.
> > > diff --git a/setup.c b/setup.c
> > > index 71fc6b33da..2b690da8ca 100644
> > > --- a/setup.c
> > > +++ b/setup.c
> > > @@ -795,10 +795,16 @@ static int check_repository_format_gently(const char *gitdir,
> > > has_common = 0;
> > > }
> > >
> > > - if (!has_common) {
> > > - if (candidate->is_bare != -1)
> > > - is_bare_repository_cfg = candidate->is_bare;
> > > - } else {
> > > + if (startup_info->force_bare_repository) {
> > > + candidate->is_bare = 1;
> > > + FREE_AND_NULL(candidate->work_tree);
> > > + } else if (has_common) {
> > > + /*
> > > + * When sharing a common dir with another repository (e.g. a
> > > + * linked worktree), do not let this repository's config
> > > + * dictate bareness; it is inherited from the main worktree.
> > > + */
> > > + candidate->is_bare = -1;
> > > FREE_AND_NULL(candidate->work_tree);
> >
> > Previously, when there was a common dir, `candidate->work_tree` was left
> > untouched, but now we are expclicitly setting it. I'm not sure I fully
> > understand this change.
>
> I cannot blame you. All of this logic is so unbelievably tangled and
> hard to follow.
>
> In any case, I think you might have missed the fact that we `else if`
> branch is now `has_common` as compared to `!has_common`? To explain the
> different cases a bit:
>
> - When we have `force_bare_repository` we are being told that the
> repository should be treated as bare. So we set `is_bare` and also
> clear the work tree that may have been discovered.
>
> - When we have a commondir we know that we're in a worktree.
> Previously we did nothing in this case, and that had the implicit
> effect that `is_bare_repository_cfg` would remain at `-1`. So to
> match that behaviour we have to also reset the candidate's bareness
> to `-1`, so that we parse it via the repository's configuration at a
> later point in time.
>
> The other part here is that we also reset `candidate->work_tree`.
> This is because the expectation is that `$GIT_DIR/common` should
> override any "core.worktree" settings. Quoting git-config(1):
>
> If GIT_COMMON_DIR environment variable is set, core.worktree is
> ignored and not used for determining the root of working tree.
>
> - When we don't have a commondir we previosuly had to also adapt the
> global `is_bare_repository_cfg` variable. This part is not necessary
> anymore, so we basically just drop this case altogether.
Thanks for explaination. This make more sense now.
-Justin
^ permalink raw reply
* [ANNOUNCE] Git v2.55.0-rc0
From: Junio C Hamano @ 2026-06-11 15:32 UTC (permalink / raw)
To: git; +Cc: Linux Kernel, git-packagers
An early preview release Git v2.55.0-rc0 is now available for
testing at the usual places. It is comprised of 397 non-merge
commits since v2.54.0, contributed by 70 people, 22 of which are
new faces [*].
The tarballs are found at:
https://www.kernel.org/pub/software/scm/git/testing/
The following public repositories all have a copy of the
'v2.55.0-rc0' tag and the 'master' branch that the tag points at:
url = https://git.kernel.org/pub/scm/git/git
url = https://kernel.googlesource.com/pub/scm/git/git
url = git://repo.or.cz/alt-git.git
url = https://github.com/gitster/git
New contributors whose contributions weren't in v2.54.0 are as follows.
Welcome to the Git development community!
Abhinav Gupta, Aliwoto, Brandon Chinn, David Lin, Ethan Dickson,
Hugo Osvaldo Barrera, Ivan Baluta, Jean-Christophe Manciot,
Jonas Rebmann, Kristofer Karlsson, Kushal Das, Luke Martin,
Matheus Afonso Martins Moreira, Michael Grossfeld, Owen Stephens,
Saagar Jha, Scott Bauersfeld, Scott L. Burson, Sebastien Tardif,
Shardul Natu, Siddh Raman Pant, and slonkazoid.
Returning contributors who helped this release are as follows.
Thanks for your continued support.
Adam Johnson, Adrian Ratiu, Ævar Arnfjörð Bjarmason, Alyssa
Ross, brian m. carlson, Christian Couder, D. Ben Knoble,
Derrick Stolee, Elijah Newren, Emily Shaffer, Ezekiel Newren,
Ghanshyam Thakkar, Greg Hurrell, Harald Nordgren, Jan Palus,
Jean-Noël Avila, Jeff King, Johannes Schindelin, Johannes Sixt,
Jonatan Holmgren, Junio C Hamano, Justin Tobler, Karthik Nayak,
Kristoffer Haugsbakk, LorenzoPegorari, Matthew John Cheetham,
Michael Montalbo, Mirko Faina, Pablo Sabater, Patrick Steinhardt,
Paul Tarjan, Philippe Blain, Phillip Wood, Pushkar Singh,
Ramsay Jones, René Scharfe, Samo Pogačnik, Shreyansh Paliwal,
Siddharth Asthana, Siddharth Shrimali, SZEDER Gábor, Taylor
Blau, Toon Claes, Torsten Bögershausen, Trieu Huynh, Tuomas
Ahola, Usman Akinyemi, and Zakariyah Ali.
[*] We are counting not just the authorship contribution but issue
reporting, mentoring, helping and reviewing that are recorded in
the commit trailers.
----------------------------------------------------------------
Git v2.55 Release Notes (draft)
===============================
UI, Workflows & Features
------------------------
* Hook scripts defined via the configuration system can now be
configured to run in parallel.
* The userdiff driver for the Scheme language has been extended to
cover other Lisp dialects.
* Terminal control sequences coming over the sideband while talking
to a remote repository are mostly disabled by default, except for
ANSI color escape sequences.
* "ort" merge backend improvements.
* "git checkout -m another-branch" was invented to deal with local
changes to paths that are different between the current and the new
branch, but it gave only one chance to resolve conflicts. The command
was taught to create a stash to save the local changes.
* A new builtin "git format-rev" is introduced for pretty formatting
one revision expression per line or commit object names found in
running text.
* "git history" learned "fixup" command.
* The internal URL parsing logic has been made accessible via a new
subcommand "git url-parse".
* Misspelt proxy URL (e.g., httt://...) did not trigger any warning
or failure, which has been corrected.
* Document the fact that .git/info/exclude is shared across worktrees
linked to the same repository.
* The command line parser for "git diff" learned a few options take
only non-negative integers.
* The graph output from commands like "git log --graph" can now be
limited to a specified number of lanes, preventing overly wide output
in repositories with many branches.
* The fsmonitor daemon has been implemented for Linux.
* "git cat-file --batch" learns an in-line command "mailmap"
that lets the user toggle use of mailmap.
* The "git pack-objects --path-walk" traversal has been integrated
with several object filters, including blobless and sparse filters.
* "git push" learned to take a "remote group" name to push to, which
causes pushes to multiple places, just like "git fetch" would do.
* The 'git-jump' command (in contrib/) has been taught to automatically
pick a mode (merge, diff, or ws) when invoked without arguments.
* The documentation for `push.default = simple` has been clarified to
better explain its behavior, making it clear that it pushes the
current branch to a same-named branch on the remote, and detailing
the upstream requirements for centralized workflows.
* The documentation for "--word-diff" has been extended with a bit of
implementation detail of where these different words come from.
Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
* Promisor remote handling has been refactored and fixed in
preparation for auto-configuration of advertised remotes.
* Rust support is enabled by default (but still allows opting out) in
some future version of Git.
* Preparation of the xdiff/ codebase to work with Rust.
* Use a larger buffer size in the code paths to ingest pack stream.
* Refactor service routines in the ref subsystem backends.
* Shrink wasted memory in Myers diff that does not account for common
prefix and suffix removal.
* Enable expensive tests to catch topics that may cause breakages on
integration branches closer to their origin in the contributor PR
builds.
* "git merge-base" optimization.
* The limit_list() function that is one of the core part of the
revision traversal infrastructure has been optimized by replacing
its use of linear list with priority queue.
* In a lazy clone, "git cherry" and "git grep" often fetch necessary
blob objects one by one from promisor remotes. It has been corrected
to collect necessary object names and fetch them in bulk to gain
reasonable performance.
* The logic to determine that branches in an octopus merge are
independent has been optimized.
* The consistency checks for the files reference backend have been updated
to skip lock files earlier, avoiding unnecessary parsing of
intermediate files.
* The negotiation tip options in "git fetch" have been reworked to
allow requiring certain refs to be sent as "have" lines, and to
restrict negotiation to a specific set of refs.
* The repacking code has been refactored and compaction of MIDX layers
have been implemented, and incremental strategy that does not require
all-into-one repacking has been introduced.
* ODB transaction interface is being reworked to explicitly handle
object writes.
* Add a new odb "in-memory" source that is meant to only hold
tentative objects (like the virtual blob object that represents the
working tree file used by "git blame").
* Many uses of the_repository has been updated to use a more
appropriate struct repository instance in setup.c codepath.
* Revision traversal optimization.
* Build update.
* The logic to lazy-load trees from the commit-graph has been made
more robust by falling back to reading the commit object when
the commit-graph is no longer available.
* The "name" argument in git_connect() and related functions has been
converted to a "service" enum to improve type safety and clarify its
purpose.
* 'git restore --staged' has been optimized to avoid unnecessarily expanding
the sparse index when operating on paths within the sparse checkout
definition, by handling sparse directory entries at the tree level.
* "git stash -p" has been optimized by reusing cached index
entries in its temporary index, avoiding unnecessary lstat()
calls on unchanged files.
* The check for non-stale commits in the priority queue used by
`paint_down_to_common` and `ahead_behind` has been optimized by
replacing an O(N) scan with an O(1) counter, yielding performance
improvements in repositories with wide histories.
* Reachability bitmap generation has been significantly optimized. By
reordering tree traversal, caching object positions, and refining how
pseudo-merge bitmaps are constructed, the performance of "git repack
--write-midx-bitmaps" is improved, especially for large repositories
and when using pseudo-merges.
* Adding a decimal integer with strbuf_addf("%u") appears commonly;
they have been optimized by using a custom formatter.
* Formatting object name in full hexadecimal form has been optimized
by using a new strbuf_add_oid_hex() helper function.
* Encourage original authors to monitor the CI status.
* The `git log -L` implementation has been refactored to use the
standard diff output pipeline, enabling pickaxe and diff-filter to
work as expected. Additionally, metadata-only diff formats like
--raw and --name-only are now supported with -L.
* The loose object source has been refactored into a proper `struct
odb_source`.
Fixes since v2.54
-----------------
* Code clean-up to use the right instance of a repository instance in
calls inside refs subsystem.
(merge 57c590feb9 sp/refs-reduce-the-repository later to maint).
* The check that implements the logic to see if an in-core cache-tree
is fully ready to write out a tree object was broken, which has
been corrected.
(merge 521731213c dl/cache-tree-fully-valid-fix later to maint).
* The test suite harness and many individual test scripts have been
updated to work correctly when 'set -e' is in effect, which helps
detect misspelled test commands.
(merge ffe8005b9d ps/test-set-e-clean later to maint).
* Revert a recent change that introduced a regression to help mksh users.
* Update various GitHub Actions versions.
* Avoid hitting the pathname limit for socks proxy socket during the
test..
* To help Windows 10 installations, avoid removing files whose
contents are still mmap()'ed.
* The 'git backfill' command now rejects revision-limiting options that
are incompatible with its operation, uses standard documentation for
revision ranges, and includes blobs from boundary commits by default
to improve performance of subsequent operations.
(merge a1ad4a0fca en/backfill-fixes-and-edges later to maint).
* "git grep" update.
(merge 9ff4b5ab1b rs/grep-column-only-match-fix later to maint).
* Headers from glibc 2.43 when used with clang does not allow
disabling C11 language features, causing build failures..
* The 'http.emptyAuth=auto' configuration now correctly attempts
Negotiate authentication before falling back to manual credentials.
This allows seamless Kerberos ticket-based authentication without
requiring users to explicitly set 'http.emptyAuth=true'.
(merge 4919938d28 mc/http-emptyauth-negotiate-fix later to maint).
* Ramifications of turning off commit-graph has been documented a bit
more clearly.
(merge 48c855bb8f kh/doc-commit-graph later to maint).
* "git rebase --update-refs", when used with an rebase.instructionFormat
with "%d" (describe) in it, tried to update local branch HEAD by
mistake, which has been corrected.
(merge 106b6885c7 ag/rebase-update-refs-limit-to-branches later to maint).
* Tweak the way how sideband messages from remote are printed while
we talk with a remote repository to avoid tickling terminal
emulator glitches.
(merge 31e8fcabd8 rs/sideband-clear-line-before-print later to maint).
* The configuration variable submodule.fetchJobs was not read correctly,
which has been corrected.
(merge aa45a5902f sj/submodule-update-clone-config-fix later to maint).
* Update code paths that assumed "unsigned long" was long enough for
"size_t".
(merge 7a094d68a2 js/objects-larger-than-4gb-on-windows later to maint).
* Stop using unmaintained custom allocator in Windows build which was
the last user of the code.
* The computation to shorten the filenames shown in diffstat measured
width of individual UTF-8 characters to add up, but forgot to take
into account error cases (e.g., an invalid UTF-8 sequence, or a
control character).
(merge 09d86a3b98 en/diffstat-utf8-truncation-fix later to maint).
* Some tests assume that bare repository accesses are by default
allowed; rewrite some of them to avoid the assumption, rewrite
others to explicitly set safe.bareRepository to allow them.
(merge 985b38ca6c js/adjust-tests-to-explicitly-access-bare-repo later to maint).
* Signing commit with custom encoding was passing the data to be
signed at a wrong stage in the pipeline, which has been corrected.
(merge 7735d7eee3 bc/sign-commit-with-custom-encoding later to maint).
* Further update to the i18n alias support to avoid regressions.
* "git fetch --deepen=<n>" in a full clone truncated the history to <n>
commits deep, which has been corrected to be a no-op instead.
(merge 2431f5e0e5 sp/shallow-deepen-on-non-shallow-repo-fix later to maint).
* "git maintenance" that goes background did not use the lockfile to
prevent multiple maintenance processes from running at the same
time, which has been corrected.
(merge 29364f1624 ps/maintenance-daemonize-lockfix later to maint).
* Remove ineffective strbuf presizing that would have computed an
allocation that would not have fit in the available memory anyway,
or too small due to integer wraparound to cause immediate automatic
growing.
(merge a9ce8526dc jk/pretty-no-strbuf-presizing later to maint).
* The HTTP walker misinterpreted the alternates file that gives an
absolute path when the server URL does not have the final slash
(i.e., "https://example.com" not "https://example.com/").
(merge b92387cd55 jk/dumb-http-alternate-fix later to maint).
* "git bisect" now uses the selected terms (e.g., old/new) more
consistently in its output.
(merge cb55991825 jr/bisect-custom-terms-in-output later to maint).
* Update GitLab CI jobs that exercise macOS.
(merge 62319b49bb ps/gitlab-ci-macOS-improvements later to maint).
* "Friday noon" asked in the morning on Sunday was parsed to be one
day before the specified time, which has been corrected.
(merge b809304101 ta/approxidate-noon-fix later to maint).
* The GIT_WORK_TREE variable prepared to invoke the push-to-checkout
hook was leaking into the environment even when there was no hook
used and broke the default push-to-deploy (i.e., let "git checkout"
update the working tree only when the working tree is clean).
(merge 44d04e4426 ar/receive-pack-worktree-env later to maint).
* A batch of documentation pages has been updated to use the modern
synopsis style.
(merge 2ef248ae45 ja/doc-synopsis-style-again later to maint).
* The "promisor.quiet" configuration variable was not used from
relevant submodules when commands like "grep --recurse-submodules"
triggered a lazy fetch, which has been corrected.
(merge fa1468a1f7 th/promisor-quiet-per-repo later to maint).
* Correct use of sockaddr API in "git daemon".
(merge 422a5bf575 st/daemon-sockaddr-fixes later to maint).
* A memory leak in `fetch_and_setup_pack_index()` when verification of
the downloaded pack index fails has been plugged. Also an obsolete
`unlink()` call on parse failure has been cleaned up.
* In t3070-wildmatch, "via ls-files" test variants with patterns
containing backslash escapes are now skipped on Windows, avoiding 36
test failures caused by pathspec separator conversion.
(merge 8c84e6802c kk/wildmatch-windows-ls-files-prereq later to maint).
* A linker warning on macOS when building with Xcode 16.3 or newer has
been avoided by passing -fno-common to the compiler when a
sufficiently new linker is detected.
(merge 5cd4d0d850 hn/macos-linker-warning later to maint).
* Other code cleanup, docfix, build fix, etc.
(merge 80f4b802e9 ja/doc-difftool-synopsis-style later to maint).
(merge b96490241e jc/doc-timestamps-in-stat later to maint).
(merge ef85286e51 ss/t7004-unhide-git-failures later to maint).
(merge 7584d10bc2 mf/format-patch-cover-letter-format-docfix later to maint).
(merge 8547908eb3 pw/rename-to-get-current-worktree later to maint).
(merge 890229b3f3 sg/t6112-unwanted-tilde-expansion-fix later to maint).
(merge ab9753e7bc kh/doc-restore-double-underscores-fix later to maint).
(merge 4a9e097228 za/t2000-modernise-more later to maint).
(merge b635fd0725 kh/doc-log-decorate-list later to maint).
(merge 65ea197dca jk/commit-sign-overflow-fix later to maint).
(merge 3ccb16052a jk/apply-leakfix later to maint).
(merge 5e6e8dc786 tb/pseudo-merge-bugfixes later to maint).
(merge 6d09e798bc pb/doc-diff-format-updates later to maint).
(merge 34a891a2d3 rs/trailer-fold-optim later to maint).
(merge 499f9048e0 ps/t3903-cover-stash-include-untracked later to maint).
(merge b56ab270aa jk/sq-dequote-cleanup later to maint).
(merge 29d9fdcf10 rs/use-builtin-add-overflow-explicitly-on-clang later to maint).
(merge d9982e8290 ed/check-connected-close-err-fd-2.53 later to maint).
(merge 1740cc35d0 ed/check-connected-close-err-fd later to maint).
(merge f4d7eb3d1c sp/doc-range-diff-takes-notes later to maint).
(merge 83e7f3bd2b kh/free-commit-list later to maint).
----------------------------------------------------------------
Changes since v2.54.0 are as follows:
Abhinav Gupta (2):
rebase: ignore non-branch update-refs
sequencer: remove todo_add_branch_context.commit
Adam Johnson (1):
stash: reuse cached index entries in --patch temporary index
Adrian Ratiu (9):
repository: fix repo_init() memleak due to missing _clear()
config: add a repo_config_get_uint() helper
hook: parse the hook.jobs config
hook: allow pre-push parallel execution
hook: add per-event jobs config
hook: warn when hook.<friendly-name>.jobs is set
hook: move is_known_hook() to hook.c for wider use
hook: add hook.<event>.enabled switch
hook: allow hook.jobs=-1 to use all available CPU cores
Aliwoto (1):
http: reject unsupported proxy URL schemes
Alyssa Ross (1):
receive-pack: fix updateInstead with core.worktree
Christian Couder (10):
promisor-remote: try accepted remotes before others in get_direct()
promisor-remote: pass config entry to all_fields_match() directly
promisor-remote: clarify that a remote is ignored
promisor-remote: reject empty name or URL in advertised remote
promisor-remote: refactor should_accept_remote() control flow
promisor-remote: refactor has_control_char()
promisor-remote: refactor accept_from_server()
promisor-remote: keep accepted promisor_info structs alive
promisor-remote: remove the 'accepted' strvec
t5710: use proper file:// URIs for absolute paths
D. Ben Knoble (1):
ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR
David Lin (1):
cache-tree: fix inverted object existence check in cache_tree_fully_valid
Derrick Stolee (20):
t5516: fix test order flakiness
fetch: add --negotiation-restrict option
transport: rename negotiation_tips
remote: add remote.*.negotiationRestrict config
negotiator: add have_sent() interface
fetch: add --negotiation-include option for negotiation
remote: add remote.*.negotiationInclude config
send-pack: pass negotiation config in push
t5620: make test work with path-walk var
pack-objects: pass --objects with --path-walk
t/perf: add pack-objects filter and path-walk benchmark
path-walk: always emit directly-requested objects
path-walk: support blobless filter
backfill: die on incompatible filter options
path-walk: support blob size limit filter
path-walk: add pl_sparse_trees to control tree pruning
pack-objects: support sparse:oid filter with path-walk
t6601: tag otherwise-unreachable trees
t1092: test 'git restore' with sparse index
restore: avoid sparse index expansion
Elijah Newren (9):
backfill: reject rev-list arguments that do not make sense
backfill: document acceptance of revision-range in more standard manner
backfill: default to grabbing edge blobs too
diff: fix out-of-bounds reads and NULL deref in diffstat UTF-8 truncation
merge-ort: handle cached rename & trivial resolution interaction better
promisor-remote: document caller filtering contract
patch-ids.h: add missing trailing parenthesis in documentation comment
builtin/log: prefetch necessary blobs for `git cherry`
grep: prefetch necessary blobs
Emily Shaffer (3):
hook: allow parallel hook execution
hook: mark non-parallelizable hooks
hook: add -j/--jobs option to git hook run
Ethan Dickson (1):
connected: close err_fd in promisor fast-path
Ezekiel Newren (6):
xdiff/xdl_cleanup_records: delete local recs pointer
xdiff: use unambiguous types in xdl_bogo_sqrt()
xdiff/xdl_cleanup_records: use unambiguous types
xdiff/xdl_cleanup_records: make limits more clear
xdiff/xdl_cleanup_records: make setting action easier to follow
xdiff/xdl_cleanup_records: make execution of action easier to follow
Greg Hurrell (1):
git-jump: pick a mode automatically when invoked without arguments
Harald Nordgren (6):
stash: add --label-ours, --label-theirs, --label-base for apply
sequencer: allow create_autostash to run silently
sequencer: teach autostash apply to take optional conflict marker labels
checkout: rollback lock on early returns in merge_working_tree
checkout -m: autostash when switching branches
config.mak.uname: avoid macOS linker warning on Xcode 16.3+
Ivan Baluta (1):
doc: clarify push.default=simple behavior
Jean-Noël Avila (10):
doc: convert git-difftool manual page to synopsis style
doc: convert git-range-diff manual page to synopsis style
doc: convert git-shortlog manual page to synopsis style
doc: convert git-describe manual page to synopsis style
doc: convert git-bisect to synopsis style
doc: git bisect: clarify the usage of the synopsis vs actual command
doc: convert git-grep synopsis and options to new style
doc: convert git-am synopsis and options to new style
doc: convert git-apply synopsis and options to new style
doc: convert git-imap-send synopsis and options to new style
Jeff King (12):
t1800: test SIGPIPE with parallel hooks
Revert "transport-helper, connect: use clean_on_exit to reap children on abnormal exit"
pretty: drop strbuf pre-sizing from add_rfc2047()
http: handle absolute-path alternates from server root
apply: plug leak on "patch too large" error
commit: handle large commit messages in utf8 verification
quote.h: bump strvec forward declaration to the top
quote: drop sq_dequote_to_argv()
quote: simplify internals of dequoting
connect: use "service" enum for "name" argument
commit: fall back to full read when maybe_tree is NULL
transport-helper: fix typo in BUG() message
Johannes Schindelin (36):
sideband: mask control characters
sideband: introduce an "escape hatch" to allow control characters
sideband: do allow ANSI color sequences by default
sideband: add options to allow more control sequences to be passed through
sideband: offer to configure sanitizing on a per-URL basis
test-lib: allow bare repository access when breaking changes are enabled
t7900: do not let `$HOME/.gitconfig` interfere with XDG tests
t1300: remove global config settings injected by test-lib.sh
t1305: use `--git-dir=.` for bare repo in include cycle test
t5601: restore `.gitconfig` after includeIf test
ls-files tests: filter `.gitconfig` from `--others` output
status tests: filter `.gitconfig` from status output
safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGES
t5564: use a short path for the SOCKS proxy socket
ci: bump microsoft/setup-msbuild from v2 to v3
ci: bump actions/{upload,download}-artifact to v7 and v8
ci: bump actions/github-script from v8 to v9
ci: bump actions/checkout from v5 to v6
ci: bump git-for-windows/setup-git-for-windows-sdk from v1 to v2
l10n: bump mshick/add-pr-comment from v2 to v3
mingw: optionally use legacy (non-POSIX) delete semantics
maintenance(geometric): do release the `.idx` files before repacking
mingw: stop using nedmalloc
mingw: drop the build-system plumbing for nedmalloc
mingw: remove the vendored compat/nedmalloc/ subtree
index-pack, unpack-objects: use size_t for object size
git-zlib: handle data streams larger than 4GB
odb, packfile: use size_t for streaming object sizes
delta, packfile: use size_t for delta header sizes
test-tool: add a helper to synthesize large packfiles
t5608: add regression test for >4GB object clone
test-tool synthesize: use the unsafe hash for speed
test-tool synthesize: precompute pack for 4 GiB + 1
test-tool synthesize: add precomputed SHA-256 pack for 4 GiB + 1
t5608: mark >4GB tests as EXPENSIVE
ci: run expensive tests on push builds to integration branches
Johannes Sixt (1):
userdiff: tighten word-diff test case of the scheme driver
Jonas Rebmann (3):
bisect: use selected alternate terms in status output
bisect: print bisect terms in single quotes
rev-parse: use selected alternate terms to look up refs
Jonatan Holmgren (1):
alias: restore support for simple dotted aliases
Junio C Hamano (20):
sideband: drop 'default' configuration
CodingGuidelines: st_mtimespec vs st_mtim vs st_mtime
t5551: "GIT_TEST_LONG=Yes make test" is broken
ci: enable EXPENSIVE for contributor builds
Start 2.55 cycle
The second batch
The 3rd batch
The 4th batch
The 5th batch
The 6th batch
Start preparing for 2.54.1
The 7th batch
The 8th batch
SubmittingPatches: proactively monitor GHCI pages
The 9th batch
The 10th batch
The 11th batch
The 12th batch
The 13th batch
Git 2.55-rc0
Justin Tobler (7):
odb: split `struct odb_transaction` into separate header
odb/transaction: use pluggable `begin_transaction()`
odb: update `struct odb_write_stream` read() callback
object-file: remove flags from transaction packfile writes
object-file: avoid fd seekback by checking object size upfront
object-file: generalize packfile writes to use odb_write_stream
odb/transaction: make `write_object_stream()` pluggable
Karthik Nayak (10):
refs: remove unused typedef 'ref_transaction_commit_fn'
refs: introduce `ref_store_init_options`
refs: extract out reflog config to generic layer
refs: return `ref_transaction_error` from `ref_transaction_update()`
update-ref: move `print_rejected_refs()` up
update-ref: handle rejections while adding updates
refs: move object parsing to the generic layer
refs: add peeled object ID to the `ref_update` struct
refs: use peeled tag values in reference backends
refs/files: skip lock files during consistency checks
Kristofer Karlsson (10):
commit-reach: introduce merge_base_flags enum
commit-reach: early exit paint_down_to_common for single merge-base
merge: use repo_in_merge_bases for octopus up-to-date check
revision: use priority queue in limit_list()
commit-reach: use object flags for tips_reachable_from_bases()
t6600: add tests for duplicate tips in tips_reachable_from_bases()
object.h: fix stale entries in object flag allocation table
commit-reach: deduplicate queue entries in paint_down_to_common
commit-reach: replace queue_has_nonstale() scan with O(1) tracking
t3070: skip ls-files tests with backslash patterns on Windows
Kristoffer Haugsbakk (15):
doc: log: fix --decorate description list
doc: log: use the same delimiter in description list
doc: restore: remove double underscore
doc: add caveat about turning off commit-graph
name-rev: wrap both blocks in braces
name-rev: run clang-format before factoring code
name-rev: factor code for sharing with a new command
name-rev: make dedicated --annotate-stdin --name-only test
format-rev: introduce builtin for on-demand pretty formatting
doc: hook: remove stray backtick
doc: hook: consistently capitalize Git
doc: config: include existing git-hook(1) section
doc: hook: don’t self-link via config include
*: replace deprecated free_commit_list
commit: remove deprecated functions
LorenzoPegorari (2):
http: cleanup function fetch_and_setup_pack_index()
http: fix memory leak in fetch_and_setup_pack_index()
Matheus Afonso Martins Moreira (8):
connect: rename enum protocol to url_scheme
url: move url_is_local_not_ssh to url.h
url: move scheme detection to URL header/source
url: return URL_SCHEME_UNKNOWN instead of dying
urlmatch: define url_parse function
builtin: create url-parse command
doc: describe the url-parse builtin
t9904: add tests for the new url-parse builtin
Matthew John Cheetham (4):
http: extract http_reauth_prepare() from retry paths
http: attempt Negotiate auth in http.emptyAuth=auto mode
t5563: add tests for http.emptyAuth with Negotiate
doc: clarify http.emptyAuth values
Michael Montalbo (8):
diff: reject negative values for --inter-hunk-context
diff: reject negative values for -U/--unified
xdiff: guard against negative context lengths
parse-options: clarify what "negated" means for PARSE_OPT_NONEG
doc: clarify that --word-diff operates on line-level hunks
revision: move -L setup before output_format-to-diff derivation
line-log: integrate -L output with the standard log-tree pipeline
line-log: allow non-patch diff formats with -L
Mirko Faina (1):
Fix docs for format.commitListFormat
Pablo Sabater (3):
graph: limit the graph width to a hard-coded max
graph: add --graph-lane-limit option
graph: add truncation mark to capped lanes
Patrick Steinhardt (73):
t: prepare `test_match_signal ()` calls for `set -e`
t: prepare `test_must_fail ()` for `set -e`
t: prepare `stop_git_daemon ()` for `set -e`
t: prepare `git config --unset` calls for `set -e`
t: prepare conditional test execution for `set -e`
t: prepare execution of potentially failing commands for `set -e`
t: prepare `test_when_finished ()`/`test_atexit()` for `set -e`
t0008: silence error in subshell when using `grep -v`
t1301: don't fail in case setfacl(1) doesn't exist or fails
t6002: fix use of `expr` with `set -e`
t9902: fix use of `read` with `set -e`
t: detect errors outside of test cases
replay: allow callers to control what happens with empty commits
builtin/history: generalize function to commit trees
builtin/history: introduce "fixup" subcommand
build: tolerate use of _Generic from glibc 2.43 with Clang
builtin/maintenance: fix locking with "--detach"
run-command: honor "gc.auto" for auto-maintenance
odb: introduce "in-memory" source
odb/source-inmemory: implement `free()` callback
odb: fix unnecessary call to `find_cached_object()`
odb/source-inmemory: implement `read_object_info()` callback
odb/source-inmemory: implement `read_object_stream()` callback
odb/source-inmemory: implement `write_object()` callback
odb/source-inmemory: implement `write_object_stream()` callback
cbtree: allow using arbitrary wrapper structures for nodes
oidtree: add ability to store data
odb/source-inmemory: convert to use oidtree
odb/source-inmemory: implement `for_each_object()` callback
odb/source-inmemory: implement `find_abbrev_len()` callback
odb/source-inmemory: implement `count_objects()` callback
odb/source-inmemory: implement `freshen_object()` callback
odb/source-inmemory: stub out remaining functions
odb: generic in-memory source
t/unit-tests: add tests for the in-memory object source
setup: replace use of `the_repository` in static functions
setup: stop using `the_repository` in `is_inside_git_dir()`
setup: stop using `the_repository` in `is_inside_work_tree()`
setup: stop using `the_repository` in `prefix_path()`
setup: stop using `the_repository` in `path_inside_repo()`
setup: stop using `the_repository` in `verify_filename()`
setup: stop using `the_repository` in `verify_non_filename()`
setup: stop using `the_repository` in `enter_repo()`
setup: stop using `the_repository` in `setup_work_tree()`
setup: stop using `the_repository` in `set_git_work_tree()`
setup: stop using `the_repository` in `setup_git_env()`
setup: stop using `the_repository` in `setup_git_directory_gently()`
setup: stop using `the_repository` in `setup_git_directory()`
setup: stop using `the_repository` in `upgrade_repository_format()`
setup: stop using `the_repository` in `check_repository_format()`
setup: stop using `the_repository` in `initialize_repository_version()`
setup: stop using `the_repository` in `create_reference_database()`
setup: stop using `the_repository` in `init_db()`
gitlab-ci: upgrade macOS runners
gitlab-ci: update macOS image
odb/source-loose: move loose source into "odb/" subsystem
odb/source-loose: store pointer to "files" instead of generic source
odb/source-loose: start converting to a proper `struct odb_source`
odb/source-loose: wire up `reprepare()` callback
odb/source-loose: wire up `close()` callback
odb/source-loose: wire up `read_object_info()` callback
odb/source-loose: wire up `read_object_stream()` callback
odb/source-loose: wire up `for_each_object()` callback
odb/source-loose: wire up `find_abbrev_len()` callback
odb/source-loose: wire up `count_objects()` callback
odb/source-loose: drop `odb_source_loose_has_object()`
odb/source-loose: wire up `freshen_object()` callback
loose: refactor object map to operate on `struct odb_source_loose`
odb/source-loose: wire up `write_object()` callback
object-file: refactor writing objects to use loose source
odb/source-loose: wire up `write_object_stream()` callback
odb/source-loose: stub out remaining callbacks
odb/source-loose: drop pointer to the "files" source
Paul Tarjan (13):
t9210, t9211: disable GIT_TEST_SPLIT_INDEX for scalar clone tests
fsmonitor: fix khash memory leak in do_handle_client
fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon
compat/win32: add pthread_cond_timedwait
fsmonitor: use pthread_cond_timedwait for cookie wait
fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c
fsmonitor: rename fsm-settings-darwin.c to fsm-settings-unix.c
fsmonitor: implement filesystem change listener for Linux
run-command: add close_fd_above_stderr option
fsmonitor: close inherited file descriptors and detach in daemon
fsmonitor: add timeout to daemon stop command
fsmonitor: add tests for Linux
fsmonitor: convert shown khash to strset in do_handle_client
Philippe Blain (3):
diff-format.adoc: remove mention of diff-tree specific output
diff-format.adoc: 'git diff-files' prints two lines for unmerged files
diff-format.adoc: mode and hash are 0* for unmerged paths from index only
Phillip Wood (5):
worktree: rename get_worktree_from_repository()
xdiff: reduce size of action arrays
xdiff: cleanup xdl_clean_mmatch()
xprepare: simplify error handling
xdiff: reduce the size of array
Pushkar Singh (1):
stash: add coverage for show --include-untracked
René Scharfe (10):
grep: fix --column --only-match for 2nd and later matches
sideband: clear full line when printing remote messages
strbuf: add strbuf_add_uint()
cat-file: use strbuf_add_uint()
ls-files: use strbuf_add_uint()
ls-tree: use strbuf_add_uint()
hex: add and use strbuf_add_oid_hex()
trailer: change strbuf in-place in unfold_value()
strbuf: use st_add3() in strbuf_grow()
use __builtin_add_overflow() in st_add() with Clang
SZEDER Gábor (1):
t6112: avoid tilde expansion
Saagar Jha (1):
submodule-config: fix reading submodule.fetchJobs
Samo Pogačnik (1):
shallow: fix relative deepen on non-shallow repositories
Scott Bauersfeld (1):
index-pack, unpack-objects: increase input buffer from 4 KiB to 128 KiB
Scott L. Burson (1):
userdiff: extend Scheme support to cover other Lisp dialects
Sebastien Tardif (3):
daemon: fix IPv6 address corruption in lookup_hostname()
daemon: fix IPv6 address truncation in ip2str()
daemon: guard NULL REMOTE_PORT in execute() logging
Shreyansh Paliwal (3):
refs: add struct repository parameter in get_files_ref_lock_timeout_ms()
refs: remove the_hash_algo global state
refs/reftable-backend: drop uses of the_repository
Siddh Raman Pant (1):
Documentation/git-range-diff: add missing notes options in synopsis
Siddharth Asthana (1):
cat-file: add mailmap subcommand to --batch-command
Siddharth Shrimali (3):
t7004: drop hardcoded tag count for state verification
t7004: dynamically grab expected state in tests
t7004: avoid subshells to capture git exit codes
Taylor Blau (36):
t/helper: add 'test-tool bitmap write' subcommand
t5333: demonstrate various pseudo-merge bugs
pack-bitmap-write: sort pseudo-merge commit lookup table in pack order
pack-bitmap: fix inverted binary search in `pseudo_merge_at()`
pack-bitmap: fix pseudo-merge lookup for shared commits
pack-bitmap: parse commits in `find_pseudo_merge_group_for_ref()`
pack-bitmap: reject pseudo-merge "sampleRate" of 0
Documentation: fix broken `sampleRate` in gitpacking(7)
pack-bitmap: prevent pattern leak on pseudo-merge re-assignment
midx-write: handle noop writes when converting incremental chains
midx: use `strset` for retained MIDX files
midx: build `keep_hashes` array in order
midx: use `strvec` for `keep_hashes`
midx: introduce `--no-write-chain-file` for incremental MIDX writes
midx: support custom `--base` for incremental MIDX writes
repack: track the ODB source via existing_packs
midx: expose `midx_layer_contains_pack()`
repack-midx: factor out `repack_prepare_midx_command()`
repack-midx: extract `repack_fill_midx_stdin_packs()`
repack-geometry: prepare for incremental MIDX repacking
builtin/repack.c: convert `--write-midx` to an `OPT_CALLBACK`
packfile: ensure `close_pack_revindex()` frees in-memory revindex
repack: implement incremental MIDX repacking
repack: introduce `--write-midx=incremental`
repack: allow `--write-midx=incremental` without `--geometric`
path-walk: support `tree:0` filter
path-walk: support `object:type` filter
path-walk: support `combine` filter
pack-bitmap: pass object position to `fill_bitmap_tree()`
pack-bitmap: check subtree bits before recursing
pack-bitmap: reuse stored selected bitmaps
pack-bitmap: consolidate `find_object_pos()` success path
pack-bitmap: cache object positions during fill
pack-bitmap: sort bitmaps before XORing
pack-bitmap: remember pseudo-merge parents
pack-bitmap: build pseudo-merge bitmaps after regular bitmaps
Toon Claes (1):
generate-configlist: collapse depfile for older Ninja
Trieu Huynh (1):
promisor-remote: fix promisor.quiet to use the correct repository
Tuomas Ahola (4):
approxidate: make "today" wrap to midnight
t0006: add support for approxidate test date adjustment
approxidate: make "specials" respect fixed day-of-month
approxidate: use deferred mday adjustments for "specials"
Usman Akinyemi (3):
remote: fix sign-compare warnings in push_cas_option
remote: move remote group resolution to remote.c
push: support pushing to a remote group
Zakariyah Ali (1):
t2000: consolidate second scenario into a single test block
brian m. carlson (6):
docs: update version with default Rust support
ci: install cargo on Alpine
Linux: link against libdl
Enable Rust by default
commit: name UTF-8 function appropriately
commit: sign commit after mutating buffer
^ permalink raw reply
* Re: What's cooking in git.git (Jun 2026, #03)
From: Phillip Wood @ 2026-06-11 15:26 UTC (permalink / raw)
To: Junio C Hamano, git
In-Reply-To: <xmqqzf14tttx.fsf@gitster.g>
Hi Junio
On 09/06/2026 01:56, Junio C Hamano wrote:
>
> * pw/status-rebase-todo (2026-05-01) 2 commits
> - status: improve rebase todo list parsing
> - sequencer: factor out parsing of todo commands
>
> The display of the rebase todo list in "git status" has been
> improved to correctly abbreviate object IDs for more commands and
> avoid misinterpreting refs as object IDs.
>
> Waiting for response(s) to review comment(s).
> cf. <xmqqbjdwcsno.fsf@gitster.g>
I replied to that message with
<4fafee2c-4151-45f4-a842-17d6b77d951c@gmail.com> I'm waiting to hear
whether you agree that the unambiguous label case is unlikely enough to
happen that we can ignore it.
Thanks
Phillip
^ permalink raw reply
* Re: [PATCH v2] ls-files: filter pathspec before lstat
From: Tamir Duberstein @ 2026-06-11 15:17 UTC (permalink / raw)
To: Jeff King; +Cc: git, René Scharfe, Patrick Steinhardt, Junio C Hamano
In-Reply-To: <20260611084132.GK2191159@coredump.intra.peff.net>
On Thu, Jun 11, 2026 at 1:41 AM Jeff King <peff@peff.net> wrote:
>
> On Tue, Jun 09, 2026 at 04:15:41PM -0700, Tamir Duberstein wrote:
>
> > On Tue, Jun 9, 2026 at 3:41 AM Jeff King <peff@peff.net> wrote:
> > >
> > > On Mon, Jun 08, 2026 at 07:37:15PM -0700, Tamir Duberstein wrote:
> > >
> > > > + /*
> > > > + * match_pathspec() is linear in pathspec.nr, so prefilter only
> > > > + * the single-pathspec case. Only entries shown by show_ce()
> > > > + * satisfy --error-unmatch.
> > > > + */
> > > > + if (pathspec.nr == 1 &&
> > > > + !match_pathspec(repo->index, &pathspec, fullname.buf,
> > > > + fullname.len, max_prefix_len, NULL,
> > > > + S_ISDIR(ce->ce_mode) ||
> > > > + S_ISGITLINK(ce->ce_mode)))
> > > > + continue;
> > >
> > > This feels...kind of arbitrary, no? Surely it's also faster with
> > > pathspec.nr == 2, and so on up to some nr closer to the size of the
> > > total index. It feels weird to be making an arbitrary cutoff based on
> > > pathspec performance in calling code like this.
> > >
> > > It is not wrong, per se, as you are optimizing your case without trying
> > > to hurt any others. But what do we do when somebody profiles it and
> > > comes along trying to bump the number to 2, or 10?
> > >
> > > I dunno.
> >
> > Yeah, absolutely it's arbitrary. The simplest answer is that others
> > are welcome to bump this, provided they make the case for it.
>
> OK. I can live with, I suppose, but I am tempted to say that it should
> just kick in always (i.e., removing the pathspec.nr check).
>
> Though I did show a case where the performance regresses, it was pretty
> made-up and not something I'd expect in the real world. And you'd see
> that same crappy performance with "git ls-files -- $(git ls-files)",
> without the "-m". The real solution is making the pathspec code less
> crappy.
Maybe I can find time to look into this -- for now I'll treat this
series as not requiring further work.
Thanks!
Tamir
^ permalink raw reply
* Re: [PATCH v2 1/3] replay: refactor enum replay_mode into a bool
From: Justin Tobler @ 2026-06-11 15:09 UTC (permalink / raw)
To: Toon Claes; +Cc: git
In-Reply-To: <20260610-toon-git-replay-drop-merges-v2-1-5714a71c6d83@iotcl.com>
On 26/06/10 04:49PM, Toon Claes wrote:
> In 2760ee4983 (replay: add --revert mode to reverse commit changes,
> 2026-03-26) the enum `replay_mode` was introduced. This has two possible
> values:
>
> - The value `REPLAY_MODE_REVERT` is used when option `--revert` is
> passed to git-replay(1). When using this value the commits are
> processed in reverse order and the inverse of the changes are
> applied.
>
> - The value `REPLAY_MODE_PICK` is used when either option `--onto` or
> `--advance` is used. In both cases the commits are processed in
> normal order, and the changes are applied as-is.
>
> Since there are only two possible values of this enum, simplify the code
> by converting the enum into a bool. This avoids adding code paths that
> check for invalid values of the enum, and shortens code where the value
> is checked with a ternary operator.
Naive question: Do we expect there to only be two replay modes in the
forseeable future? I suppose if other modes were added in the future
this change would essentially be reverted.
> Signed-off-by: Toon Claes <toon@iotcl.com>
> ---
> replay.c | 59 +++++++++++++++++++++++++----------------------------------
> 1 file changed, 25 insertions(+), 34 deletions(-)
>
> diff --git a/replay.c b/replay.c
> index 4ef8abb607..1f8e5b083b 100644
> --- a/replay.c
> +++ b/replay.c
> @@ -18,11 +18,6 @@
> */
> #define the_repository DO_NOT_USE_THE_REPOSITORY
>
> -enum replay_mode {
> - REPLAY_MODE_PICK,
> - REPLAY_MODE_REVERT,
> -};
> -
> static const char *short_commit_name(struct repository *repo,
> struct commit *commit)
> {
> @@ -81,7 +76,7 @@ static struct commit *create_commit(struct repository *repo,
> struct tree *tree,
> struct commit *based_on,
> struct commit *parent,
> - enum replay_mode mode)
> + bool reverse)
> {
> struct object_id ret;
> struct object *obj = NULL;
> @@ -98,15 +93,13 @@ static struct commit *create_commit(struct repository *repo,
>
> commit_list_insert(parent, &parents);
> extra = read_commit_extra_headers(based_on, exclude_gpgsig);
> - if (mode == REPLAY_MODE_REVERT) {
> + if (reverse) {
> generate_revert_message(&msg, based_on, repo);
> /* For revert, use current user as author (NULL = use default) */
> - } else if (mode == REPLAY_MODE_PICK) {
> + } else {
> find_commit_subject(message, &orig_message);
> strbuf_addstr(&msg, orig_message);
> author = get_author(message);
> - } else {
> - BUG("unexpected replay mode %d", mode);
> }
> reset_ident_date();
> if (commit_tree_extended(msg.buf, msg.len, &tree->object.oid, parents,
> @@ -269,7 +262,7 @@ static struct commit *pick_regular_commit(struct repository *repo,
> struct commit *onto,
> struct merge_options *merge_opt,
> struct merge_result *result,
> - enum replay_mode mode,
> + bool reverse,
> enum replay_empty_commit_action empty)
> {
> struct commit *base, *replayed_base;
> @@ -287,7 +280,21 @@ static struct commit *pick_regular_commit(struct repository *repo,
> replayed_base_tree = repo_get_commit_tree(repo, replayed_base);
> pickme_tree = repo_get_commit_tree(repo, pickme);
>
> - if (mode == REPLAY_MODE_PICK) {
> + if (reverse) {
> + /* Revert: swap base and pickme to reverse the diff */
> + const char *pickme_name = short_commit_name(repo, pickme);
> + merge_opt->branch1 = short_commit_name(repo, replayed_base);
> + merge_opt->branch2 = xstrfmt("parent of %s", pickme_name);
> + merge_opt->ancestor = pickme_name;
> +
> + merge_incore_nonrecursive(merge_opt,
> + pickme_tree,
> + replayed_base_tree,
> + base_tree,
> + result);
> +
> + free((char *)merge_opt->branch2);
> + } else {
> /* Cherry-pick: normal order */
> merge_opt->branch1 = short_commit_name(repo, replayed_base);
> merge_opt->branch2 = short_commit_name(repo, pickme);
> @@ -303,22 +310,6 @@ static struct commit *pick_regular_commit(struct repository *repo,
> result);
>
> free((char *)merge_opt->ancestor);
> - } else if (mode == REPLAY_MODE_REVERT) {
> - /* Revert: swap base and pickme to reverse the diff */
> - const char *pickme_name = short_commit_name(repo, pickme);
> - merge_opt->branch1 = short_commit_name(repo, replayed_base);
> - merge_opt->branch2 = xstrfmt("parent of %s", pickme_name);
> - merge_opt->ancestor = pickme_name;
> -
> - merge_incore_nonrecursive(merge_opt,
> - pickme_tree,
> - replayed_base_tree,
> - base_tree,
> - result);
> -
> - free((char *)merge_opt->branch2);
> - } else {
> - BUG("unexpected replay mode %d", mode);
> }
> merge_opt->ancestor = NULL;
> merge_opt->branch2 = NULL;
> @@ -341,7 +332,7 @@ static struct commit *pick_regular_commit(struct repository *repo,
> }
> }
>
> - return create_commit(repo, result->tree, pickme, replayed_base, mode);
> + return create_commit(repo, result->tree, pickme, replayed_base, reverse);
> }
>
> void replay_result_release(struct replay_result *result)
> @@ -381,13 +372,13 @@ int replay_revisions(struct rev_info *revs,
> char *revert;
> const char *ref;
> struct object_id old_oid;
> - enum replay_mode mode = REPLAY_MODE_PICK;
> + bool reverse;
> int ret;
>
> advance = xstrdup_or_null(opts->advance);
> revert = xstrdup_or_null(opts->revert);
> - if (revert)
> - mode = REPLAY_MODE_REVERT;
> + reverse = !!revert;
> +
> set_up_replay_mode(revs->repo, &revs->cmdline, opts->onto,
> &detached_head, &advance, &revert, &onto, &update_refs);
>
> @@ -430,8 +421,8 @@ int replay_revisions(struct rev_info *revs,
> die(_("replaying merge commits is not supported yet!"));
>
> last_commit = pick_regular_commit(revs->repo, commit, replayed_commits,
> - mode == REPLAY_MODE_REVERT ? last_commit : onto,
> - &merge_opt, &result, mode, opts->empty);
> + reverse ? last_commit : onto,
> + &merge_opt, &result, reverse, opts->empty);
> if (!last_commit)
> break;
The patch itself looks trivially correct.
-Justin
^ permalink raw reply
* Re: [PATCH v2] commit-reach: remove get_reachable_subset()
From: Derrick Stolee @ 2026-06-11 14:51 UTC (permalink / raw)
To: Kristofer Karlsson; +Cc: Kristofer Karlsson via GitGitGadget, git
In-Reply-To: <CAL71e4Nn8Lk87A5=t1Wu=SStQqzmFqad+pcyOw_Fu-PLpRMq_g@mail.gmail.com>
On 6/11/2026 9:52 AM, Kristofer Karlsson wrote:
> On Thu, 11 Jun 2026 at 14:57, Derrick Stolee <stolee@gmail.com> wrote:
>> Finally, a commentary: You seem to have a habit of responding to
>> review feedback only through new patch versions, but I'd rather see
>> some thoughts in the discussion thread as direct replies to the review,
>> especially if you think you will change direction like this. Saying
>> something like "Maybe I should update the method to have two walk modes"
>> in a reply would have given me an opportunity to respond and perhaps
>> avoided a new version that went in this direction.
>
> That's fair, I apologize both for jumping ahead too quickly with a new
> patch and also for evolving it into multiple logical changes
> (both code removal and complex refactoring).
>
> I will be more mindful going forward about letting the discussion
> settle more before submitting followup patches.
>
> I have no strong opinion on how to proceed - either park/abandon this
> or go with v1 as-is. I think you're right that having two modes within
> tips_reachable_from_bases is reducing the win here unless the mode is
> truly seamless but the abstraction does leak through a bit.
I think that my biggest issue is that callers are needing to know
something about the performance characteristics of each solution. It
may be better to keep the behavior completely internal: have the
method decide which approach is better based on the information it
has. For instance: is the minimum generation number "infinite"? Then
the BFS is going to be better than the DFS approach. Such an approach
would make it clear why there is the complexity _and_ would improve
both callers in the right scenarios.
You were correct to find two methods that claimed to do the same
thing, but we need to take time to consider the solutions based on
all factors.
Thanks,
-Stolee
^ permalink raw reply
* [RFC PATCH] MyFirstContribution: mention trimming quoted text in replies
From: Weijie Yuan @ 2026-06-11 14:14 UTC (permalink / raw)
To: git; +Cc: gitster
Hi,
Junio has pointed out a few times that over-quoting can make review
discussions harder to follow [1], so I thought it would be helpful to
add a reminder about it in MyFirstContribution. Please feel free to
comment on the patch, as my English is not good.
For your reference:
Git's ReviewingGuidelines [2]:
If a patch is long, you are encouraged to delete parts of it that are
unrelated to your review from the email reply. Make sure to leave enough
context for readers to understand your comments!
The Linux Kernel documentation [3]:
Similarly, please trim all unneeded quotations that aren´t relevant to
your reply. This makes responses easier to find, and saves time and
space.
[1] <xmqqik7tz092.fsf@gitster.g>
[2] https://git-scm.com/docs/ReviewingGuidelines/2.38.0#_performing_your_review
[3] https://docs.kernel.org/process/submitting-patches.html#use-trimmed-interleaved-replies-in-email-discussions
--- >8 ---
ReviewingGuidelines already advises reviewers to trim irrelevant quoted
context when replying. Give the same advice to new contributors in
MyFirstContribution, so our documentation is consistent about mailing
list reply etiquette.
Signed-off-by: Weijie Yuan <wy@wyuan.org>
---
Documentation/MyFirstContribution.adoc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/MyFirstContribution.adoc b/Documentation/MyFirstContribution.adoc
index 607876f3d8..0e2a9313ce 100644
--- a/Documentation/MyFirstContribution.adoc
+++ b/Documentation/MyFirstContribution.adoc
@@ -1453,6 +1453,11 @@ effect which had not occurred to you. It is always okay to ask for clarification
if you aren't sure why a change was suggested, or what the reviewer is asking
you to do.
+When replying to review comments, quote only the parts of the message that are
+relevant to your response. It is usually helpful to trim away unrelated context,
+such as large portions of the patch that are not being discussed, while keeping
+enough quoted text for readers to understand what you are responding to.
+
Make sure your email client has a plaintext email mode and it is turned on; the
Git list rejects HTML email. Please also follow the mailing list etiquette
outlined in the
--
2.54.0
^ permalink raw reply related
* Re: [PATCH v2] commit-reach: remove get_reachable_subset()
From: Kristofer Karlsson @ 2026-06-11 13:52 UTC (permalink / raw)
To: Derrick Stolee; +Cc: Kristofer Karlsson via GitGitGadget, git
In-Reply-To: <ffaf26b1-c55e-43c7-84b6-f810a54f7717@gmail.com>
On Thu, 11 Jun 2026 at 14:57, Derrick Stolee <stolee@gmail.com> wrote:
> Finally, a commentary: You seem to have a habit of responding to
> review feedback only through new patch versions, but I'd rather see
> some thoughts in the discussion thread as direct replies to the review,
> especially if you think you will change direction like this. Saying
> something like "Maybe I should update the method to have two walk modes"
> in a reply would have given me an opportunity to respond and perhaps
> avoided a new version that went in this direction.
That's fair, I apologize both for jumping ahead too quickly with a new
patch and also for evolving it into multiple logical changes
(both code removal and complex refactoring).
I will be more mindful going forward about letting the discussion
settle more before submitting followup patches.
I have no strong opinion on how to proceed - either park/abandon this
or go with v1 as-is. I think you're right that having two modes within
tips_reachable_from_bases is reducing the win here unless the mode is
truly seamless but the abstraction does leak through a bit.
Thanks,
Kristofer
^ permalink raw reply
* Re: [PATCH v4 0/8] Auto-configure advertised remotes via URL allowlist
From: Christian Couder @ 2026-06-11 13:29 UTC (permalink / raw)
To: Junio C Hamano
Cc: Toon Claes, git, Patrick Steinhardt, Taylor Blau, Karthik Nayak,
Elijah Newren, Kristoffer Haugsbakk
In-Reply-To: <xmqqh5naxwfc.fsf@gitster.g>
On Wed, Jun 10, 2026 at 5:11 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Toon Claes <toon@iotcl.com> writes:
> > Thanks for explaining, I still agree moving on like this.
>
> Sounds good. Shall we mark the topic for 'next' then?
Yes please. I think it's ready.
Thanks.
^ permalink raw reply
* Re: [PATCH v2 3/3] doc: git-config: escape erroneous highlight markup
From: Tuomas Ahola @ 2026-06-11 13:28 UTC (permalink / raw)
To: Jeff King; +Cc: git, Kristoffer Haugsbakk, Junio C Hamano, Jean-Noël Avila
In-Reply-To: <20260611083139.GA2237523@coredump.intra.peff.net>
Jeff King <peff@peff.net> wrote:
> On Thu, Jun 11, 2026 at 11:02:42AM +0300, Tuomas Ahola wrote:
>
> > > > If _<message>_ begins with one or more whitespaces followed
> > > > -by "#", it is used as-is. If it begins with "#", a space is
> > > > +by "\#", it is used as-is. If it begins with "\#", a space is
> > > > prepended before it is used. Otherwise, a string " # " (a
> > > > space followed by a hash followed by a space) is prepended
> > >
> > > I saw the comment on round 1 about this second "#" on the line. But
> > > while we are here, should we be doing the one in the context, too?
> > >
> > > -Peff
> >
> > It seems adding that second backslash was already too much, as doc-diff (which
> > I neglected to run before submitting V2) shows:
> >
> > ```
> > $ ./doc-diff V1 V2
> >
> > If <message> begins with one or more whitespaces followed by "#",
> > - it is used as-is. If it begins with "#", a space is prepended
> > + it is used as-is. If it begins with "\#", a space is prepended
> > before it is used. Otherwise, a string " # " (a space followed by a
> > hash followed by a space) is prepended to it. The resulting string
> > is placed immediately after the value defined for the variable. The
> > ```
>
> Heh, it would not be the first time I am baffled by asciidoc's parsing. :)
>
> Adding a backslash to the third instance "fixes" the second one to me,
> but I wouldn't want to rely on that (plus it breaks the third instance).
>
> Using backticks does work, though it always opens a typographical
> question. When reading the source, you see `#`, so you get a punctuation
> delimiter but no typographical one. In the rendered output, you'll see
> it in a typewriter font (assuming we fix the config issue), but we'd
> lose the visible punctuation. I could live with that.
>
> But for " # ", it gets weirder. We need punctuation to call out the
> spaces, but what should happen to the quotes? They are not really part
> of the literal string, so should they go inside or outside the
> backticks? I think it may be a moot point as "` # `" is not parsed as
> you might hope by asciidoc. Doing `" # "` does work, and is probably OK
> enough here.
>
> -Peff
Okay, I'll change those to `#` and `" # "`. That seems to be the best,
or the least bad option right now. :-)
--Tuomas
^ permalink raw reply
* [PATCH v5 10/10] builtin/history: implement "drop" subcommand
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
A common operation when editing the commit history is to drop a specific
commit from the history entirely, but this operation is not currently
covered by git-history(1).
A couple of noteworthy bits:
- This is the first git-history(1) command that will ultimately result
in changes to both the index and the working tree. We thus have to
add logic to merge resulting changes into those.
- It is still not possible to replay merge commits, so this limitation
is inherited for the new "drop" command.
- For now we refuse to drop root commits. While we _can_ indeed drop
root commits in the general case, there are edge cases where the
resulting history would become completely empty. This is thus left
to a subsequent patch series.
Other than that, most of the logic is rather straight-forward as we can
continue to build on the preexisting logic in git-history(1) for most of
the part.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Documentation/git-history.adoc | 38 ++-
builtin/history.c | 186 ++++++++++++++
t/meson.build | 1 +
t/t3454-history-drop.sh | 537 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 761 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-history.adoc b/Documentation/git-history.adoc
index 2ba8121795..28b477cd37 100644
--- a/Documentation/git-history.adoc
+++ b/Documentation/git-history.adoc
@@ -8,6 +8,7 @@ git-history - EXPERIMENTAL: Rewrite history
SYNOPSIS
--------
[synopsis]
+git history drop <commit> [--dry-run] [--update-refs=(branches|head)] [--empty=(drop|keep|abort)]
git history fixup <commit> [--dry-run] [--update-refs=(branches|head)] [--reedit-message] [--empty=(drop|keep|abort)]
git history reword <commit> [--dry-run] [--update-refs=(branches|head)]
git history split <commit> [--dry-run] [--update-refs=(branches|head)] [--] [<pathspec>...]
@@ -51,13 +52,28 @@ be stateful operations. The limitation can be lifted once (if) Git learns about
first-class conflicts.
When using `fixup` with `--empty=drop`, dropping the root commit is not yet
-supported.
+supported. Likewise, `drop` cannot remove the root commit or a merge commit.
COMMANDS
--------
The following commands are available to rewrite history in different ways:
+`drop <commit>`::
+ Remove the specified commit from the history. All descendants of the
+ commit are replayed directly onto its parent.
++
+The root commit cannot be dropped as that may lead to edge cases where refs
+end up with no commits anymore. Merge commits cannot be dropped either; see
+LIMITATIONS.
++
+If `HEAD` points at a commit that is to be rewritten, the index and working
+tree are updated to match the new `HEAD`. The command aborts before any
+references are updated in case local modifications would be overwritten.
++
+If replaying any descendant would result in a conflict, the command aborts
+with an error.
+
`fixup <commit>`::
Apply the currently staged changes to the specified commit. This is
similar in nature to `git commit --fixup=<commit>` followed by `git
@@ -170,6 +186,26 @@ The staged addition of `unrelated.txt` has been incorporated into the `first`
commit. All descendant commits have been replayed on top of the rewritten
history.
+Drop a commit
+~~~~~~~~~~~~~
+
+----------
+$ git log --oneline
+abc1234 (HEAD -> main) third
+def5678 second
+ghi9012 first
+
+$ git history drop 'main^{/second}'
+
+$ git log --oneline
+jkl3456 (HEAD -> main) third
+ghi9012 first
+----------
+
+The `second` commit has been removed from the history, and `third` has been
+replayed directly on top of `first`. All branches that pointed at the dropped
+commit have been moved to its parent.
+
Split a commit
~~~~~~~~~~~~~~
diff --git a/builtin/history.c b/builtin/history.c
index 4fadf38c32..e59f69233b 100644
--- a/builtin/history.c
+++ b/builtin/history.c
@@ -17,13 +17,17 @@
#include "read-cache.h"
#include "refs.h"
#include "replay.h"
+#include "reset.h"
#include "revision.h"
#include "sequencer.h"
#include "strvec.h"
#include "tree.h"
+#include "tree-walk.h"
#include "unpack-trees.h"
#include "wt-status.h"
+#define GIT_HISTORY_DROP_USAGE \
+ N_("git history drop <commit> [--dry-run] [--update-refs=(branches|head)] [--empty=(drop|keep|abort)]")
#define GIT_HISTORY_FIXUP_USAGE \
N_("git history fixup <commit> [--dry-run] [--update-refs=(branches|head)] [--reedit-message] [--empty=(drop|keep|abort)]")
#define GIT_HISTORY_REWORD_USAGE \
@@ -1001,12 +1005,193 @@ static int cmd_history_split(int argc,
return ret;
}
+static int update_worktree(struct repository *repo,
+ const struct commit *old_head,
+ const struct commit *new_head,
+ bool dry_run)
+{
+ struct reset_working_tree_options opts = {
+ .oid_from = &old_head->object.oid,
+ .oid = &new_head->object.oid,
+ };
+ if (dry_run)
+ opts.flags |= RESET_WORKING_TREE_DRY_RUN;
+ return reset_working_tree(repo, &opts);
+}
+
+static int find_head_tree_change(struct repository *repo,
+ const struct replay_result *result,
+ struct commit **old_head,
+ struct commit **new_head,
+ bool *changed)
+{
+ const struct replay_ref_update *head_update = NULL;
+ struct commit *old_head_commit, *new_head_commit;
+ struct tree *old_head_tree, *new_head_tree;
+ const char *head_target;
+ int head_flags;
+
+ *changed = false;
+
+ head_target = refs_resolve_ref_unsafe(get_main_ref_store(repo),
+ "HEAD", RESOLVE_REF_NO_RECURSE,
+ NULL, &head_flags);
+ if (!head_target)
+ return error(_("cannot look up HEAD"));
+ if (!(head_flags & REF_ISSYMREF))
+ head_target = "HEAD";
+
+ for (size_t i = 0; i < result->updates_nr; i++) {
+ if (!strcmp(result->updates[i].refname, head_target)) {
+ head_update = &result->updates[i];
+ break;
+ }
+ }
+
+ if (!head_update)
+ return 0;
+
+ old_head_commit = lookup_commit_reference(repo, &head_update->old_oid);
+ new_head_commit = lookup_commit_reference(repo, &head_update->new_oid);
+ if (!old_head_commit || !new_head_commit)
+ return error(_("cannot resolve HEAD commit"));
+
+ old_head_tree = repo_get_commit_tree(repo, old_head_commit);
+ new_head_tree = repo_get_commit_tree(repo, new_head_commit);
+ if (!old_head_tree || !new_head_tree)
+ return error(_("cannot resolve tree for HEAD"));
+
+ if (oideq(&old_head_tree->object.oid, &new_head_tree->object.oid))
+ return 0;
+
+ *old_head = old_head_commit;
+ *new_head = new_head_commit;
+ *changed = true;
+
+ return 0;
+}
+
+static int cmd_history_drop(int argc,
+ const char **argv,
+ const char *prefix,
+ struct repository *repo)
+{
+ const char * const usage[] = {
+ GIT_HISTORY_DROP_USAGE,
+ NULL,
+ };
+ enum replay_empty_commit_action empty = REPLAY_EMPTY_COMMIT_DROP;
+ enum ref_action action = REF_ACTION_DEFAULT;
+ int dry_run = 0;
+ struct option options[] = {
+ OPT_CALLBACK_F(0, "update-refs", &action, "(branches|head)",
+ N_("control which refs should be updated"),
+ PARSE_OPT_NONEG, parse_ref_action),
+ OPT_BOOL('n', "dry-run", &dry_run,
+ N_("perform a dry-run without updating any refs")),
+ OPT_CALLBACK_F(0, "empty", &empty, "(drop|keep|abort)",
+ N_("how to handle descendants that become empty"),
+ PARSE_OPT_NONEG, parse_opt_empty),
+ OPT_END(),
+ };
+ struct strbuf reflog_msg = STRBUF_INIT;
+ struct commit *original, *rewritten;
+ struct rev_info revs = { 0 };
+ struct replay_result result = { 0 };
+ struct commit *old_head, *new_head;
+ bool head_moves = false;
+ int ret;
+
+ argc = parse_options(argc, argv, prefix, options, usage, 0);
+ if (argc != 1) {
+ ret = error(_("command expects a single revision"));
+ goto out;
+ }
+ repo_config(repo, git_default_config, NULL);
+
+ if (action == REF_ACTION_DEFAULT)
+ action = REF_ACTION_BRANCHES;
+
+ original = lookup_commit_reference_by_name(argv[0]);
+ if (!original) {
+ ret = error(_("commit cannot be found: %s"), argv[0]);
+ goto out;
+ }
+
+ if (!original->parents) {
+ ret = error(_("cannot drop root commit %s: "
+ "it has no parent to replay onto"),
+ argv[0]);
+ goto out;
+ } else if (original->parents->next) {
+ ret = error(_("cannot drop merge commit: %s"), argv[0]);
+ goto out;
+ }
+
+ ret = setup_revwalk(repo, action, original, &revs);
+ if (ret)
+ goto out;
+
+ rewritten = original->parents->item;
+
+ ret = compute_pending_ref_updates(&revs, action, original, rewritten,
+ empty, &result);
+ if (ret) {
+ ret = error(_("failed replaying descendants"));
+ goto out;
+ }
+
+ /*
+ * If HEAD will move as a result of the rewrite then we'll have to
+ * merge in the changes into the worktree and index. This merge can of
+ * course conflict, which will cause the whole operation to abort.
+ *
+ * If we had already updated the refs at that point then we'd have an
+ * inconsistent repository state. So we first perform a dry-run merge
+ * here before updating refs.
+ */
+ if (!is_bare_repository()) {
+ ret = find_head_tree_change(repo, &result, &old_head,
+ &new_head, &head_moves);
+ if (ret < 0)
+ goto out;
+
+ if (head_moves && update_worktree(repo, old_head, new_head, true) < 0) {
+ ret = error(_("dropping this commit would "
+ "overwrite local changes; aborting"));
+ goto out;
+ }
+ }
+
+ strbuf_addf(&reflog_msg, "drop: dropping %s", argv[0]);
+ ret = apply_pending_ref_updates(repo, &result, reflog_msg.buf, dry_run);
+ if (ret < 0) {
+ ret = error(_("failed to update references"));
+ goto out;
+ }
+
+ if (!dry_run && head_moves && update_worktree(repo, old_head, new_head, false) < 0) {
+ ret = error(_("could not update working tree to new commit %s"),
+ oid_to_hex(&new_head->object.oid));
+ goto out;
+ }
+
+ ret = 0;
+
+out:
+ replay_result_release(&result);
+ strbuf_release(&reflog_msg);
+ release_revisions(&revs);
+ return ret;
+}
+
int cmd_history(int argc,
const char **argv,
const char *prefix,
struct repository *repo)
{
const char * const usage[] = {
+ GIT_HISTORY_DROP_USAGE,
GIT_HISTORY_FIXUP_USAGE,
GIT_HISTORY_REWORD_USAGE,
GIT_HISTORY_SPLIT_USAGE,
@@ -1014,6 +1199,7 @@ int cmd_history(int argc,
};
parse_opt_subcommand_fn *fn = NULL;
struct option options[] = {
+ OPT_SUBCOMMAND("drop", &fn, cmd_history_drop),
OPT_SUBCOMMAND("fixup", &fn, cmd_history_fixup),
OPT_SUBCOMMAND("reword", &fn, cmd_history_reword),
OPT_SUBCOMMAND("split", &fn, cmd_history_split),
diff --git a/t/meson.build b/t/meson.build
index 2af8d01279..d5e71056b2 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -399,6 +399,7 @@ integration_tests = [
't3451-history-reword.sh',
't3452-history-split.sh',
't3453-history-fixup.sh',
+ 't3454-history-drop.sh',
't3500-cherry.sh',
't3501-revert-cherry-pick.sh',
't3502-cherry-pick-merge.sh',
diff --git a/t/t3454-history-drop.sh b/t/t3454-history-drop.sh
new file mode 100755
index 0000000000..0f33247212
--- /dev/null
+++ b/t/t3454-history-drop.sh
@@ -0,0 +1,537 @@
+#!/bin/sh
+
+test_description='tests for git-history drop subcommand'
+
+. ./test-lib.sh
+. "$TEST_DIRECTORY/lib-log-graph.sh"
+
+expect_graph () {
+ cat >expect &&
+ lib_test_cmp_graph --format=%s "$@"
+}
+
+expect_log () {
+ git log --format="%s" "$@" >actual &&
+ cat >expect &&
+ test_cmp expect actual
+}
+
+test_expect_success 'errors on missing commit argument' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ test_must_fail git history drop 2>err &&
+ test_grep "command expects a single revision" err
+ )
+'
+
+test_expect_success 'errors on too many arguments' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ test_must_fail git history drop HEAD HEAD 2>err &&
+ test_grep "command expects a single revision" err
+ )
+'
+
+test_expect_success 'errors on unknown revision' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ test_must_fail git history drop does-not-exist 2>err &&
+ test_grep "commit cannot be found: does-not-exist" err
+ )
+'
+
+test_expect_success 'errors with invalid --empty= value' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ test_commit second &&
+ test_must_fail git history drop --empty=bogus HEAD 2>err &&
+ test_grep "unrecognized.*--empty.*bogus" err
+ )
+'
+
+test_expect_success 'drops a commit in the middle and replays descendants' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second &&
+ test_commit third &&
+
+ git symbolic-ref HEAD >expect &&
+ git history drop HEAD~ &&
+ git symbolic-ref HEAD >actual &&
+ test_cmp expect actual &&
+
+ expect_log <<-\EOF &&
+ third
+ first
+ EOF
+
+ test_must_fail git show HEAD:second.t &&
+ test_path_is_missing second.t &&
+
+ git reflog >reflog &&
+ test_grep "drop: dropping HEAD~" reflog
+ )
+'
+
+test_expect_success 'drops the HEAD commit' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second &&
+
+ git history drop HEAD &&
+
+ expect_log <<-\EOF
+ first
+ EOF
+ )
+'
+
+test_expect_success 'drops a commit on detached HEAD' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second &&
+ test_commit third &&
+ git checkout --detach HEAD &&
+
+ git history drop HEAD~ &&
+
+ expect_log <<-\EOF
+ third
+ first
+ EOF
+ )
+'
+
+# Note: in this case it would actually be fine to drop the root commit, as we
+# do have a descendant commit, and no reference points to the root commit
+# directly. So this is something that we may relax eventually.
+test_expect_success 'refuses to drop the root commit' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second &&
+
+ test_must_fail git history drop HEAD~ 2>err &&
+ test_grep "cannot drop root commit" err
+ )
+'
+
+# In contrast to the above case, we actually don't want to drop the root commit
+# here as that would cause us to end up with an empty commit graph.
+test_expect_success 'refuses to drop the root commit when branch becomes empty' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+
+ test_must_fail git history drop HEAD 2>err &&
+ test_grep "cannot drop root commit" err
+ )
+'
+
+test_expect_success 'refuses to drop a merge commit' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit base &&
+ git branch branch &&
+ test_commit ours &&
+ git switch branch &&
+ test_commit theirs &&
+ git switch - &&
+ git merge theirs &&
+
+ test_must_fail git history drop HEAD 2>err &&
+ test_grep "cannot drop merge commit" err
+ )
+'
+
+test_expect_success 'refuses when descendants contain a merge commit' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit base &&
+ test_commit middle &&
+ git branch branch &&
+ test_commit ours &&
+ git switch branch &&
+ test_commit theirs &&
+ git switch - &&
+ git merge theirs &&
+
+ test_must_fail git history drop middle 2>err &&
+ test_grep "replaying merge commits is not supported yet" err
+ )
+'
+
+test_expect_success 'works in a bare repository' '
+ test_when_finished "rm -rf repo repo.git" &&
+
+ git init repo &&
+ test_commit -C repo first &&
+ test_commit -C repo second &&
+ test_commit -C repo third &&
+
+ git clone --bare repo repo.git &&
+ (
+ cd repo.git &&
+
+ git history drop HEAD~ &&
+ expect_log <<-\EOF
+ third
+ first
+ EOF
+ )
+'
+
+test_expect_success 'updates branches on other lines of descent' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit base &&
+ test_commit target &&
+ git branch theirs &&
+ test_commit ours &&
+ git switch theirs &&
+ test_commit theirs &&
+
+ expect_graph --branches <<-\EOF &&
+ * theirs
+ | * ours
+ |/
+ * target
+ * base
+ EOF
+
+ git history drop target &&
+
+ expect_graph --branches <<-\EOF
+ * ours
+ | * theirs
+ |/
+ * base
+ EOF
+ )
+'
+
+test_expect_success 'moves branch pointing at dropped commit to its parent' '
+ test_when_finished "rm -rf repo" &&
+ git init repo --initial-branch=main &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second &&
+ git branch points-at-second &&
+ test_commit third &&
+
+ git rev-parse first >expect &&
+ git history drop second &&
+ git rev-parse points-at-second >actual &&
+ test_cmp expect actual &&
+
+ expect_log --format="%s %D" --branches <<-\EOF
+ third HEAD -> main
+ first tag: first, points-at-second
+ EOF
+ )
+'
+
+test_expect_success '--dry-run prints ref updates without modifying repo' '
+ test_when_finished "rm -rf repo" &&
+ git init repo --initial-branch=main &&
+ (
+ cd repo &&
+ test_commit base &&
+ git branch branch &&
+ test_commit middle &&
+ test_commit ours &&
+ git switch branch &&
+ test_commit theirs &&
+
+ git refs list >refs-expect &&
+ git history drop --dry-run main~ >updates &&
+ git refs list >refs-actual &&
+ test_cmp refs-expect refs-actual &&
+ test_grep "update refs/heads/main" updates &&
+
+ git update-ref --stdin <updates &&
+ expect_log main <<-\EOF
+ ours
+ base
+ EOF
+ )
+'
+
+test_expect_success '--dry-run detects conflicts with modified working tree' '
+ test_when_finished "rm -rf repo" &&
+ git init repo --initial-branch=main &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second modify-me &&
+ echo modified >modify-me &&
+
+ git refs list >refs-expect &&
+ git diff >diff-expect &&
+ test_must_fail git history drop --dry-run HEAD 2>err &&
+ test_grep "dropping this commit would overwrite local changes" err &&
+ git diff >diff-actual &&
+ git refs list >refs-actual &&
+
+ test_cmp diff-expect diff-actual &&
+ test_cmp refs-expect refs-actual
+ )
+'
+
+test_expect_success '--update-refs=head updates only HEAD' '
+ test_when_finished "rm -rf repo" &&
+ git init repo --initial-branch=main &&
+ (
+ cd repo &&
+ test_commit base &&
+ test_commit target &&
+ git branch theirs &&
+ test_commit ours &&
+ git switch theirs &&
+ test_commit theirs &&
+
+ # When told to update HEAD only, the command refuses to
+ # rewrite commits that are not an ancestor of HEAD.
+ test_must_fail git history drop --update-refs=head main 2>err &&
+ test_grep "rewritten commit must be an ancestor of HEAD" err &&
+
+ expect_graph --branches <<-\EOF &&
+ * theirs
+ | * ours
+ |/
+ * target
+ * base
+ EOF
+
+ git switch main &&
+ git history drop --update-refs=head target &&
+
+ expect_graph --branches <<-\EOF
+ * ours
+ | * theirs
+ | * target
+ |/
+ * base
+ EOF
+ )
+'
+
+test_expect_success 'conflict with replayed commit aborts cleanly' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit base &&
+ test_commit conflict-a file &&
+ test_commit conflict-b file &&
+
+ git refs list >refs-expect &&
+ test_must_fail git history drop HEAD~ 2>err &&
+ test_grep "failed replaying descendants" err &&
+ git refs list >refs-actual &&
+ test_cmp refs-expect refs-actual
+ )
+'
+
+# Build a history where a descendant of the drop target reverts the change
+# introduced by the drop target. After dropping, the descendant's diff applies
+# against a tree that already lacks the change, so it becomes empty.
+setup_empty_descendant_repo () {
+ git init "$1" &&
+ (
+ cd "$1" &&
+ echo C1 >file &&
+ git add file &&
+ git commit -m "base" &&
+ git tag base &&
+ echo C2 >file &&
+ git add file &&
+ git commit -m "drop-me" &&
+ git tag drop-me &&
+ test_commit middle &&
+ echo C1 >file &&
+ git add file &&
+ git commit -m "revert-drop-me" &&
+ git tag revert-drop-me
+ )
+}
+
+test_expect_success '--empty=drop drops descendants that become empty' '
+ test_when_finished "rm -rf repo" &&
+ setup_empty_descendant_repo repo &&
+ (
+ cd repo &&
+
+ git history drop --empty=drop drop-me &&
+
+ expect_log <<-\EOF
+ middle
+ base
+ EOF
+ )
+'
+
+test_expect_success '--empty=keep keeps descendants that become empty' '
+ test_when_finished "rm -rf repo" &&
+ setup_empty_descendant_repo repo &&
+ (
+ cd repo &&
+
+ git history drop --empty=keep drop-me &&
+
+ expect_log <<-\EOF &&
+ revert-drop-me
+ middle
+ base
+ EOF
+ git diff HEAD~ HEAD >diff &&
+ test_must_be_empty diff
+ )
+'
+
+test_expect_success '--empty=abort errors out when a descendant becomes empty' '
+ test_when_finished "rm -rf repo" &&
+ setup_empty_descendant_repo repo &&
+ (
+ cd repo &&
+
+ test_must_fail git history drop --empty=abort drop-me 2>err &&
+ test_grep "became empty after replay" err
+ )
+'
+
+test_expect_success 'updates index and worktree when HEAD moves' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second &&
+ test_commit third &&
+
+ git history drop second &&
+
+ # Worktree should no longer contain second.t.
+ test_path_is_missing second.t &&
+ test_path_is_file first.t &&
+ test_path_is_file third.t &&
+
+ # Index and worktree should both match the new HEAD.
+ git status --porcelain --untracked-files=no >status &&
+ test_must_be_empty status
+ )
+'
+
+test_expect_success 'updates worktree when dropping HEAD itself' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ test_commit second &&
+
+ git history drop HEAD &&
+
+ test_path_is_missing second.t &&
+ test_path_is_file first.t &&
+
+ git status --porcelain --untracked-files=no >status &&
+ test_must_be_empty status
+ )
+'
+
+test_expect_success 'preserves unrelated unstaged modifications' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ echo first-content >unrelated.txt &&
+ git add unrelated.txt &&
+ git commit -m "add unrelated" &&
+ test_commit second &&
+ test_commit third &&
+
+ echo locally-modified >unrelated.txt &&
+
+ git diff >diff-expect &&
+ git history drop second &&
+ git diff >diff-actual &&
+ test_cmp diff-expect diff-actual &&
+ test_path_is_missing second.t
+ )
+'
+
+test_expect_success 'preserves unrelated staged changes' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit first &&
+ echo first-content >unrelated.txt &&
+ git add unrelated.txt &&
+ git commit -m "add unrelated" &&
+ test_commit second &&
+ test_commit third &&
+
+ echo staged-change >unrelated.txt &&
+ git add unrelated.txt &&
+
+ git diff --cached >diff-expect &&
+ git history drop second &&
+ git diff --cached >diff-actual &&
+ test_cmp diff-expect diff-actual &&
+ test_path_is_missing second.t
+ )
+'
+
+test_expect_success 'aborts when local modifications would be overwritten' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit base &&
+ test_commit conflict &&
+
+ echo local-edit >conflict.t &&
+ git diff >diff-expect &&
+ test_must_fail git history drop HEAD 2>err &&
+ test_grep "would overwrite local changes" err &&
+ git diff >diff-actual &&
+ test_cmp diff-expect diff-actual
+ )
+'
+
+test_done
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
* [PATCH v5 09/10] builtin/history: split handling of ref updates into two phases
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
The function `handle_reference_updates()` is used by git-history(1) to
update all references that refer to commits that have been rewritten. As
such, it performs two steps:
- It gathers the references that need to be updated in the first
place.
- It prepares and commits the reference transaction.
In a subsequent commit we'll want to handle those two steps separately.
Prepare for this by splitting up the function into two.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/history.c | 102 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 64 insertions(+), 38 deletions(-)
diff --git a/builtin/history.c b/builtin/history.c
index 0fc06fb204..4fadf38c32 100644
--- a/builtin/history.c
+++ b/builtin/history.c
@@ -333,21 +333,17 @@ static int handle_ref_update(struct ref_transaction *transaction,
NULL, NULL, 0, reflog_msg, err);
}
-static int handle_reference_updates(struct rev_info *revs,
- enum ref_action action,
- struct commit *original,
- struct commit *rewritten,
- const char *reflog_msg,
- int dry_run,
- enum replay_empty_commit_action empty)
+static int compute_pending_ref_updates(struct rev_info *revs,
+ enum ref_action action,
+ struct commit *original,
+ struct commit *rewritten,
+ enum replay_empty_commit_action empty,
+ struct replay_result *result)
{
const struct name_decoration *decoration;
struct replay_revisions_options opts = {
.empty = empty,
};
- struct replay_result result = { 0 };
- struct ref_transaction *transaction = NULL;
- struct strbuf err = STRBUF_INIT;
char hex[GIT_MAX_HEXSZ + 1];
bool detached_head;
int head_flags = 0;
@@ -359,34 +355,13 @@ static int handle_reference_updates(struct rev_info *revs,
opts.onto = oid_to_hex_r(hex, &rewritten->object.oid);
- ret = replay_revisions(revs, &opts, &result);
+ ret = replay_revisions(revs, &opts, result);
if (ret)
- goto out;
+ return ret;
if (action != REF_ACTION_BRANCHES && action != REF_ACTION_HEAD)
BUG("unsupported ref action %d", action);
- if (!dry_run) {
- transaction = ref_store_transaction_begin(get_main_ref_store(revs->repo), 0, &err);
- if (!transaction) {
- ret = error(_("failed to begin ref transaction: %s"), err.buf);
- goto out;
- }
- }
-
- for (size_t i = 0; i < result.updates_nr; i++) {
- ret = handle_ref_update(transaction,
- result.updates[i].refname,
- &result.updates[i].new_oid,
- &result.updates[i].old_oid,
- reflog_msg, &err);
- if (ret) {
- ret = error(_("failed to update ref '%s': %s"),
- result.updates[i].refname, err.buf);
- goto out;
- }
- }
-
/*
* `replay_revisions()` only updates references that are
* ancestors of `rewritten`, so we need to manually
@@ -414,14 +389,43 @@ static int handle_reference_updates(struct rev_info *revs,
!detached_head)
continue;
+ ALLOC_GROW(result->updates, result->updates_nr + 1, result->updates_alloc);
+ result->updates[result->updates_nr].refname = xstrdup(decoration->name);
+ result->updates[result->updates_nr].old_oid = original->object.oid;
+ result->updates[result->updates_nr].new_oid = rewritten->object.oid;
+ result->updates_nr++;
+ }
+
+ return 0;
+}
+
+static int apply_pending_ref_updates(struct repository *repo,
+ const struct replay_result *result,
+ const char *reflog_msg,
+ int dry_run)
+{
+ struct ref_transaction *transaction = NULL;
+ struct strbuf err = STRBUF_INIT;
+ int ret;
+
+ if (!dry_run) {
+ transaction = ref_store_transaction_begin(get_main_ref_store(repo),
+ 0, &err);
+ if (!transaction) {
+ ret = error(_("failed to begin ref transaction: %s"), err.buf);
+ goto out;
+ }
+ }
+
+ for (size_t i = 0; i < result->updates_nr; i++) {
ret = handle_ref_update(transaction,
- decoration->name,
- &rewritten->object.oid,
- &original->object.oid,
+ result->updates[i].refname,
+ &result->updates[i].new_oid,
+ &result->updates[i].old_oid,
reflog_msg, &err);
if (ret) {
ret = error(_("failed to update ref '%s': %s"),
- decoration->name, err.buf);
+ result->updates[i].refname, err.buf);
goto out;
}
}
@@ -435,11 +439,33 @@ static int handle_reference_updates(struct rev_info *revs,
out:
ref_transaction_free(transaction);
- replay_result_release(&result);
strbuf_release(&err);
return ret;
}
+static int handle_reference_updates(struct rev_info *revs,
+ enum ref_action action,
+ struct commit *original,
+ struct commit *rewritten,
+ const char *reflog_msg,
+ int dry_run,
+ enum replay_empty_commit_action empty)
+{
+ struct replay_result result = { 0 };
+ int ret;
+
+ ret = compute_pending_ref_updates(revs, action, original, rewritten,
+ empty, &result);
+ if (ret)
+ goto out;
+
+ ret = apply_pending_ref_updates(revs->repo, &result, reflog_msg, dry_run);
+
+out:
+ replay_result_release(&result);
+ return ret;
+}
+
static int commit_became_empty(struct repository *repo,
struct commit *original,
struct tree *result)
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
* [PATCH v5 08/10] reset: stop assuming that the caller passes in a clean index
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
In 652bd0211d (rebase: use 'skip_cache_tree_update' option, 2022-11-10),
we updated `reset_working_tree()` to stop updating the index tree cache.
This was done as a performance optimization: the function is only called
by "sequencer.c" and "rebase.c", both of which assume a clean index
before they perform their operation, so we know that the end result will
be a clean index, too. Consequently, we can skip recomputing the cache
as we can instead use `prime_cache_tree()` directly.
In a subsequent commit we're about to add a new caller though where the
assumption doesn't hold anymore: the index may be dirty before calling
`reset_working_tree()`, and consequently we cannot prime the cache with
a given tree anymore as the index and tree will mismatch.
Adapt the logic so that we only skip the cache tree update in case we're
doing a hard reset. While we could introduce logic that only skips the
update in case the incoming index was dirty already, that doesn't really
feel worth it: after all, the mentioned commit says itself that the
performance improvement was negligible anyway.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
reset.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/reset.c b/reset.c
index 955ea4ed5a..5a9ed807d7 100644
--- a/reset.c
+++ b/reset.c
@@ -167,10 +167,11 @@ int reset_working_tree(struct repository *r,
unpack_tree_opts.dry_run = dry_run;
unpack_tree_opts.merge = 1;
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
- unpack_tree_opts.skip_cache_tree_update = 1;
init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL);
- if (reset_hard)
+ if (reset_hard) {
+ unpack_tree_opts.skip_cache_tree_update = 1;
unpack_tree_opts.reset = UNPACK_RESET_PROTECT_UNTRACKED;
+ }
if (!reset_hard && !fill_tree_descriptor(r, &desc[nr++], &head_oid)) {
ret = error(_("failed to find tree of %s"),
@@ -197,7 +198,8 @@ int reset_working_tree(struct repository *r,
goto leave_reset_head;
}
- prime_cache_tree(r, r->index, tree);
+ if (reset_hard)
+ prime_cache_tree(r, r->index, tree);
if (write_locked_index(r->index, &lock, COMMIT_LOCK) < 0) {
ret = error(_("could not write index"));
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
* [PATCH v5 07/10] reset: allow the caller to specify the current HEAD object
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
When calling `reset_working_tree()` we automatically derive the commit
that the callers wants to move from by reading the HEAD commit. Some
callers may already have resolved it, or they may want to move from a
different commit that doesn't match HEAD.
Introduce a new `oid_from` option that lets the caller specify the
commit.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
reset.c | 5 ++++-
reset.h | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/reset.c b/reset.c
index a744b0f0fc..955ea4ed5a 100644
--- a/reset.c
+++ b/reset.c
@@ -122,7 +122,10 @@ int reset_working_tree(struct repository *r,
goto leave_reset_head;
}
- if (!repo_get_oid(r, "HEAD", &head_oid)) {
+ if (opts->oid_from) {
+ oidcpy(&head_oid, opts->oid_from);
+ head = &head_oid;
+ } else if (!repo_get_oid(r, "HEAD", &head_oid)) {
head = &head_oid;
} else if (!oid || !reset_hard) {
ret = error(_("could not determine HEAD revision"));
diff --git a/reset.h b/reset.h
index 38b2891b53..4c992ba671 100644
--- a/reset.h
+++ b/reset.h
@@ -37,6 +37,11 @@ struct reset_working_tree_options {
* The commit to checkout/reset to. Defaults to HEAD.
*/
const struct object_id *oid;
+ /*
+ * The commit to checkout/reset from when doing a two-way merge. This
+ * is used as one of the sides to merge.
+ */
+ const struct object_id *oid_from;
/*
* Optional value to set ORIG_HEAD. Defaults to HEAD.
*/
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
* [PATCH v5 06/10] reset: introduce ability to skip updating HEAD
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
In a subsequent commit we'll introduce a new caller to
`reset_working_tree()` that really only wants to update the index and
working tree, without updating any references. Introduce a new flag that
makes the caller opt in to updating HEAD and adapt all callers to set
that flag.
Note that in a previous iteration we instead introduced a flag that made
callers opt out of updating any references. This was somewhat awkward
though because we already have the `UPDATE_ORIG_HEAD` flag, so the
result was somewhat inconsistent.
Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/rebase.c | 14 ++++++++++----
reset.c | 9 +++++++--
reset.h | 9 ++++++---
sequencer.c | 4 +++-
4 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 06dcbaf5e8..10a306310c 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -607,7 +607,8 @@ static int move_to_original_branch(struct rebase_options *opts)
strbuf_addf(&head_reflog, "%s (finish): returning to %s",
opts->reflog_action, opts->head_name);
ropts.branch = opts->head_name;
- ropts.flags = RESET_WORKING_TREE_REFS_ONLY;
+ ropts.flags = RESET_WORKING_TREE_REFS_ONLY |
+ RESET_WORKING_TREE_UPDATE_HEAD;
ropts.branch_msg = branch_reflog.buf;
ropts.head_msg = head_reflog.buf;
ret = reset_working_tree(the_repository, &ropts);
@@ -693,6 +694,7 @@ static int run_am(struct rebase_options *opts)
ropts.oid = &opts->orig_head->object.oid;
ropts.branch = opts->head_name;
ropts.default_reflog_action = opts->reflog_action;
+ ropts.flags = RESET_WORKING_TREE_UPDATE_HEAD;
reset_working_tree(the_repository, &ropts);
error(_("\ngit encountered an error while preparing the "
"patches to replay\n"
@@ -862,7 +864,8 @@ static int checkout_up_to_date(struct rebase_options *options)
options->reflog_action, options->switch_to);
ropts.oid = &options->orig_head->object.oid;
ropts.branch = options->head_name;
- ropts.flags = RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK;
+ ropts.flags = RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK |
+ RESET_WORKING_TREE_UPDATE_HEAD;
if (!ropts.branch)
ropts.flags |= RESET_WORKING_TREE_DETACH;
ropts.head_msg = buf.buf;
@@ -1384,7 +1387,8 @@ int cmd_rebase(int argc,
rerere_clear(the_repository, &merge_rr);
string_list_clear(&merge_rr, 1);
- ropts.flags = RESET_WORKING_TREE_HARD;
+ ropts.flags = RESET_WORKING_TREE_HARD |
+ RESET_WORKING_TREE_UPDATE_HEAD;
if (reset_working_tree(the_repository, &ropts) < 0)
die(_("could not discard worktree changes"));
remove_branch_state(the_repository, 0);
@@ -1409,7 +1413,8 @@ int cmd_rebase(int argc,
ropts.oid = &options.orig_head->object.oid;
ropts.head_msg = head_msg.buf;
ropts.branch = options.head_name;
- ropts.flags = RESET_WORKING_TREE_HARD;
+ ropts.flags = RESET_WORKING_TREE_HARD |
+ RESET_WORKING_TREE_UPDATE_HEAD;
if (reset_working_tree(the_repository, &ropts) < 0)
die(_("could not move back to %s"),
oid_to_hex(&options.orig_head->object.oid));
@@ -1877,6 +1882,7 @@ int cmd_rebase(int argc,
ropts.oid = &options.onto->object.oid;
ropts.orig_head = &options.orig_head->object.oid;
ropts.flags = RESET_WORKING_TREE_DETACH |
+ RESET_WORKING_TREE_UPDATE_HEAD |
RESET_WORKING_TREE_UPDATE_ORIG_HEAD |
RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK;
ropts.head_msg = msg.buf;
diff --git a/reset.c b/reset.c
index 99f2c1b012..a744b0f0fc 100644
--- a/reset.c
+++ b/reset.c
@@ -92,6 +92,7 @@ int reset_working_tree(struct repository *r,
const char *switch_to_branch = opts->branch;
unsigned reset_hard = opts->flags & RESET_WORKING_TREE_HARD;
unsigned refs_only = opts->flags & RESET_WORKING_TREE_REFS_ONLY;
+ unsigned update_head = opts->flags & RESET_WORKING_TREE_UPDATE_HEAD;
unsigned update_orig_head = opts->flags & RESET_WORKING_TREE_UPDATE_ORIG_HEAD;
unsigned dry_run = opts->flags & RESET_WORKING_TREE_DRY_RUN;
struct object_id *head = NULL, head_oid;
@@ -113,6 +114,9 @@ int reset_working_tree(struct repository *r,
if (opts->branch_msg && !opts->branch)
BUG("branch reflog message given without a branch");
+ if (update_orig_head && !update_head)
+ BUG("cannot update ORIG_HEAD without updating HEAD" );
+
if (!refs_only && !dry_run && repo_hold_locked_index(r, &lock, LOCK_REPORT_ON_ERROR) < 0) {
ret = -1;
goto leave_reset_head;
@@ -129,7 +133,7 @@ int reset_working_tree(struct repository *r,
oid = &head_oid;
if (refs_only) {
- if (!dry_run)
+ if (update_head)
return update_refs(r, opts, oid, head);
return 0;
}
@@ -197,7 +201,8 @@ int reset_working_tree(struct repository *r,
goto leave_reset_head;
}
- if (oid != &head_oid || update_orig_head || switch_to_branch)
+ if (update_head &&
+ (oid != &head_oid || update_orig_head || switch_to_branch))
ret = update_refs(r, opts, oid, head);
leave_reset_head:
diff --git a/reset.h b/reset.h
index 898e4a1e95..38b2891b53 100644
--- a/reset.h
+++ b/reset.h
@@ -19,14 +19,17 @@ enum reset_working_tree_flags {
/* Only update refs, do not touch the worktree */
RESET_WORKING_TREE_REFS_ONLY = (1 << 3),
- /* Update ORIG_HEAD as well as HEAD */
- RESET_WORKING_TREE_UPDATE_ORIG_HEAD = (1 << 4),
+ /* Update HEAD */
+ RESET_WORKING_TREE_UPDATE_HEAD = (1 << 4),
+
+ /* Update ORIG_HEAD */
+ RESET_WORKING_TREE_UPDATE_ORIG_HEAD = (1 << 5),
/*
* Perform a dry-run by performing the operation without updating
* any user-visible state.
*/
- RESET_WORKING_TREE_DRY_RUN = (1 << 5),
+ RESET_WORKING_TREE_DRY_RUN = (1 << 6),
};
struct reset_working_tree_options {
diff --git a/sequencer.c b/sequencer.c
index 4efe831178..e905b1b2d9 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4678,7 +4678,8 @@ static void create_autostash_internal(struct repository *r,
has_uncommitted_changes(r, 1)) {
struct child_process stash = CHILD_PROCESS_INIT;
struct reset_working_tree_options ropts = {
- .flags = RESET_WORKING_TREE_HARD,
+ .flags = RESET_WORKING_TREE_HARD |
+ RESET_WORKING_TREE_UPDATE_HEAD,
};
struct object_id oid;
@@ -4873,6 +4874,7 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts,
.oid = onto,
.orig_head = orig_head,
.flags = RESET_WORKING_TREE_DETACH |
+ RESET_WORKING_TREE_UPDATE_HEAD |
RESET_WORKING_TREE_UPDATE_ORIG_HEAD |
RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK,
.head_msg = reflog_message(opts, "start", "checkout %s",
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
* [PATCH v5 05/10] reset: introduce dry-run mode
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
In a subsequent commit we'll add another caller to `reset_working_tree()`
that wants to perform a dry-run check of whether it would be possible to
update the index and working tree when moving to a new commit. Introduce
a new flag that lets the caller perform this operation.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
reset.c | 44 +++++++++++++++++++++++++++++++++-----------
reset.h | 6 ++++++
2 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/reset.c b/reset.c
index 4ca7f23a25..99f2c1b012 100644
--- a/reset.c
+++ b/reset.c
@@ -93,11 +93,14 @@ int reset_working_tree(struct repository *r,
unsigned reset_hard = opts->flags & RESET_WORKING_TREE_HARD;
unsigned refs_only = opts->flags & RESET_WORKING_TREE_REFS_ONLY;
unsigned update_orig_head = opts->flags & RESET_WORKING_TREE_UPDATE_ORIG_HEAD;
+ unsigned dry_run = opts->flags & RESET_WORKING_TREE_DRY_RUN;
struct object_id *head = NULL, head_oid;
struct tree_desc desc[2] = { { NULL }, { NULL } };
struct lock_file lock = LOCK_INIT;
struct unpack_trees_options unpack_tree_opts = { 0 };
struct tree *tree;
+ struct index_state scratch_index = INDEX_STATE_INIT(r);
+ struct index_state *istate;
const char *action;
int ret = 0, nr = 0;
@@ -110,7 +113,7 @@ int reset_working_tree(struct repository *r,
if (opts->branch_msg && !opts->branch)
BUG("branch reflog message given without a branch");
- if (!refs_only && repo_hold_locked_index(r, &lock, LOCK_REPORT_ON_ERROR) < 0) {
+ if (!refs_only && !dry_run && repo_hold_locked_index(r, &lock, LOCK_REPORT_ON_ERROR) < 0) {
ret = -1;
goto leave_reset_head;
}
@@ -125,16 +128,36 @@ int reset_working_tree(struct repository *r,
if (!oid)
oid = &head_oid;
- if (refs_only)
- return update_refs(r, opts, oid, head);
+ if (refs_only) {
+ if (!dry_run)
+ return update_refs(r, opts, oid, head);
+ return 0;
+ }
+
+ if (dry_run) {
+ if (read_index_from(&scratch_index, r->index_file, r->gitdir) < 0 ||
+ index_state_unmerged_to_stage0(&scratch_index) < 0) {
+ ret = error(_("could not read index"));
+ goto leave_reset_head;
+ }
+
+ istate = &scratch_index;
+ } else {
+ if (repo_read_index_unmerged(r) < 0) {
+ ret = error(_("could not read index"));
+ goto leave_reset_head;
+ }
+ istate = r->index;
+ }
action = reset_hard ? "reset" : "checkout";
setup_unpack_trees_porcelain(&unpack_tree_opts, action);
unpack_tree_opts.head_idx = 1;
- unpack_tree_opts.src_index = r->index;
- unpack_tree_opts.dst_index = r->index;
+ unpack_tree_opts.src_index = istate;
+ unpack_tree_opts.dst_index = istate;
unpack_tree_opts.fn = reset_hard ? oneway_merge : twoway_merge;
- unpack_tree_opts.update = 1;
+ unpack_tree_opts.update = !dry_run;
+ unpack_tree_opts.dry_run = dry_run;
unpack_tree_opts.merge = 1;
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
unpack_tree_opts.skip_cache_tree_update = 1;
@@ -142,11 +165,6 @@ int reset_working_tree(struct repository *r,
if (reset_hard)
unpack_tree_opts.reset = UNPACK_RESET_PROTECT_UNTRACKED;
- if (repo_read_index_unmerged(r) < 0) {
- ret = error(_("could not read index"));
- goto leave_reset_head;
- }
-
if (!reset_hard && !fill_tree_descriptor(r, &desc[nr++], &head_oid)) {
ret = error(_("failed to find tree of %s"),
oid_to_hex(&head_oid));
@@ -163,6 +181,9 @@ int reset_working_tree(struct repository *r,
goto leave_reset_head;
}
+ if (dry_run)
+ goto leave_reset_head;
+
tree = repo_parse_tree_indirect(r, oid);
if (!tree) {
ret = error(_("unable to read tree (%s)"), oid_to_hex(oid));
@@ -182,6 +203,7 @@ int reset_working_tree(struct repository *r,
leave_reset_head:
rollback_lock_file(&lock);
clear_unpack_trees_porcelain(&unpack_tree_opts);
+ release_index(&scratch_index);
while (nr)
free((void *)desc[--nr].buffer);
return ret;
diff --git a/reset.h b/reset.h
index 2e5826de99..898e4a1e95 100644
--- a/reset.h
+++ b/reset.h
@@ -21,6 +21,12 @@ enum reset_working_tree_flags {
/* Update ORIG_HEAD as well as HEAD */
RESET_WORKING_TREE_UPDATE_ORIG_HEAD = (1 << 4),
+
+ /*
+ * Perform a dry-run by performing the operation without updating
+ * any user-visible state.
+ */
+ RESET_WORKING_TREE_DRY_RUN = (1 << 5),
};
struct reset_working_tree_options {
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
* [PATCH v5 04/10] reset: modernize flags passed to `reset_working_tree()`
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
The flags passed to `reset_working_tree()` are declared as defines. This
has fallen a bit out of practice nowadays, where we instead prefer to
use enums. Furthermore, the prefix of those flags does not match the
function name anymore after the rename in the preceding commit.
Adapt the code to follow modern best practices and adapt the flag names.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
builtin/rebase.c | 15 ++++++++-------
reset.c | 12 ++++++------
reset.h | 31 +++++++++++++++++++------------
sequencer.c | 9 ++++++---
4 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 22fbba3c62..06dcbaf5e8 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -607,7 +607,7 @@ static int move_to_original_branch(struct rebase_options *opts)
strbuf_addf(&head_reflog, "%s (finish): returning to %s",
opts->reflog_action, opts->head_name);
ropts.branch = opts->head_name;
- ropts.flags = RESET_HEAD_REFS_ONLY;
+ ropts.flags = RESET_WORKING_TREE_REFS_ONLY;
ropts.branch_msg = branch_reflog.buf;
ropts.head_msg = head_reflog.buf;
ret = reset_working_tree(the_repository, &ropts);
@@ -862,9 +862,9 @@ static int checkout_up_to_date(struct rebase_options *options)
options->reflog_action, options->switch_to);
ropts.oid = &options->orig_head->object.oid;
ropts.branch = options->head_name;
- ropts.flags = RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
+ ropts.flags = RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK;
if (!ropts.branch)
- ropts.flags |= RESET_HEAD_DETACH;
+ ropts.flags |= RESET_WORKING_TREE_DETACH;
ropts.head_msg = buf.buf;
if (reset_working_tree(the_repository, &ropts) < 0)
ret = error(_("could not switch to %s"), options->switch_to);
@@ -1384,7 +1384,7 @@ int cmd_rebase(int argc,
rerere_clear(the_repository, &merge_rr);
string_list_clear(&merge_rr, 1);
- ropts.flags = RESET_HEAD_HARD;
+ ropts.flags = RESET_WORKING_TREE_HARD;
if (reset_working_tree(the_repository, &ropts) < 0)
die(_("could not discard worktree changes"));
remove_branch_state(the_repository, 0);
@@ -1409,7 +1409,7 @@ int cmd_rebase(int argc,
ropts.oid = &options.orig_head->object.oid;
ropts.head_msg = head_msg.buf;
ropts.branch = options.head_name;
- ropts.flags = RESET_HEAD_HARD;
+ ropts.flags = RESET_WORKING_TREE_HARD;
if (reset_working_tree(the_repository, &ropts) < 0)
die(_("could not move back to %s"),
oid_to_hex(&options.orig_head->object.oid));
@@ -1876,8 +1876,9 @@ int cmd_rebase(int argc,
options.reflog_action, options.onto_name);
ropts.oid = &options.onto->object.oid;
ropts.orig_head = &options.orig_head->object.oid;
- ropts.flags = RESET_HEAD_DETACH | RESET_ORIG_HEAD |
- RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
+ ropts.flags = RESET_WORKING_TREE_DETACH |
+ RESET_WORKING_TREE_UPDATE_ORIG_HEAD |
+ RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK;
ropts.head_msg = msg.buf;
ropts.default_reflog_action = options.reflog_action;
if (reset_working_tree(the_repository, &ropts)) {
diff --git a/reset.c b/reset.c
index 799596398b..4ca7f23a25 100644
--- a/reset.c
+++ b/reset.c
@@ -16,9 +16,9 @@ static int update_refs(struct repository *repo,
const struct object_id *oid,
const struct object_id *head)
{
- unsigned detach_head = opts->flags & RESET_HEAD_DETACH;
- unsigned run_hook = opts->flags & RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
- unsigned update_orig_head = opts->flags & RESET_ORIG_HEAD;
+ unsigned detach_head = opts->flags & RESET_WORKING_TREE_DETACH;
+ unsigned run_hook = opts->flags & RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK;
+ unsigned update_orig_head = opts->flags & RESET_WORKING_TREE_UPDATE_ORIG_HEAD;
const struct object_id *orig_head = opts->orig_head;
const char *switch_to_branch = opts->branch;
const char *reflog_branch = opts->branch_msg;
@@ -90,9 +90,9 @@ int reset_working_tree(struct repository *r,
{
const struct object_id *oid = opts->oid;
const char *switch_to_branch = opts->branch;
- unsigned reset_hard = opts->flags & RESET_HEAD_HARD;
- unsigned refs_only = opts->flags & RESET_HEAD_REFS_ONLY;
- unsigned update_orig_head = opts->flags & RESET_ORIG_HEAD;
+ unsigned reset_hard = opts->flags & RESET_WORKING_TREE_HARD;
+ unsigned refs_only = opts->flags & RESET_WORKING_TREE_REFS_ONLY;
+ unsigned update_orig_head = opts->flags & RESET_WORKING_TREE_UPDATE_ORIG_HEAD;
struct object_id *head = NULL, head_oid;
struct tree_desc desc[2] = { { NULL }, { NULL } };
struct lock_file lock = LOCK_INIT;
diff --git a/reset.h b/reset.h
index f130152014..2e5826de99 100644
--- a/reset.h
+++ b/reset.h
@@ -6,16 +6,22 @@
#define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
-/* Request a detached checkout */
-#define RESET_HEAD_DETACH (1<<0)
-/* Request a reset rather than a checkout */
-#define RESET_HEAD_HARD (1<<1)
-/* Run the post-checkout hook */
-#define RESET_HEAD_RUN_POST_CHECKOUT_HOOK (1<<2)
-/* Only update refs, do not touch the worktree */
-#define RESET_HEAD_REFS_ONLY (1<<3)
-/* Update ORIG_HEAD as well as HEAD */
-#define RESET_ORIG_HEAD (1<<4)
+enum reset_working_tree_flags {
+ /* Request a detached checkout */
+ RESET_WORKING_TREE_DETACH = (1 << 0),
+
+ /* Request a reset rather than a checkout */
+ RESET_WORKING_TREE_HARD = (1 << 1),
+
+ /* Run the post-checkout hook */
+ RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK = (1 << 2),
+
+ /* Only update refs, do not touch the worktree */
+ RESET_WORKING_TREE_REFS_ONLY = (1 << 3),
+
+ /* Update ORIG_HEAD as well as HEAD */
+ RESET_WORKING_TREE_UPDATE_ORIG_HEAD = (1 << 4),
+};
struct reset_working_tree_options {
/*
@@ -33,7 +39,7 @@ struct reset_working_tree_options {
/*
* Flags defined above.
*/
- unsigned flags;
+ enum reset_working_tree_flags flags;
/*
* Optional reflog message for branch, defaults to head_msg.
*/
@@ -45,7 +51,8 @@ struct reset_working_tree_options {
const char *head_msg;
/*
* Optional reflog message for ORIG_HEAD, if this omitted and flags
- * contains RESET_ORIG_HEAD then default_reflog_action must be given.
+ * contains RESET_WORKING_TREE_UPDATE_ORIG_HEAD then
+ * default_reflog_action must be given.
*/
const char *orig_head_msg;
/*
diff --git a/sequencer.c b/sequencer.c
index d73ecf0384..4efe831178 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4677,7 +4677,9 @@ static void create_autostash_internal(struct repository *r,
if (has_unstaged_changes(r, 1) ||
has_uncommitted_changes(r, 1)) {
struct child_process stash = CHILD_PROCESS_INIT;
- struct reset_working_tree_options ropts = { .flags = RESET_HEAD_HARD };
+ struct reset_working_tree_options ropts = {
+ .flags = RESET_WORKING_TREE_HARD,
+ };
struct object_id oid;
strvec_pushl(&stash.args,
@@ -4870,8 +4872,9 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts,
struct reset_working_tree_options ropts = {
.oid = onto,
.orig_head = orig_head,
- .flags = RESET_HEAD_DETACH | RESET_ORIG_HEAD |
- RESET_HEAD_RUN_POST_CHECKOUT_HOOK,
+ .flags = RESET_WORKING_TREE_DETACH |
+ RESET_WORKING_TREE_UPDATE_ORIG_HEAD |
+ RESET_WORKING_TREE_RUN_POST_CHECKOUT_HOOK,
.head_msg = reflog_message(opts, "start", "checkout %s",
onto_name),
.default_reflog_action = sequencer_reflog_action(opts)
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
* [PATCH v5 03/10] reset: rename `reset_head()`
From: Patrick Steinhardt @ 2026-06-11 13:27 UTC (permalink / raw)
To: git; +Cc: Pablo Sabater, Junio C Hamano, Kristoffer Haugsbakk, Phillip Wood
In-Reply-To: <20260611-b4-pks-history-drop-v5-0-34d35725559c@pks.im>
In a subsequent commit we're about to adapt `reset_head()` so that the
reference update to HEAD is optional, only. At this point the function
starts to feel misnamed, as it doesn't necessarily have anything to do
with the HEAD reference anymore. The gist of the function then is that
we reset the working tree to a specific new commit, updating both the
index and the checked-out files.
Rename it to `reset_working_tree()` to better reflect that.
Note that we don't adjust the flags yet. This will happen in a
subsequent commit.
Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
---
builtin/rebase.c | 20 ++++++++++----------
reset.c | 5 +++--
reset.h | 4 ++--
sequencer.c | 8 ++++----
4 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index fa4f5d9306..22fbba3c62 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -592,7 +592,7 @@ static int finish_rebase(struct rebase_options *opts)
static int move_to_original_branch(struct rebase_options *opts)
{
struct strbuf branch_reflog = STRBUF_INIT, head_reflog = STRBUF_INIT;
- struct reset_head_opts ropts = { 0 };
+ struct reset_working_tree_options ropts = { 0 };
int ret;
if (!opts->head_name)
@@ -610,7 +610,7 @@ static int move_to_original_branch(struct rebase_options *opts)
ropts.flags = RESET_HEAD_REFS_ONLY;
ropts.branch_msg = branch_reflog.buf;
ropts.head_msg = head_reflog.buf;
- ret = reset_head(the_repository, &ropts);
+ ret = reset_working_tree(the_repository, &ropts);
strbuf_release(&branch_reflog);
strbuf_release(&head_reflog);
@@ -685,7 +685,7 @@ static int run_am(struct rebase_options *opts)
status = run_command(&format_patch);
if (status) {
- struct reset_head_opts ropts = { 0 };
+ struct reset_working_tree_options ropts = { 0 };
unlink(rebased_patches);
free(rebased_patches);
child_process_clear(&am);
@@ -693,7 +693,7 @@ static int run_am(struct rebase_options *opts)
ropts.oid = &opts->orig_head->object.oid;
ropts.branch = opts->head_name;
ropts.default_reflog_action = opts->reflog_action;
- reset_head(the_repository, &ropts);
+ reset_working_tree(the_repository, &ropts);
error(_("\ngit encountered an error while preparing the "
"patches to replay\n"
"these revisions:\n"
@@ -855,7 +855,7 @@ static int rebase_config(const char *var, const char *value,
static int checkout_up_to_date(struct rebase_options *options)
{
struct strbuf buf = STRBUF_INIT;
- struct reset_head_opts ropts = { 0 };
+ struct reset_working_tree_options ropts = { 0 };
int ret = 0;
strbuf_addf(&buf, "%s: checkout %s",
@@ -866,7 +866,7 @@ static int checkout_up_to_date(struct rebase_options *options)
if (!ropts.branch)
ropts.flags |= RESET_HEAD_DETACH;
ropts.head_msg = buf.buf;
- if (reset_head(the_repository, &ropts) < 0)
+ if (reset_working_tree(the_repository, &ropts) < 0)
ret = error(_("could not switch to %s"), options->switch_to);
strbuf_release(&buf);
@@ -1116,7 +1116,7 @@ int cmd_rebase(int argc,
int reschedule_failed_exec = -1;
int allow_preemptive_ff = 1;
int preserve_merges_selected = 0;
- struct reset_head_opts ropts = { 0 };
+ struct reset_working_tree_options ropts = { 0 };
struct option builtin_rebase_options[] = {
OPT_STRING(0, "onto", &options.onto_name,
N_("revision"),
@@ -1385,7 +1385,7 @@ int cmd_rebase(int argc,
rerere_clear(the_repository, &merge_rr);
string_list_clear(&merge_rr, 1);
ropts.flags = RESET_HEAD_HARD;
- if (reset_head(the_repository, &ropts) < 0)
+ if (reset_working_tree(the_repository, &ropts) < 0)
die(_("could not discard worktree changes"));
remove_branch_state(the_repository, 0);
if (read_basic_state(&options))
@@ -1410,7 +1410,7 @@ int cmd_rebase(int argc,
ropts.head_msg = head_msg.buf;
ropts.branch = options.head_name;
ropts.flags = RESET_HEAD_HARD;
- if (reset_head(the_repository, &ropts) < 0)
+ if (reset_working_tree(the_repository, &ropts) < 0)
die(_("could not move back to %s"),
oid_to_hex(&options.orig_head->object.oid));
strbuf_release(&head_msg);
@@ -1880,7 +1880,7 @@ int cmd_rebase(int argc,
RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
ropts.head_msg = msg.buf;
ropts.default_reflog_action = options.reflog_action;
- if (reset_head(the_repository, &ropts)) {
+ if (reset_working_tree(the_repository, &ropts)) {
ret = error(_("Could not detach HEAD"));
goto cleanup_autostash;
}
diff --git a/reset.c b/reset.c
index 3b3cb74dab..799596398b 100644
--- a/reset.c
+++ b/reset.c
@@ -12,7 +12,7 @@
#include "hook.h"
static int update_refs(struct repository *repo,
- const struct reset_head_opts *opts,
+ const struct reset_working_tree_options *opts,
const struct object_id *oid,
const struct object_id *head)
{
@@ -85,7 +85,8 @@ static int update_refs(struct repository *repo,
return ret;
}
-int reset_head(struct repository *r, const struct reset_head_opts *opts)
+int reset_working_tree(struct repository *r,
+ const struct reset_working_tree_options *opts)
{
const struct object_id *oid = opts->oid;
const char *switch_to_branch = opts->branch;
diff --git a/reset.h b/reset.h
index a28f81829d..f130152014 100644
--- a/reset.h
+++ b/reset.h
@@ -17,7 +17,7 @@
/* Update ORIG_HEAD as well as HEAD */
#define RESET_ORIG_HEAD (1<<4)
-struct reset_head_opts {
+struct reset_working_tree_options {
/*
* The commit to checkout/reset to. Defaults to HEAD.
*/
@@ -55,6 +55,6 @@ struct reset_head_opts {
const char *default_reflog_action;
};
-int reset_head(struct repository *r, const struct reset_head_opts *opts);
+int reset_working_tree(struct repository *r, const struct reset_working_tree_options *opts);
#endif
diff --git a/sequencer.c b/sequencer.c
index 1ee4b2875b..d73ecf0384 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4677,7 +4677,7 @@ static void create_autostash_internal(struct repository *r,
if (has_unstaged_changes(r, 1) ||
has_uncommitted_changes(r, 1)) {
struct child_process stash = CHILD_PROCESS_INIT;
- struct reset_head_opts ropts = { .flags = RESET_HEAD_HARD };
+ struct reset_working_tree_options ropts = { .flags = RESET_HEAD_HARD };
struct object_id oid;
strvec_pushl(&stash.args,
@@ -4707,7 +4707,7 @@ static void create_autostash_internal(struct repository *r,
if (!silent)
printf(_("Created autostash: %s\n"), buf.buf);
- if (reset_head(r, &ropts) < 0)
+ if (reset_working_tree(r, &ropts) < 0)
die(_("could not reset --hard"));
discard_index(r->index);
if (repo_read_index(r) < 0)
@@ -4867,7 +4867,7 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts,
const char *onto_name, const struct object_id *onto,
const struct object_id *orig_head)
{
- struct reset_head_opts ropts = {
+ struct reset_working_tree_options ropts = {
.oid = onto,
.orig_head = orig_head,
.flags = RESET_HEAD_DETACH | RESET_ORIG_HEAD |
@@ -4876,7 +4876,7 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts,
onto_name),
.default_reflog_action = sequencer_reflog_action(opts)
};
- if (reset_head(r, &ropts)) {
+ if (reset_working_tree(r, &ropts)) {
apply_autostash(rebase_path_autostash());
sequencer_remove_state(opts);
return error(_("could not detach HEAD"));
--
2.54.0.1189.g8c84645362.dirty
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox