Commit Graph

17682 Commits (bb703dd851431b537e877638cf371836ea25f7e8)

Author SHA1 Message Date
Junio C Hamano 3aa7239c30 Merge branch 'tb/rerere-wait-for-merge-rr-lock' into seen
Instead of failing to record conflicts to be resolved immediately,
wait while "rerere gc" is ongoing.

* tb/rerere-wait-for-merge-rr-lock:
  rerere: go on at a conflict when the lock stays busy
  rerere: wait for MERGE_RR.lock, and let the gc skip it
2026-09-17 12:54:46 -07:00
Junio C Hamano 746342e7cc Merge branch 'ap/var-broken-down-idents' into seen
The 'git var' command has been extended to expose individual
identity components ('GIT_AUTHOR_NAME', etc.) and the commit
signing key, and can now accept multiple variables to query at
once, safely formatting the output with a new '-z' option.

* ap/var-broken-down-idents:
  var: support broken-down idents, signing key, multiple args, and -z
2026-09-17 12:54:45 -07:00
Junio C Hamano 8e7cd11a48 Merge branch 'tc/push-force-if-includes-fixes' into seen
The --force-if-includes protection for git push has been updated to
consult the reflog of the local branch being pushed, rather than
incorrectly checking the reflog of a local branch that shares the
name of the remote destination branch.  The push advice for detached
HEAD scenarios has also been adjusted to indicate that the remote
ref cannot be verified locally.

* tc/push-force-if-includes-fixes:
  push: --force-if-includes should allow fast-forward
  push: fix --force-if-includes non-branch advice
  push: check pushed ref for --force-if-includes
2026-09-17 12:54:45 -07:00
Junio C Hamano 72f5e12dd6 Merge branch 'mm/diff-process-hunks' into seen
A new 'diff.<driver>.process' configuration has been introduced to
allow a long-running external process to act as a hunk provider,
enabling external tools to control which lines Git considers changed
while leaving all output formatting (word diff, color, blame, etc.) to
Git's standard pipeline.

* mm/diff-process-hunks:
  fixup! diff: consult oid-only hunk providers via diff.<driver>.process
  diff: consult oid-only hunk providers via diff.<driver>.process
  userdiff: add diff.<driver>.process config
  sub-process: add a gentle status read
  sub-process: separate process lifecycle from hashmap management
  blame: read precomputed hunks
  diff: read precomputed hunks for stat output
  diff: record precomputed hunks during stat output
  diff-hunks: add the store format, library, and command
  diff: introduce a hunk provider interface
  gitattributes: document how external diff drivers relate to diff features
2026-09-17 12:54:43 -07:00
Junio C Hamano d208fd9f90 Merge branch 'cc/early-scan-options' into seen
The process of parsing command-line options in commands that
perform an early scan over their arguments (such as 'git bisect',
'git rev-parse', and 'git fast-import') has been unified using a
new early-scan sub-API, which parses and skips known options taking
separate values to prevent logic bugs.

* cc/early-scan-options:
  fast-import: use early_scan_options() for --allow-unsafe-features
  parse-options: build early scan options from a struct option array
  parse-options: add parse_options_takes_argument()
  rev-parse: fix "--" detection when it is an option value
  bisect: fix "--" detection when a term name is "--"
  parse-options: add early_scan_options()
2026-09-17 12:54:42 -07:00
Junio C Hamano c05c97e21a Merge branch 'll/doc-pushcert-if-asked' into seen
The remote helper documentation for the 'pushcert' option has been
updated to mention that it can also take 'if-asked', reflecting the
existing implementation in the code.

* ll/doc-pushcert-if-asked:
  doc: remote-helpers: option pushcert if-asked
2026-09-17 12:54:41 -07:00
Junio C Hamano ca93b10f61 Merge branch 'fz/rebase-autosquash-empty' into seen
A commit that is emptied by melding a 'fixup!' or 'squash!' commit
during 'git rebase --autosquash' is now handled according to the
'--empty' option, allowing it to be dropped, kept, or to halt the
rebase.

* fz/rebase-autosquash-empty:
  sequencer: honor --empty when a fixup!/squash! empties its target
2026-09-17 12:54:40 -07:00
Junio C Hamano 1e3ba8748a Merge branch 'kh/format-rev-more-options' into seen
The experimental 'git format-rev' has been taught a few more
formatting options.

* kh/format-rev-more-options:
  format-rev: learn --abbrev, --color, and --date
  doc: rev-list-options.adoc: factor out --date alts
  format-rev: factor option variables into a struct
  format-rev: place BUG calls first in callback
  format-rev: use lower case for opts description
2026-09-17 12:54:40 -07:00
Junio C Hamano 2c47028e63 Merge branch 'gg/http-ssl-verify-status' into seen
The HTTP transport has been taught to check the revocation status of
the server certificate using the stapled OCSP response during the
TLS handshake via a new 'http.sslVerifyStatus' configuration
variable.

* gg/http-ssl-verify-status:
  http: add http.sslVerifyStatus to check stapled OCSP responses
2026-09-17 12:54:39 -07:00
Junio C Hamano 412eb590dd Merge branch 'cc/lazy-fetch-trusted-bit' into seen
A new 'uploadpack.lazyFetchTrusted' configuration variable has been
introduced to allow 'upload-pack' to lazily fetch missing objects from
configured promisor remotes when serving trusted repositories.

* cc/lazy-fetch-trusted-bit:
  builtin/upload-pack: set GIT_NO_LAZY_FETCH to 0 on trusted repo
  promisor-remote: prevent infinite recursion when lazy fetching
  upload-pack: read uploadpack.lazyFetchTrusted
  setup: extract path_allowlist_apply()
  promisor-remote: factor out lazy_fetch_objects()
2026-09-17 12:54:39 -07:00
Junio C Hamano 3a1877e404 Merge branch 'bc/restrict-hex-to-lowercase' into seen
The parser for hex object names has been updated to reject uppercase
hexadecimal characters when running in the breaking changes mode, in
preparation for Git 3.0.

* bc/restrict-hex-to-lowercase:
  hex: allow only lowercase object IDs in breaking changes mode
  t5324: adjust tests for corrupt commit-graph
  object-name: use hexval
  hex: label usages of hex parsing for object IDs
  hex: make hex_to_bytes accept kind of hex to use
  hex: allow specifying hex type with hex2chr
  hex: add functionality for lowercase-only hex
2026-09-17 12:54:38 -07:00
Junio C Hamano f78b10d9ce Merge branch 'pz/fetch-submodule-errors-config' into seen
The 'git fetch' command can now configure how submodule fetch errors
are handled via 'fetch.submoduleErrors' and '--submodule-errors',
making them non-fatal.  A premature failure during recursive submodule
fetches has been fixed by deferring the error until the OID-based
retry phase fails.

* pz/fetch-submodule-errors-config:
  fetch: add fetch.submoduleErrors to make submodule fetch errors non-fatal
  submodule: fix premature failure in recursive submodule fetch
2026-09-17 12:54:37 -07:00
Junio C Hamano 89e6b54e73 Merge branch 'kj/repo-info-more-path-keys' into seen
The 'git repo info' command has been taught more keys to output
paths of various repository components (such as the working tree
root, superproject working tree, object database, etc.), supporting
both absolute and relative path formats.

* kj/repo-info-more-path-keys:
  repo: add path.cdup
  repo: add path.git-prefix
  repo: add path.grafts with absolute and relative suffixes
  repo: add path.index with absolute and relative suffixes
  repo: add path.hooks with absolute and relative suffixes
  repo: add path.superproject-root with absolute and relative suffixes
  repo: add path.toplevel with absolute and relative suffix formatting
2026-09-17 12:54:37 -07:00
Junio C Hamano 16112e2792 Merge branch 'mm/line-log-limited-ops' into seen
The 'git log -L<range>:<path>' command has been taught to limit
various 'diff' operations, such as '--stat', '--check', and '-G', to
the specified range and path.

* mm/line-log-limited-ops:
  diffcore-pickaxe: limit -G to the -L tracked range
  diff: support --check with -L line ranges
  diff: support stat formats with -L
  diff: extract a line-range diff helper for reuse
  diff: emit -L hunk headers via xdiff's formatter
  diff: simplify the line-range filter by classifying removals immediately
  diff: rename line-range filter struct and clarify fields
2026-09-17 12:54:36 -07:00
Junio C Hamano 3bd6aa7cbd Merge branch 'ec/commit-fixup-options' into seen
Support for '-m', '-F', '-c', or '-C' options to supply a commit log
message from outside the editor has been added for all 'git commit
--fixup' variations.

* ec/commit-fixup-options:
  commit: allow -c/-C for all kinds of --fixup
  commit: allow -m/-F for all kinds of --fixup
2026-09-17 12:54:35 -07:00
Junio C Hamano 9f5e444813 Merge branch 'hn/range-diff-matched-only' into jch
The 'git range-diff' command has been augmented with a
'--matched-only' option to skip commits that are only present on
one side, allowing users to easily focus on only the commits that
have been retained.

* hn/range-diff-matched-only:
  range-diff: add --matched-only to skip one-sided commits
2026-09-17 12:54:19 -07:00
Junio C Hamano 61d2fe47d3 Merge branch 'ta/command-list-guides-sync-lint' into jch
A new linter test has been added to Documentation/lint-manpages.sh
to ensure that all non-command manual pages (guides and developer
interfaces) listed in Documentation/Makefile are present in
command-list.txt, replacing an older comment that reminded
developers to keep them in sync.

* ta/command-list-guides-sync-lint:
  lint-docs: check the guide list in command-list.txt
  command-list.txt: add gitformat-loose(5) and gitpacking(7)
2026-09-17 12:54:18 -07:00
Junio C Hamano 9aba6cbdfa Merge branch 'dk/use-nsec-runtime' into jch
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-17 12:54:16 -07:00
Junio C Hamano fdb8395264 Merge branch 'ps/ref-storage-format' into jch
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-17 12:54:15 -07:00
Junio C Hamano e0cd7bd5b0 Merge branch 'kn/receive-report-hook' into jch
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-17 12:54:14 -07:00
Junio C Hamano ba8defa938 Merge branch 'hn/history-squash' into jch
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-17 12:54:13 -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 12cb6293d6 Git 2.56-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-16 09:07:56 -07:00
Grayson Gordon abb51c0535 http: add http.sslVerifyStatus to check stapled OCSP responses
git never sets CURLOPT_SSL_VERIFYSTATUS, so libcurl never requests the
OCSP "Certificate Status Request" extension and any stapled response a
server sends is ignored, including responses that explicitly state the
certificate has been revoked.

Add an http.sslVerifyStatus boolean that maps to
CURLOPT_SSL_VERIFYSTATUS. http_options() is already the collect_fn for a
urlmatch config, so the per-URL form works with no changes:

    git config http.https://example.com/.sslVerifyStatus true

Defaults to false/"off". This is due to the nature of the OCSP protocol.
If enabled, git would expect to receive OCSP stapled responses. If the
stapled responses were not present, the connection would be blocked as
the status of the server's certificate could not be verified. This would
break connections to legitimate services that don't use OCSP as their
certificate revocation mechanism.

If the backend can't check the staple, curl_easy_setopt() returns
CURLE_NOT_BUILT_IN. The error message includes curl_easy_strerror()
along with the option name, so a libcurl built without status
verification is easy to identify.

CURLOPT_SSL_VERIFYSTATUS has existed since libcurl 7.41.0, below our
7.61.0 floor, so no version guard is needed.

The tests that need no OCSP infrastructure stay in t5551, which t5559
runs over https. The rest need a certificate authority, a responder to
answer for it and a server configured to staple, so lib-httpd gains an
opt-in LIB_HTTPD_OCSP mode and t5585 uses it to check that a "good"
staple is accepted, a "revoked" one is refused, and that the revoked one
is ignored when the option is off.

Signed-off-by: Grayson Gordon <graysongordon1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-16 07:19:16 -07:00
Tyler Cipriani ce389b9556 push: fix --force-if-includes non-branch advice
When a --force-if-includes push is rejected due lacking reflog to
consult, the advice is misleading:

     ! [rejected] HEAD -> main (remote ref updated since checkout)
    error: failed to push some refs to '<remote>'
    hint: Updates were rejected because the tip of the remote-tracking
    hint: branch has been updated since the last checkout. If you want
    hint: to integrate the remote changes, use 'git pull' before
    hint: pushing again. See the 'Note about fast-forwards' in 'git
    hint: push --help' for details.

But a `git pull` will not fix this rejection. What is required is either

- Specify the expected remote tip with --force-with-lease=<ref>:<expect>
- Ignore the error with --no-force-if-includes

Add ref->unverifiable to differentiate pushing something without a
reflog to consult vs. a remote update rejection.

Ensure tests check the rejection message.

Reported-by: D. Ben Knoble <ben.knoble@gmail.com>
Signed-off-by: Tyler Cipriani <tyler@tylercipriani.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-16 07:18:57 -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
Andrew Pleeter c064665dc9 var: support broken-down idents, signing key, multiple args, and -z
While 'git var' exposes GIT_AUTHOR_IDENT and GIT_COMMITTER_IDENT,
extracting individual components (name, email, or date) currently
requires callers to manually parse the composite string. Furthermore,
there is no way to query the resolved commit signing key through
'git var', and the command only accepts a single variable at a time.

Teach 'git var' to expose individual identity components and commit
signing configuration, and allow querying multiple variables with
optional NUL-termination:

- Add GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and GIT_AUTHOR_DATE.
- Add GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, and GIT_COMMITTER_DATE.
- Add GIT_SIGNING_KEY to resolve the key that would be used to sign
  the resulting commit if you were to run 'git commit' right now.
- Allow passing multiple variable arguments (e.g., 'git var
  GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL').
- When a single variable is requested, print its bare value for backward
  compatibility.
- When multiple variables are requested, model the output after
  'git var -l' by printing 'VARIABLE=value' pairs (or 'VARIABLE\nvalue\0'
  when '-z' is given).
- Format multi-valued variables in multi-variable mode as repeated
  'VARIABLE=value' entries (or 'VARIABLE\nvalue\0' with '-z'),
  eliminating stream ambiguity without extra trailing delimiters.
- When querying multiple variables, omit any variable that has no value,
  continue processing remaining variables, and exit with code 1.
- Support '-z' to terminate variable outputs with NUL bytes.
- Format 'git var -l -z' using the same convention as 'git config
  list -z' (newline separating key and value, NUL separating entries).
- Use parse_options() to strictly require options before arguments.
- Update Documentation/git-var.adoc and t/t0007-git-var.sh.

Signed-off-by: Andrew Pleeter <andrewpleeter@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-15 08:48:02 -07:00
Harald Nordgren 6a559670c2 range-diff: add --matched-only to skip one-sided commits
Reviewing a range-diff often means scrolling past commits that were
simply added or dropped, when only the ones that correspond between
the two ranges are of interest.

--left-only and --right-only already each suppress one of those
one-sided groups, but they are defined as "only show this side" and
so cannot be given together, which is exactly why show_range_diff()
already rejected that combination. Give the "show only the commits
that correspond on both sides" behavior its own name, --matched-only,
instead of asking users to reach for a combination that errors out.

Extend the existing '--left-only'/'--right-only' conflict check to
also reject any combination with --matched-only, since all three
narrow the output in ways that cannot be combined.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-15 08:46:28 -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
Thomas Bachem 4ec42e1d80 rerere: go on at a conflict when the lock stays busy
When a merge, rebase, cherry-pick, revert, am, stash or apply stops
at a conflict, it runs rerere right before it returns to the user.
If MERGE_RR.lock is still held when rerere.lockTimeout runs out, the
command dies there. For a rebase that is worse than a lost
recording: the sequencer has not yet written the state that
"git rebase --continue" needs, so the rebase cannot continue, and
following the "git commit --amend" advice folds the conflicted pick
into the previous commit.

So print a warning and go on instead. The conflict is still in
place, and the warning tells the user to run "git rerere" before
resolving it. That records the preimage, or replays a known
resolution, just as the command would have done.

All other callers still fail when the timeout runs out. "git commit"
and "git am --continue" record the resolution and then move on to
the next commit or patch. A warning would come too late there, and
the next rerere run would record whatever the file contains by then.
The "rerere clear" that am and rebase run for --skip and --abort
would leave the same stale entry behind. "git rerere", "git rerere
forget" and "git rerere clear" fail because the user asked for that
state explicitly.

Assisted-by: Claude Fable 5.1
Signed-off-by: Thomas Bachem <mail@thomasbachem.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-14 08:03:41 -07:00
Thomas Bachem 92006c6967 rerere: wait for MERGE_RR.lock, and let the gc skip it
setup_rerere() takes MERGE_RR.lock with LOCK_DIE_ON_ERROR. When two
processes want the lock at the same time, the second one dies. This
was always the case, but since 452b12c2e0 (builtin/maintenance: use
"geometric" strategy by default, 2026-02-24) it is easy to hit: auto
maintenance now runs "git rerere gc" after every commit whenever
rr-cache contains at least one entry, and the gc holds the lock
while it prunes.

A rebase whose next pick conflicts while the gc holds the lock dies
inside repo_rerere(). That runs before the sequencer writes the state
that "git rebase --continue" needs, so every later "git rebase
--continue" fails with "you have staged changes".

Instead of dying right away, wait for the lock for up to
rerere.lockTimeout milliseconds, 1000 by default, and only then fail
as before. The gc itself does not wait: when the lock is held, it
skips this run and leaves the pruning to the next one.

Assisted-by: Claude Fable 5.1
Signed-off-by: Thomas Bachem <mail@thomasbachem.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-14 08:03:41 -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
K Jayatheerth 2b27cabfb9 repo: add path.cdup
Scripts sometimes need the relative path from the current working
directory to the repository's working tree root (cdup). While this
information can be retrieved through `git rev-parse --show-cdup`,
`git repo info` does not currently expose it as a scriptable key.

Introduce the `path.cdup` key to `git repo info`. The key returns the
path from the current working directory to the root of the working tree,
returning the empty string when invoked from the working tree root.

Mentored-by: Justin Tobler <jltobler@gmail.com>
Mentored-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-11 09:16:47 -07:00
K Jayatheerth 88dc4213b5 repo: add path.git-prefix
Scripts sometimes need the path from the repository's working tree root
to the current working directory. While this information can be derived
through existing Git commands, `git repo info` does not currently expose
it as a scriptable key.

Introduce the `path.git-prefix` key to `git repo info`. The key returns
the path from the working tree root to the current working directory,
returning the empty string when invoked from the working tree root.

Mentored-by: Justin Tobler <jltobler@gmail.com>
Mentored-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-09-11 09:16:47 -07:00