Commit Graph

17638 Commits (next)

Author SHA1 Message Date
Junio C Hamano c6ed9934b7 Sync with 'master' 2026-09-17 09:49:47 -07:00
Junio C Hamano d38352cd43 A few more fixes before -rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-17 09:48:17 -07:00
Junio C Hamano 2a41443dc8 Merge branch 'tz/doc-pack-refs-and-refs-fixes'
Doc updates.

* tz/doc-pack-refs-and-refs-fixes:
  doc/refs: backtick-quote commands and options consistently
  doc/pack-refs: convert synopsis and options to new style
2026-09-17 09:48:17 -07:00
Junio C Hamano 51773c2048 Git 2.56-rc1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4fA2sf7nIh/HeOzvsLXohpav5ssFAmqqvysACgkQsLXohpav
 5suHtg/6A5otSlu+jLcV7UNbKlAGqMxJ5mxGHyLt4fY9O+ba72LYB9upYA6vlgT5
 NapGsAfQutYkBD6AsBGvfdqGQG7FOUq3kW0EdnuPQEkM97eWjyqhf1saahYJ+K21
 jcLhpYxPyg0fLJEwODbbjIuaJLwevQWhaHS7k4DnGSltdNQ5aONex/WuAogQDg8V
 7j8K7HfAc6pZgFrnWXf3vZkXkKJ47vREpZqYCCnh4cjM9HGVNLKxKPjmGGtSjQxx
 324gEqeR/TRgGt71F+JWr82Kk5wvpe456lltely30ZCIsNNXJXi2TDTQycmwfrlN
 FZMyUxmvvT7c0MuFZEjYI3z6auPfGzTgnq7RDALivPYYyIxDNFk1QMueH6YR1iPJ
 KrQlFhNppIzoUgYZTGgeQf4XYlDLZfnmufs2SolHciUHnjA949Lk0k/3vYMC0NMy
 hH+y2xFVh1/2MhVcpcj/UxxBWx6IufKRB1Q5d+fLXdj2Mj4RdBFXBC92k4cx0NaA
 yaqrO9TMxatxSsa52oIlDtgVXMMcpCeO5aGJYq7sdwiPWwB9MfEyJWKfEdVtM+qs
 dPLUl3kiHMRO5aS9+Jl4S0yNjn2bPQLWFL3M5lUmxiXyQ9tRS9wsje6UfhTG61hK
 0bE9prMTALL8wmwPA6yXr95ONMyfzqgqAKNmbNIl/37jWzQibz0=
 =R7f3
 -----END PGP SIGNATURE-----

Sync with Git 2.56-rc1
2026-09-16 09:23:23 -07:00
Junio C Hamano 127f3b13fa Merge branch 'tz/doc-pack-refs-and-refs-fixes' into next
Doc updates.

* tz/doc-pack-refs-and-refs-fixes:
  doc/refs: backtick-quote commands and options consistently
  doc/pack-refs: convert synopsis and options to new style
2026-09-16 09:22:58 -07:00
Junio C Hamano 8937a6240b Merge branch 'ps/ref-storage-format' into next
The terminology regarding reference storage formats has been unified
across command-line options, environment variables, configuration
variables, and source code, standardizing on the phrase "ref storage
format" (e.g., `--ref-storage-format`, `'GIT_REF_STORAGE_FORMAT'`).
Additionally, the `--ref-storage-format` option has been updated to
accept payloads in the form `<format>://<payload>`.

* ps/ref-storage-format:
  setup: allow "--ref-storage-format=" to specify a payload
  setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
  t: rename GIT_TEST_DEFAULT_REF_FORMAT
  setup: rename ref storage format environment variables
  setup: refactor how we configure the ref storage format
  refs: expose function to parse reference URIs
  help: rename "default-ref-format" to "default-ref-storage-format"
  builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"
  builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
  builtin/refs: rename "--ref-format=" to "--ref-storage-format="
  builtin/clone: rename "--ref-format=" to "--ref-storage-format="
  builtin/init: rename "--ref-format=" to "--ref-storage-format="
  parse-options: allow for hidden aliases
2026-09-16 09:22:57 -07:00
Junio C Hamano 12cb6293d6 Git 2.56-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-16 09:07:56 -07:00
Junio C Hamano d1f3524e15 Sync with 'master' 2026-09-15 11:09:36 -07:00
Junio C Hamano 67ef6d82ef Merge branch 'dk/use-nsec-runtime' into next
The build-time knob 'USE_NSEC' for nanosecond stat precision has been
converted to a runtime configuration 'core.useNanosec', allowing
distributions to bundle one binary that adapts to filesystem
capabilities dynamically.

* dk/use-nsec-runtime:
  core: convert build-time USE_NSEC into runtime core.useNanosec
  environment: align repo_config_values_init with struct declaration
  meson: expose knob for xmlto relative links in manuals
2026-09-15 11:09:27 -07:00
Junio C Hamano aa6cbdb87e Merge branch 'kn/receive-report-hook' into next
A new hook 'report' is added to 'git receive-pack', which runs after
reference updates and allows the server to filter or modify the
packet-line status report sent back to the client.

* kn/receive-report-hook:
  receive-pack: coccinelle fix
  hook: introduce the receive-report hook
  receive-pack: move message generation to separate function
  receive-pack: drop static variables to track report status version
  doc: add proc-receive hook info in 'git-receive-pack.adoc'
2026-09-15 11:09:27 -07:00
Junio C Hamano 28dd773b8b Merge branch 'hn/history-squash' into next
The experimental 'git history' command has been taught a new 'squash'
subcommand to fold a range of commits into a single commit, with any
descendants replayed on top.

* hn/history-squash:
  history: support editing squashed commit messages
  history: create squashed commits without editing
  history: protect branches when squashing a range
  history: validate squash revision ranges
  history: add skeleton for squash subcommand
  sequencer: share the squash message marker helpers and flags
  history: give commit_tree_ext a message template
  history: extract helper for a commit's parent tree
2026-09-15 11:09:26 -07:00
Junio C Hamano f0ef1b96a0 4th batch for -rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-15 11:07:37 -07:00
Todd Zullinger 995251109f doc/refs: backtick-quote commands and options consistently
The git-refs doc was converted to the synopsis style in 89be7d2774
(builtin/refs: add '--no-reflog' flag to drop reflogs, 2025-02-21).  The
commands and options were not backtick-quoted at that time.  84f3d6e11e
(doc lint: check that synopsis manpages have synopsis inlines,
2025-08-11) applied backtick-quotes to the existing commands and
options.

Subsequently, a number of commands and options were added without such
quoting, leaving the documentation rendered inconsistently.  Apply
backtick-quotes to all entries.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-15 09:22:16 -07:00
Todd Zullinger db06ca011e doc/pack-refs: convert synopsis and options to new style
Replace [verse] with [synopsis] in the SYNOPSIS block and remove
single-quote formatting from the command name.

Backtick-quote all option terms in the OPTIONS section via the included
pack-refs-options.adoc and convert the standalone placeholder _<branch>_
in prose.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-15 09:22:15 -07:00
Junio C Hamano 339ab2a8f1 3rd batch for -rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-14 14:02:53 -07:00
Junio C Hamano 6c51b4c9ed Merge branch 'sa/rev-list-missing-only'
The git rev-list command has been augmented with a '--missing-only'
option that filters the output to only show missing objects,
stripping the leading '?' character and suppressing present objects,
which is useful when used in combination with '--missing=print' or
'--missing=print-info'.

* sa/rev-list-missing-only:
  rev-list: add --missing-only option to filter output
2026-09-14 14:02:53 -07:00
Junio C Hamano fb03713899 Merge branch 'ps/tune-rerere-gc'
"git maintenance" triggered "rerere gc" in unappropriate times and
interfered with "git rebase" etc. too much.  The conditions "rerere
gc" gets triggered have been tweaked.

* ps/tune-rerere-gc:
  builtin/maintenance: improve heuristic for "rerere gc"
  rerere: extract logic to determine whether entries are stale
2026-09-14 14:02:53 -07:00
Junio C Hamano 35026335e1 Merge branch 'hn/checkout-m-autostash-refine'
The autostash fallback in 'git checkout -m' has been refined to only
retry when there are local changes.  Additionally, a blank line now
visually separates autostash conflict advice from the subsequent
branch-switch message.

* hn/checkout-m-autostash-refine:
  checkout: separate autostash conflict advice from branch-switch message
  stash: reserve exit status 1 for conflicts
2026-09-14 14:02:53 -07:00
Junio C Hamano 88b068eb33 Merge branch 'wf/imap-send-draft'
The 'git imap-send' command has been taught to take the '--draft'
option to mark uploaded messages as drafts, which helps some email
clients render them properly for editing and sending.

* wf/imap-send-draft:
  imap-send: add --draft to set IMAP \Draft flag
2026-09-14 14:02:52 -07:00
Junio C Hamano 3699d22b59 2nd batch for -rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-13 21:53:31 -07:00
Junio C Hamano 584621d0b0 Merge branch 'ta/lint-gitlink-older-perl-fix'
The development helper script to lint gitlink references in the
documentation has been updated to avoid a newer Perl regular
expression syntax that breaks on older Perl versions.

* ta/lint-gitlink-older-perl-fix:
  lint-gitlink: don't use empty lower bound in .{0,8}
2026-09-13 21:53:30 -07:00
Junio C Hamano 994e80a373 Merge branch 'as/cherry-pick-no-commit-doc'
The documentation for 'git cherry-pick' has been updated to clarify
that the '--no-commit' option intentionally skips setting the
'CHERRY_PICK_HEAD' ref.  A test has also been added to ensure this
behavior holds even when the operation stops for conflicts.

* as/cherry-pick-no-commit-doc:
  doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD
  t3507: check no CHERRY_PICK_HEAD after conflicting --no-commit
2026-09-13 21:53:30 -07:00
Junio C Hamano 7c051fe07a Merge branch 'kh/doc-datamodel'
The gitdatamodel documentation page has been linked from a handful
of key documentaiton pages.

* kh/doc-datamodel:
  doc: datamodel: link to the glossary
  doc: glossary: link four of the terms to gitdatamodel(7)
  doc: git: link to the gitdatamodel(7) tutorial
  doc: git: list gitdatamodel(7) as a concept guide
2026-09-13 21:53:30 -07:00
Junio C Hamano cee3798cb4 Merge branch 'bc/maintenance-doc-markup-fix-for-asciidoc'
Mark-up fix for 'git maintenance' documentation pages.

* bc/maintenance-doc-markup-fix-for-asciidoc:
  doc: fix conjoined maintenance strategies in git-config(1)
2026-09-13 21:53:29 -07:00
Karthik Nayak 3bbb0864a2 hook: introduce the receive-report hook
When running 'git-receive-pack(1)', there is no way for the server to
intercept and modify the status report before it is sent back to the
client. Servers with custom logic may need to transform or gate the
report based on the outcome of external logic post reference updates.

This is specially needed for our usecase at GitLab where we have custom
MVCC logic on top of Git which creates a new version for each push
operation. The new version is only committed when certain external
operations post reference transaction succeed. So reporting the correct
message based on the outcome of these operations is important.

The outcome of these operations is only known after `execute_commands()`
has returned and before the report is written. There is no point in
receive-pack where the server can act on that.

We cannot use any of the existing hooks as:

  - The pre-receive hook runs too early, as we haven't updated
    references at that point yet and we need to have the full view of
    all resulting updates (both objects and references).

  - The update hook is too inefficient as it runs once per reference,
    and we cannot trivially determine the last update.

  - The reference-transaction hook is not suited for this. It fires from
    within `ref_transaction_commit()`, which is before the outcome we
    need to report is known, so there is no phase at which it could give
    us the answer. It also does not contain any knowledge regarding the
    push and cannot communicate with the clients.

  - The proc-receive hook replaces execute_commands() for references
    matching 'receive.procReceiveRefs'. We need to gate the report for
    the push as a whole.

  - The post-receive and post-update hooks cannot be used as they run
    too late, at the point where we have already reported success to the
    client.

Introduce a new 'receive-report' hook. The hook receives the complete
pkt-line encoded status report on standard input, after all ref updates
have been applied to the repository by execute_commands() but before the
report is sent to the client. See linkgit:gitprotocol-pack[5] details on
the protocol structure.

The hook's stdout fully replaces the report sent to the client.
receive-pack fully buffers the hook's stdout before acting on the exit
status, so the exit code is known before the client receives anything.
This gives two distinct behaviors depending on exit status:

- Exit 0: the hook's stdout is used as the report. The hook can
  rewrite 'ok' lines to 'ng' lines to signal per-ref rejection to the
  client while receive-pack itself exits cleanly. The client marks
  rejected refs as '[remote rejected]' and exits with a non-zero
  status if any ref is 'ng'.

- Non-zero exit: the hook's stdout is discarded, receive-pack modifies
  all references to be rejected with a 'receive-report hook failed'
  error.

In both cases, any output the hook writes to standard error is
forwarded to the client over the sideband channel and appears as
'remote:' lines on the client terminal. Writing to stderr alone does
not affect the push outcome.

Reference updates applied by execute_commands() are not rolled back in
either failure mode. The hook can cause the client to perceive the push
as failed, but cannot undo server-side changes. This creates a
divergence that the server cannot resolve: the client leaves its
remote-tracking reference at the old value while the update is in fact
applied, and a later fetch may reveal the update that the push reported
as rejected.

The hook is therefore only appropriate for servers which can guarantee
that a rejected update is not observable by any reader. In our case the
transaction committed by execute_commands() produces a candidate version
which is not visible to other readers and is only published once the
subsequent operations succeed, so a report of 'ng' corresponds to a
version that is discarded rather than published. On a repository where a
committed reference update is immediately visible, rejecting a push from
this hook would instead leave the pusher with a view that does not match
the server.

This hook does not use the config-based hook infrastructure, which
supports running multiple scripts per hook event. This hook is a
bidirectional filter: it receives the report on stdin and writes a
modified version to stdout. Running multiple such scripts sequentially
would require piping the output of one into the input of the next,
which the current hook infrastructure does not support. A single-script
design is therefore a natural fit, and is consistent with how
'proc-receive' is structured for the same reason.

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-11 14:28:40 -07:00
Karthik Nayak 87fcb886b4 doc: add proc-receive hook info in 'git-receive-pack.adoc'
The manpage of git-receive-pack(1) documents hooks invoked when
receiving a push. The manpage does not mention the 'proc-receive' hook
though, which is also invoked as part of that process. Add a paragraph
about this hook to plug that gap.

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-11 14:28:39 -07:00
D. Ben Knoble 3a21fe8cf9 core: convert build-time USE_NSEC into runtime core.useNanosec
Racy Git problems persist today, manifesting themselves in the
performance of commands like "git diff" in new worktrees [1]. We have
long had a build knob "USE_NSEC" to tell Git to use in-core nanosecond
precision when available, which mitigates most if not all racy issues,
but most builds we know about don't use it. In part, that's because
someone distributing Git can't safely enable it at compile-time if they
don't know exactly what platforms their distribution will be used on.

[1]: https://lore.kernel.org/git/CALnO6CADMJSixqYvL1Yo8qKX5rWhKQ+2OoSEuPUh-yoeK9TseQ@mail.gmail.com

These days, most platforms are likely to be safe for the USE_NSEC code.
Regardless, we want to give users the ability to benefit from it. This
requires exposing the compile-time gated code as a runtime option.

In addition, update the Racy Git documentation and other mentions of
USE_NSEC in the code.

Due to the conversion from #ifdef to runtime check, using the flag
"--ignore-space-change" may be particularly helpful when viewing changes
from this patch.

Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-11 11:10:01 -07:00
D. Ben Knoble bc53d6c795 meson: expose knob for xmlto relative links in manuals
Makefile-based builds have had this knob for most of the project's life,
since a479a564dc (Documentation/Makefile: allow
man.base.url.for.relative.link to be set from Make, 2009-12-03).

Meson, however, hard-codes the equivalent of $prefix/$mandir, which is
not really where all the HTML docs are stored in most distro builds.
Plus, this value is missing a trailing slash, so links come out broken,
like this in git.1:

        1. Git User’s Manual
           /usr/share/manuser-manual.html

Of course we can do better:

1. Change the default to match Make: use file://$(htmldir)/ (with
   trailing slash!) to form a local URL pointing at the HTML docs. This
   is safe because all current uses of link:<relative> point at HTML
   docs:

      git grep 'link:[[:alnum:]]' Documentation | grep -ve html -e http

   produces only a single result (Documentation/howto/howto-index.sh)
   which can be ignored. Since nothing else [*] in the normal build sets
   MAN_BASE_URL, this seems like the right default.

2. Provide a configurable knob, just like the Makefile, so distributions
   that build with Meson (like Gentoo) can decide where to make the
   links if they need to. Those that set htmldir probably won't need to
   tweak this any further, though.

[*]: Well, Git's todo branch has a script dodoc.sh to build and archive
     docs for kernel.org; these docs are pulled by Homebrew
     installations, for example. It sets MAN_BASE_URL to "git_htmldocs",
     so the equivalent note on macOS + Homebrew is

        1. Git User’s Manual
           git-htmldocs/user-manual.html

     which is not functional either, but that's a problem for
     downstream. In any case, users can recover the right path with
     "git --html-path".

Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-11 11:10:00 -07:00
Junio C Hamano 47ce80527c A bit more for -rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-11 09:45:10 -07:00
Brigham Campbell 609ea2363a doc: fix conjoined maintenance strategies in git-config(1)
Fix conjoined bullet items for the maintenance strategies in
git-config(1). Reportedly, asciidoctor renders this document correctly
both before and after this patch. asciidoc renders it correctly only
_after_ this patch.

Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-10 05:54:32 -07:00
Junio C Hamano fa7f9290ef Git 2.56-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-10 05:36:17 -07:00
Junio C Hamano 6c6104c148 Merge branch 'tc/replay-linearize'
The 'git replay' command has been taught the '--linearize' option to
drop merge commits and linearize the replayed history, mimicking 'git
rebase --no-rebase-merges'.

* tc/replay-linearize:
  replay: offer an option to linearize the commit topology
  replay: resolve the replay base outside pick_regular_commit()
  replay: add helper to put entry into replayed_commits
2026-09-10 05:36:17 -07:00
Patrick Steinhardt dd907a4172 setup: allow "--ref-storage-format=" to specify a payload
Reference storage backends can be configured with a payload via the
"extensions.refStorage" config key and the "GIT_REF_STORAGE_FORMAT"
environment variable, both of which accept a URI in the format
"<format>://<payload>". The payload may contain backend-specific
information, for example an alternate refs directory or which database
references should be stored in.

The `--ref-storage-format=` option of git-init(1) and git-clone(1) does
not know about payloads though: its value is parsed as a plain format
name, so backends that require a payload cannot be conveniently set up
at initialization time via the command line.

Teach the option to accept the same URI syntax. Also, document the
optional payloads for both the "files" and "reftable" backends.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:31 -07:00
Patrick Steinhardt 53d995c53f setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat"
With the same reasoning as for git-init(1), rename the
"init.defaultRefFormat" config option to "init.defaultRefStorageFormat"
and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:31 -07:00
Patrick Steinhardt 768ec52864 setup: rename ref storage format environment variables
With the same reasoning as for git-init(1), rename the environment
variables GIT_REFERENCE_BACKEND and GIT_DEFAULT_REF_FORMAT to
GIT_REF_STORAGE_FORMAT and GIT_DEFAULT_REF_STORAGE_FORMAT, respectively.
The old names are kept as an alias to retain compatibility.

While at it, fix indentation for `GIT_REF_STORAGE_FORMAT` docs to use
tabs instead of spaces.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:31 -07:00
Patrick Steinhardt 4ebec19711 builtin/rev-parse: rename "--show-ref-format" to "--show-ref-storage-format"
With the same reasoning as for git-init(1), rename "--show-ref-format"
to "--show-ref-storage-format" and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:31 -07:00
Patrick Steinhardt da01f4939f builtin/submodule: rename "--ref-format=" to "--ref-storage-format="
With the same reasoning as for git-init(1), rename "--ref-format=" to
"--ref-storage-format=" and keep the old name as an alias.

Note that this commit is a bit more complex compared to the others as we
also need to adapt the submodule helper for consistency. But overall,
the changes are straight-forward and in the same spirit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:30 -07:00
Patrick Steinhardt 82fbd1c537 builtin/refs: rename "--ref-format=" to "--ref-storage-format="
With the same reasoning as for git-init(1), rename "--ref-format=" to
"--ref-storage-format=" and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:30 -07:00
Patrick Steinhardt 9bba3ad909 builtin/clone: rename "--ref-format=" to "--ref-storage-format="
With the same reasoning as for git-init(1), rename "--ref-format=" to
"--ref-storage-format=" and keep the old name as an alias.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:30 -07:00
Patrick Steinhardt 9e7865bd14 builtin/init: rename "--ref-format=" to "--ref-storage-format="
Back when we gained support for reftables we of course introduced the
ability to control the reference storage format that is used by newly
created repositories. This infrastructure has grown over time, and
unfortunately without consistency:

  - The command line parameter to specify the ref storage format is
    called "--ref-format=", while the corresponding repository extension
    is called "refStorage".

  - In most cases we refer to the "ref storage format" in our docs, so
    calling it "--ref-format=" is being inconsistent with them.

  - It is possible to override the ref storage format via an environment
    variable that is called "GIT_REFERENCE_BACKEND", which is not even
    remotely consistent with anything else.

  - There is also an "object format", but that format does not control
    how we store objects but rather whether we use SHA1 or SHA256.

So in summary, it's a huge mess.

This problem is about to become even worse though, as we're soon going
to introduce an object storage extension. This extension is the
equivalent to the ref storage extension, and of course we also want
users to be able to control which object storage format new repositories
are using. But we cannot properly name that parameter without creating
even more inconsistencies:

  - "--object-format=" would match "--ref-format=", but that parameter
    name is already taken to specify the hash function.

  - "--object-storage=" would be a good fit, but be inconsistent with
    "--ref-format=". Asking the user to execute `git init --ref-format=
    --object-storage=` just feels extremely awkward.

Instead, this and subsequent patches will fix the mess by consistently
referring to the ref storage format as such throughout all options,
environment variables and config settings. This new name much more
closely indicates that it is about how we store data and finally brings
consistency into this area. We will keep the old names working of course
for the sake of backwards compatibility.

Start with git-init(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-09 11:04:30 -07:00
Tuomas Ahola 8a631963a9 lint-gitlink: don't use empty lower bound in .{0,8}
The regex quantifier {,n} was added in Perl 5.34.0 as a shorthand
for {0,n}.  That makes it too new an introduction for Git which
targets Perl 5.26.0.

Even though Documentation/lint-gitlink.perl is a development helper
script, let's stick to the general Perl version requirement for
consistency, and use an explicit zero in .{0,8}.

Signed-off-by: Tuomas Ahola <taahol@utu.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-08 15:07:01 -07:00
Harald Nordgren 991dbca43e history: support editing squashed commit messages
Open the editor by default when squashing and provide --no-edit as the
opt-out. Record the exact commits selected by the revision walk,
rearrange that todo list with the sequencer's autosquash machinery, and
build the message template from the resulting order.

Match interactive rebase's treatment of marker messages: comment out
fixup! messages, retain squash! bodies, and let amend! replace its target
unless a preceding squash! requires both bodies. This keeps message
editing aligned with the marker validation used by the no-edit path.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-08 13:51:10 -07:00
Harald Nordgren 8c80498582 history: create squashed commits without editing
Create one replacement commit from the resolved range when --no-edit is
selected. Preserve the authorship and all parents of the oldest commit,
use the tip tree, and replay descendants through the existing history
rewrite machinery. Record the complete revision expression in the
reflog and retain dry-run and update-refs behavior.

Resolve fixup!, squash! and amend! subjects while walking the range.
Reject markers whose targets are not selected and refuse any no-edit
fold that would discard a squash! or amend! message. A range made
entirely from related markers can still be consolidated, with the last
applicable amend! body supplying the message.

Inspired-by: Sergey Chernov <serega.morph@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-08 13:51:10 -07:00
Harald Nordgren 25cfa7c69a history: protect branches when squashing a range
A local branch that descends from the selected graph without containing
its tip cannot be replayed as a descendant of the squashed commit. Find
those branches with ref-filter before creating any replacement objects
and refuse the operation unless --update-refs=head was requested.

Limit this protection to local branches, matching the refs that the
default history rewrite mode updates; tags and remote-tracking refs
remain untouched. Sort the blocking refs and print their short branch
names so the user can decide whether to move them or leave them behind.

Add advice.historyUpdateRefs for the hint that points to
--update-refs=head.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-08 13:51:10 -07:00
Harald Nordgren 6fd039c984 history: add skeleton for squash subcommand
Add the entry point and option parsing for "git history squash". Pass
the remaining arguments through setup_revisions() so the command accepts
revision ranges and rev-list options, while restoring the ordering and
simplification settings required by the fold if an option changes them.

Require at least one BOTTOM revision. The squashed commit needs a commit
outside the selected range to serve as its base, so a single positive
revision is not a sufficient range.

Keep this step limited to defining the revision input contract so graph
validation and the rewrite can be added independently.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-08 13:51:10 -07:00
Junio C Hamano b8242b093d The 23rd batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-07 09:32:06 -07:00
Junio C Hamano bf7d128b47 Merge branch 'yn/worktree-ambiguous-remote-advice'
'git checkout' and 'git worktree add' makes guesses based on a name
of a remote-tracking branch, but does not give an error when such a
remote-tracking branch cannot be uniquely identified, which has
been corrected.

* yn/worktree-ambiguous-remote-advice:
  worktree add: treat multiple matches with --guess-remote as an error
  worktree add: improve message for ambiguous remote branch name
  checkout: improve message for ambiguous remote branch name
  checkout: extract function to display advice for ambiguous remotes
2026-09-07 09:32:05 -07:00
Aleksei Sviridkin 81c1e0b397 doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD
The list of what happens when a change is hard to apply states without
qualification that CHERRY_PICK_HEAD is set.  Under --no-commit it is
not: d7e5c0cbfb (Introduce CHERRY_PICK_HEAD, 2011-02-19) skips the ref
on purpose there, presuming the user intends to further edit the
result and possibly pick more commits on top.

The option's own description says nothing about the ref or about
authorship.  "git commit" reads the author of a cherry-pick from
CHERRY_PICK_HEAD, so without it a plain commit records you as the
author.  Say so where the option is described, and say that this is
the point of the option rather than a wrinkle: what is being built is
the user's own work, not a reproduction of the original commit.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-05 17:46:26 -07:00
Kristoffer Haugsbakk ec602484bd doc: datamodel: link to the glossary
We linked from the glossary to the data model page in the last commit.
It can also be useful to link the other way for readers who might want
to reference more terminology.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-05 17:37:49 -07:00
Kristoffer Haugsbakk 5720c09181 doc: glossary: link four of the terms to gitdatamodel(7)
Four of the terms in the glossary are discussed in gitdatamodel(7).
Let’s link to the data model page from the glossary.

The phrasing needs to be tweaked based on what gitdatamodel(7) offers
for each term compared to the glossary, or even other pages (see the
git-reflog(1) mention). For instance, the ref/reference discussion can
be called a “see also” since the glossary here already goes into
detail. On the other hand, gitdatamodel(7) offers more details on
the subject of “the index”.

Let’s also add gitdatamodel(7) to See Also. It is at least as relevant
as the other tutorial pages that are already mentioned.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-05 17:37:49 -07:00