We have an `extern int read_replace_refs`, but that variable is not used
anymore since d24eda4e03 (repository: create disable_replace_refs(),
2023-06-06). In fact, that variable has been converted into a file-local
variable, and users are expected to call `disable_replace_refs()` now.
Remove the declaration.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Subcommands that we wire up via `OPT_SUBCOMMAND()` are typically called
`cmd_<command>_<subcommand>()`, but we don't follow that pattern in
"builtin/commit-graph.c". Rename the functions.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The internal write_index_as_tree() function has been updated to
take the index lock gently. This allows it to skip the optional
cache-tree write-back when the lock is held by another process,
preventing commands like 'git rebase' from dying due to background
tasks holding the lock.
* sw/cache-tree-ignore-locked-index:
cache-tree: do not die when the index is locked
The '--dry-run' option of 'git repack --drop-filtered' used to
actually rebuild packs and delete redundant ones, which has been
corrected to only list the candidates without making changes.
* ss/repack-drop-filtered-dry-run:
repack: do not rebuild packs on --dry-run
Instead of failing to record conflicts to be resolved immediately,
wait while "rerere gc" is ongoing.
* tb/rerere-wait-for-merge-rr-lock:
rerere: add "gc --skip-locked" for auto maintenance
rerere: wait for MERGE_RR.lock before giving up
The lazy prerequisite set-up script can be fed as a here-doc, just
like test_expect_{success,failure} scripts these days.
* jk/test-lazy-prereq-heredoc:
test-lib: allow lazy prerequisite snippets as here-docs
The object database "files" backend has been optimized to check
packfiles across all alternate object directories before falling
back to checking loose objects, significantly reducing the number of
'stat(3p)' system calls. Additional refactoring drops the generic
'local' flag from the object database source interface in favor of
backend-specific fields, and simplifies the retry loop for missing
objects.
* ps/odb-files-alternates-cleanups:
odb/source: drop `local` flag
odb: don't try re-fetching corrupt objects
odb: remove read loop for found objects
odb/source-files: make the second read an implementation detail
odb/source-files: fix performance when streaming objects with alternates
odb/source-files: fix performance when reading objects with alternates
The conditional configuration inclusion mechanism via 'includeIf'
has been extended to support matching the machine's hostname, and
the system's hostname as seen by Git can now be queried using 'git
var GIT_HOSTNAME'.
* ic/includeif-hostname:
config: learn the "hostname:" includeIf condition
t6500: get hostname from "git var"
var: add GIT_HOSTNAME
The earliest part of 'man git' has been rewritten to explain various
ways to use 'git help' to get help.
* je/doc-promote-git-help:
doc: use `man git` to teach users how to navigate the docs
Various CI jobs have been updated to use modern OS images, drop dead
code, and remove redundant jobs. Support for Python 2 in CI has been
removed, and the linux-TEST-vars job has been renamed to
linux-feature-testbed.
* ps/ci-housekeeping-and-modernizations:
ci: improve reftable test coverage
ci: drop now-dead Python 2 coverage
ci: switch away from EOL'd Ubuntu version in linux-feature-testbed
ci: rename linux-TEST-vars job
ci: switch away from unsupported i386/ubuntu image
ci: drop unused "linux-clang" logic
ci: fix "fedora-breaking-changes-meson" job
t5004: fix test creating an archive with large objects under SHA256
The branch decoration logic in the sequencer has been updated to use
an allocated buffer for the HEAD reference name, preventing it from
being clobbered when evaluating branches checked out in other
worktrees.
* ak/sequencer-head-refdup:
sequencer: don't clobber HEAD ref name in worktree lookup
The 'from' command in 'git fast-import' has been updated to
correctly resolve references to newly created commits and tags by
checking the internal object table, preventing a crash when the
objects are not yet available in the object database.
* mb/fast-import-reference-pending:
fast-import: allow 'from' to reference new commits and tags by oid
A boundary check in 'git fsck' against the big file threshold has
been corrected to prevent bogus corruption reports on packed objects
whose sizes exactly match the threshold.
* ps/pack-check-bigfile-threshold:
pack-check: fix bogus corruption report with core.bigFileThreshold
The repository initialization sequence has been refactored to treat
the repository object passed to create_repository() purely as an
out-parameter.
* ps/setup-enforce-repo-passed-to-create-repository-has-no-state:
setup: enforce that passed-in repo does not carry relevant state
repository: adapt `repo_clear()` to fully reset the repository
builtin/clone: don't apply "core.sharedRepository" to leading dirs
builtin/init: move handling of "core.sharedRepository" into "setup.c"
builtin/init: refactor messy creation of leading directories
path: introduce `safe_create_leading_directories_no_share_const()`
path: drop useless `safe_create_leading_directories_1()`
'git blame' and 'git annotate' have been updated to automatically
use the '.git-blame-ignore-revs' file from the working tree (or
'HEAD:.git-blame-ignore-revs' in bare repositories) as the default
ignore list if it exists, and the parser has been hardened.
* rm/blame-default-ignore-revs:
blame: ignore revs in .git-blame-ignore-revs by default
blame: harden ignore-revs parser and tag peeling
The progress message emitted by the 'delta-islands' subsystem has
been updated to use the Q_() macro, allowing translators to properly
handle plural forms based on the number of islands marked.
* oa/delta-islands-i18n-use-q:
delta-islands: use Q_() for island count
The git history command and its subcommands have been updated to
honor the commit.gpgSign configuration variable and accept the
--gpg-sign and --no-gpg-sign command-line options, ensuring both
rewritten commits and their replayed descendants are
cryptographically signed by the committer.
* ss/history-sign-rewrites:
history: sign rewritten commits
replay: allow callers to sign commits
CI on GitHub Actions gets a better annotation experience. Leak test
scripts are stopped at their first failure with --immediate to
prevent flooding the log, and failures are correctly annotated with
their file and line number.
* hn/ci-leak-sanitizer-annotations:
ci: point test failures and fixed known breakages at their file and line
ci: annotate leaks and stop a leak-sanitizer script at its first failure
When recreating a merge conflict using 'git checkout -m', the
original conflict labels (such as branch names) were lost and
replaced with generic ones. The merge machinery has been updated to
record the original labels in '.git/MERGE_LABELS', allowing 'git
checkout -m' to restore them.
* pw/checkout-m-conflict-labels:
merge: remember conflict labels
checkout -m <path>: cache merge settings
remove_branch_state: convert boolean argument to flags
Unicode character width table has been updated to match
Unicode 18 announced on 2026-09-16.
* bb/unicode-width-table-18:
unicode: update the width tables to Unicode 18
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: don't disable lazy fetching 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()
The test for verifying a signed tag with a missing key has been
updated to point GNUPGHOME to an unused directory rather than
deleting the active gpghome directory, working around a flaky rm
failure caused by the background gpg-agent observed on Alpine.
* hn/t7004-flaky-gpg-test-fix:
t7004: check a missing key without deleting gpghome
"git status" now suggests to use 'git merge --continue', not 'git commit',
when done with conflicts during a 'git merge'.
* je/status-merge-specific-help:
status: suggest `git merge --continue`, not `git commit`
The odb_source API has been refactored to make alternates an
implementation detail of the files backend instead of managing them
at the core object database layer.
* ps/odb-files-alternates:
odb/source: drop `read_alternates` callback
odb/source-files: move alternates into the backend
odb/source-files: extract reading alternates
odb/source: make `will_destroy` an implementation detail
tmp-objdir: replace primary source at creation time
tmp-objdir: manage quarantine as an object directory
tmp-objdir: absorb logic to set and restore primary sources
odb/source-files: add the ability to have multiple object dirs
odb: refactor `odb_find_source()` to yield dirs
odb: refactor `odb_for_each_alternate()` to yield dirs
odb/source-files: introduce `struct odb_files_dir`
commit-graph: stop depending on `struct odb_source`
commit-graph: require resolved packfile paths for `stdin_packs`
The fetch.writeCommitGraph behavior has been optimized to
incrementally update the commit graph using only the newly fetched
commits as seeds. This avoids a full reachability scan of all
references and drastically reduces the post-fetch commit-graph
update time for repositories with many references.
* kk/fetch-write-commit-graph-incremental:
fetch: write commit-graph using updated refs only
test-tool read-graph: add commit-info subcommand
The routine that rewrites the packed-refs file has been optimized to
directly pass unmodified reference records verbatim to the output
via fwrite(3p), instead of redundantly re-formatting them with
fprintf(3p).
* kn/packed-refs-verbatim-write:
packed-refs: use `fwrite()` when passing refs verbatim
Validation of the 'fetch.followRemoteHEAD' configuration variable
has been deferred to when it is actually used, preventing irrelevant
warnings during 'git fetch' invocations that do not consult it.
* ch/fetch-followremotehead-lazy-validation:
fetch.c: defer fetch.followRemoteHEAD validation
Closing a packfile did not evict the entries belonging to it from
the delta base cache, which could lead to data corruption when a
newly allocated packfile happened to reuse the same memory address.
The cache eviction logic has been updated to remove these stale
entries upon closing a pack
* ps/packfile-stale-delta-base-cache-fix:
packfile: fix corruption due to stale delta base cache entries
packfile: move around `close_pack()`
Rewrite `man git` to give a more realistic view of what the
documentation actually provides.
Explain how Git's help system works in `man git`
(`git push -h` gives a short help, `git push --help` is the full docs),
since it's a slightly unusual approach.
Remove the direct references to all the guides, for the following
reasons:
* gittutorial and giteveryday are unlikely to help new users learn
Git. Currently they feel very aspirational (it would be nice to have
a tutorial and a guide to everyday Git commands!), but we should give
users a realistic view of what the documentation actually provides.
The goal is to mention the tutorial again when when we have a tutorial
we're happy with.
* gitcli is not very useful for users. A lot of it is about scripting
and internal details about the option parser.
* the user manual is outdated. The chapter on "Sharing development with
others" explains how to use `git format-patch` which is not how most
Git users collaborate with git.
* mentioning the data model feels out of place once everything else is
removed
Mention `git help` instead of `giteveryday` for now, which does a better
job of giving an overview of everyday commands.
Mention `git help --guides` and `git help --user-interfaces`,
since there are some important guides in there (like `submodules`) that
are hard to discover.
Do not mention `git help --developer-interfaces` since it's not relevant
to users.
Remove https://git.github.io/htmldocs/git.html since it points to the
`master` version of the documentation. https://git-scm.com/ has the
version from the latest release which is more likely to be useful.
Signed-off-by: Julia Evans <julia@jvns.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
"git repack --drop-filtered --dry-run" is documented to list the
objects that would be dropped "without rebuilding any pack or
deleting anything", but it does both.
This is a bug in cmd_repack(): after printing the candidates, the
--dry-run block falls through into the regular repack code.
repack_promisor_objects() writes a new promisor pack, and with -d,
existing_packs_remove_redundant() deletes the old packs.
The existing guard only skips the implied "delete_redundant = 1", so
it does not stop an explicit -d, and it does not stop the new pack
from being written either.
This has been broken since --dry-run was introduced in 1e746b00aa
(builtin/repack: add --drop-filtered and --dry-run options). The
--dry-run block never returned early, so a dry run has always gone
on to do a regular repack. It was not broken by a later change.
Fix it by returning right after the candidates are listed, and add a
test that checks the pack directory is unchanged with and without -d.
A dry run can no longer get past that point, so the two "!dry_run"
checks that tried to keep it from deleting or dropping anything are
now redundant.
Reported-by: Coy Geek <coygeek@gmail.com>
Helped-by: D. Ben Knoble <ben.knoble@gmail.com>
Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When a background process such as `git status` holds `index.lock` while
`git rebase` picks a commit, the rebase can die in the middle of the
pick and leave the sequencer in a state from which `git rebase
--continue` refuses to run:
error: you have staged changes in your working tree
This happens because `try_to_commit()` calls `write_index_as_tree()`
right after the pick has updated the index and written
`CHERRY_PICK_HEAD`, and `write_index_as_tree()` dies when it cannot
take the index lock. We then die before writing `rebase-merge/message`.
Since 356ee4659b (sequencer: try to commit without forking 'git commit',
2017-11-24), this call happens in-process. Before that commit the
`die()` happened in a `git commit` child process, and the sequencer
stopped cleanly with its state saved.
`write_index_as_tree()` does two different things:
- It turns the index into a tree object. This part must succeed.
- When that succeeds, it also rewrites the index to populate the
cache-tree extension. This part is allowed to fail without
impacting the result; as the comment next to
`write_locked_index()` already notes, failing to write the index
here is fine.
Yet the function locks the index with `LOCK_DIE_ON_ERROR`, even though
we only need the lock for the optional second part.
Drop `LOCK_DIE_ON_ERROR` so that we take the lock gently, just like
other callers that only refresh the index, and skip writing the index
when the lock is held by someone else. This also lets `git write-tree`
and `git am` proceed while another process holds the lock.
Signed-off-by: Szymon Wilczek <swilczek.lx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Replace a link to a site that disappeared with a link to web archive
of the last known good copy.
* dk/fix-shattered-io-link:
doc: fix shattered.io link
A test script (t0450) has been updated to use the test_path_is_file
and test_path_is_missing helper functions, which provides better
diagnostic output on failure.
* ma/t0450-use-test-path-is-file:
t0450: use test_path_is_file and test_path_is_missing
The requirement for a 'SYNOPSIS' section in section 7 manual pages
has been relaxed by updating the linter script, and dummy
'SYNOPSIS' sections from existing section 7 documentation have been
removed to improve the rendered output
* je/doc-section-7-synopsis:
doc: don't require a SYNOPSIS in section 7
The shell quoting of a lazy prereq script was quoted incorrectly and
allowed variables dereferenced at the wrong moment, breaking the
curl version detection.
* jk/t5551-test-shell-quote-fix:
t5551: fix quoting in curl version bug prereq
The documentation for core.pager has been updated to provide
examples of overriding the LESS environment variable for custom
pagers by prefixing the pager command in the configuration.
* tz/doc-override-less-env:
doc: add more examples of overriding LESS in core.pager
The commit map populated from the state branch in 'git
filter-branch' has been corrected to parse the map using the
original-to-rewritten order.
* gm/filter-branch-state-map-fix:
filter-branch: fix commit map init from state branch
Fix definition for the "--all" option to use symbolic constant
in the options[] array passed to parse_options API.
* pw/stash-all-parseopt-fix:
stash: use named constant when parsing "--all"
The 'format-patch' command has been updated with options to
configure notes specifically for range-diff output, allowing them to
differ from the notes displayed on the patches themselves.
* kh/format-patch-range-diff-notes:
format-patch: learn --[no-]range-diff-notes
format-patch: simplify get_notes_arg parameters
The documentation for 'git interpret-trailers' has been updated to
fix the grammatical errors in the descriptions of command examples.
* kh/doc-trailers-cmd-examples:
doc: interpret-trailers: fix cmd examples
The documentation for 'git remote set-head' has been updated to
clarify that it only modifies the local repository's remote-tracking
symbolic reference, and does not alter the target remote
repository's own 'HEAD'.
* mg/doc-remote-set-head:
doc: remote: say that it only affects the local repository
The parse-options API has been updated to support grouping
subcommands, and the 'git refs' command has been updated to use this
new feature to categorize its subcommands in its help output.
* ps/parse-options-subcommand-groups:
builtin/refs: introduce subcommand groups
parse-options: allow grouping subcommands
parse-options: extract functions to print single option
parse-options: fix completion format when first option is skipped
The @{upstream} notation had short-hand @{u} from the beginning,
and @{push} learned corresponding @{p} to match.
* hn/object-name-push-short:
object-name: accept @{p} as short for @{push}