Commit Graph
82682 Commits
Author SHA1 Message Date
Junio C Hamano 2ef78ae7ef Merge branch 'dk/stash-completion-updates'
The command-line completion for 'git stash' has been updated to
dynamically discover subcommands and to correct a Zsh-specific
formatting issue where stash references were improperly unquoted.
Additionally, the deprecated 'save' subcommand has been removed from
completions and synopsis documentation.

* dk/stash-completion-updates:
  completion: drop "stash save" completion altogether
  doc: drop usage mentions of "git stash save"
  completion: fix Zsh handling of stash names
  Completion: extract common stash listing code
  completion: simplify stash subcommand completion
2026-11-04 11:04:26 -08:00
Junio C Hamano 750f5de7df The 14th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-11-03 07:32:37 -08:00
Junio C Hamano e1bb515788 Merge branch 'ss/t0081-test-path-is-file'
The test script 't0081-find-pack.sh' has been updated to use the
'test_path_is_file' helper instead of the raw 'test -f' command.

* ss/t0081-test-path-is-file:
  t0081: modernize the code testing whether a file exists
2026-11-03 07:32:37 -08:00
Junio C Hamano 90be13890e Merge branch 'jc/advice-config-set-global'
The advice subsystem has been updated to suggest using the
'--global' option when recommending a command snippet to squelch
future advice messages, since global configuration is generally
more appropriate for user-level preferences than per-repository
settings.

* jc/advice-config-set-global:
  advice: give cut-and-pasteable advice to squelch
2026-11-03 07:32:37 -08:00
Junio C Hamano a70100e9db Merge branch 'jc/myfirstcontribution-discuss-then-reroll'
The documentation on contributing has been updated to emphasize the
importance of discussing review feedback before sending the next
iteration, and the section on sending an updated version has been
moved to appear after the discussion of the review process.

* jc/myfirstcontribution-discuss-then-reroll:
  MyFirstContribution: clarify that "reviewing" is a discussion
  MyFirstContribution: move "how to send v2" after discussing reviews
2026-11-03 07:32:37 -08:00
Junio C Hamano ebdc087dc9 The 13th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-11-01 09:25:24 -08:00
Junio C Hamano b1bf38c452 Merge branch 'ps/rerere-remove-global-state'
The 'rerere' subsystem has been libified to remove its dependency on
the global 'the_repository' state and global tracking variables,
allowing it to operate correctly in multi-repository contexts.

* ps/rerere-remove-global-state:
  rerere: get rid of global rerere cache state
  rerere: bundle global state into a struct
  rerere: stop using `the_repository`
  rerere: cache result of `is_rerere_enabled()`
  rerere: remove redundant calls to `repo_config()`
  rerere: stop using `the_repository` in internal helpers
  rerere: stop using `the_repository` in `rerere_path()`
2026-11-01 09:25:24 -08:00
Junio C Hamano aa139fdc67 Merge branch 'tb/hook-enabled-covers-traditional-hooks'
The hook.<event>.enabled configuration variable has been extended to
also disable traditional hookdir hooks in addition to configured
hooks.  In addition, the hook configuration parser has been updated
to treat missing values for boolean variables like enabled and
parallel as true.

* tb/hook-enabled-covers-traditional-hooks:
  hook: accept .enabled and .parallel given without a value
  hook: make hook.<event>.enabled cover the hookdir hook
2026-11-01 09:25:23 -08:00
Junio C Hamano 73b37f8d8f Merge branch 'ti/checkout-track-failure'
The 'git switch' and 'git checkout' commands have been updated to
complete the branch switch instead of aborting when the tracking
configuration fails to write, matching the behavior of 'git push -u'.

* ti/checkout-track-failure:
  checkout: finish switching when the tracking config cannot be written
  branch: return an error from setup_tracking()
2026-11-01 09:25:23 -08:00
Junio C Hamano d6370f765e Merge branch 'ti/branch-set-upstream-hint-fix'
The hint printed when tracking configuration fails to be written has
been corrected to produce a valid remote-tracking branch name.

* ti/branch-set-upstream-hint-fix:
  branch: strip refs/heads/ from the --set-upstream-to hint
2026-11-01 09:25:23 -08:00
Junio C Hamano a04194e134 Merge branch 'tj/checkout-orphan-more-plural'
The messages 'git checkout' prints to describe orphaned commits and
multiple references have been updated to use the Q_() macro, allowing
translators to use the correct plural forms for numbers greater than
one.

* tj/checkout-orphan-more-plural:
  checkout: use Q_() for messages with counts
2026-11-01 09:25:23 -08:00
Junio C Hamano 96eb94a122 Merge branch 'ag/fsck-connectivity-msg-i18n'
The verbose "Checking connectivity" message in 'git fsck' has been
updated to use the pluralizing translation macro.

* ag/fsck-connectivity-msg-i18n:
  fsck: use Q_() for the verbose connectivity message
2026-11-01 09:25:23 -08:00
Junio C Hamano 22b2310194 Merge branch 'kk/connectivity-check-incremental'
The connectivity check in 'git fetch' and 'git receive-pack' has
been optimized with an alternative incremental mode, available via
'transfer.connectivityCheck=incremental'.  Instead of walking the
full object closure of the boundary commits, it compares the trees
of incoming commits against their trusted parent trees, skipping
unchanged subtrees.

* kk/connectivity-check-incremental:
  connected: add "auto" connectivity check mode
  connected: add incremental connectivity check via rev-list
  connected: add transfer.connectivityCheck config
  connected: drop dependency on `the_repository`
  p5413: add perf tests for connectivity check
  Documentation: describe connectivity checking
2026-11-01 09:25:22 -08:00
Junio C Hamano cc3b09a046 Merge branch 'jt/odb-keep-lockfile-fix'
The creation of '.keep' lockfiles during object database
transactions has been deferred to commit time, explicitly managing
the lockfiles within the files backend rather than relying on
'git-index-pack', to prevent race conditions that could lead to
concurrent lockfiles being erroneously deleted.

* jt/odb-keep-lockfile-fix:
  object-file: write ".keep" lockfiles during transaction commit
  object-file: explicitly write ".keep" lockfile
  pack-write: lift and expose index-pack report parsing
  pack-write: make index-pack output comment hash agnostic
2026-11-01 09:25:22 -08:00
Junio C Hamano 50fe5cc63f The 12th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-30 13:53:20 -07:00
Junio C Hamano 84bea4324a Merge branch 'cu/t2104-avoid-pipes'
A test script ('t2104') has been updated to avoid piping the output of
a 'git' command into another command, which would hide its exit code.

* cu/t2104-avoid-pipes:
  t2104: avoid suppressing git's exit code
2026-10-30 13:53:20 -07:00
Junio C Hamano cb9cccc843 Merge branch 'ak/cargo-pin-target-dir'
The Makefile has been updated to explicitly pass '--target-dir
target' to 'cargo' when building the 'gitcore' library, fixing a
link error that occurs when the user has a custom target directory
configured via 'CARGO_TARGET_DIR' or their Cargo configuration.

* ak/cargo-pin-target-dir:
  Makefile: pin cargo --target-dir to ./target
2026-10-30 13:53:20 -07:00
Junio C Hamano c5eda93f27 Merge branch 'rk/t5301-use-test-path-helpers'
The test in 't5301' has been modernized to use the
'test_path_is_file' helper instead of the raw 'test -f' command.

* rk/t5301-use-test-path-helpers:
  t5301: use test_path_is_file instead of test -f
2026-10-30 13:53:19 -07:00
Junio C Hamano af456b19ba Merge branch 'ak/refs-files-root-refs-cache'
The loose refs cache in the files backend has been updated to avoid
caching root refs (like 'HEAD'), preventing them from being omitted
from subsequent iterators that explicitly request them when a
previous iterator populated the cache without them.

* ak/refs-files-root-refs-cache:
  refs/files: keep root refs out of loose ref cache
2026-10-30 13:53:19 -07:00
Junio C Hamano 7d55df7790 Merge branch 'jc/ci-update-macos-15'
The macOS CI jobs have been updated to use a mixture of 'macos-15' and
'macos-latest' images, as the 'macos-14' hosted runner image is being
deprecated by GitHub.

* jc/ci-update-macos-15:
  github-ci: update macos jobs from macos-14
2026-10-30 13:53:19 -07:00
Junio C Hamano b9e5cff180 The 11th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-29 07:18:00 -07:00
Junio C Hamano dd2e9fb957 Merge branch 'rs/archive-zip-omit-out-of-range-mtime'
The ZIP archive creation code has been updated to omit the 'UT'
extended timestamp extra field when the commit time exceeds the
32-bit positive signed integer limit, avoiding integer wraparound
for dates past the year 2038.

* rs/archive-zip-omit-out-of-range-mtime:
  archive-zip: omit UT extra field if mtime is out of range
2026-10-29 07:18:00 -07:00
Junio C Hamano 21e0d223ed Merge branch 'of/config-buf-fgetc-unsigned'
The internal config file parser has been updated to treat the
content read from a blob as a sequence of unsigned bytes, preventing
bytes with the high bit set from being mistakenly interpreted as
'EOF'.

* of/config-buf-fgetc-unsigned:
  config: read the bytes of a blob as unsigned characters
2026-10-29 07:18:00 -07:00
Junio C Hamano 3a5cd30544 Merge branch 'of/bundle-uninitialized-memory-fix'
The 'git bundle create' command has been updated to initialize the
revs_copy structure at declaration. This prevents a potential crash
caused by reading uninitialized stack memory during cleanup when an
unrecognized argument is provided.

* of/bundle-uninitialized-memory-fix:
  bundle: do not free uninitialized memory on bad arguments
2026-10-29 07:18:00 -07:00
Junio C Hamano 8d1b215c01 The 10th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-28 07:40:27 -07:00
Junio C Hamano 30e6f5e4e6 Merge branch 'sw/cache-tree-ignore-locked-index'
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
2026-10-28 07:40:27 -07:00
Junio C Hamano 8fe963845e Merge branch 'ss/repack-drop-filtered-dry-run'
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
2026-10-28 07:40:26 -07:00
Junio C Hamano 8814f276c0 Merge branch 'tb/rerere-wait-for-merge-rr-lock'
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
2026-10-28 07:40:26 -07:00
Junio C Hamano 84733a6de4 Merge branch 'jk/test-lazy-prereq-heredoc'
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
2026-10-28 07:40:26 -07:00
Junio C Hamano 37b3475fb5 The 9th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-26 07:28:01 -07:00
Junio C Hamano b66626e09a Merge branch 'ps/odb-files-alternates-cleanups'
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
2026-10-26 07:28:01 -07:00
Junio C Hamano 2526487566 Merge branch 'ic/includeif-hostname'
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
2026-10-26 07:28:01 -07:00
Junio C Hamano 5cdaf2b1a7 Merge branch 'je/doc-promote-git-help'
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
2026-10-26 07:28:01 -07:00
Junio C Hamano 832192728c Merge branch 'ps/ci-housekeeping-and-modernizations'
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
2026-10-26 07:28:00 -07:00
Junio C Hamano bd52c76874 Merge branch 'ak/sequencer-head-refdup'
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
2026-10-26 07:28:00 -07:00
Junio C Hamano 775dc1673e Merge branch 'mb/fast-import-reference-pending'
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
2026-10-26 07:28:00 -07:00
Junio C Hamano adbe9b43f4 Merge branch 'ps/pack-check-bigfile-threshold'
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
2026-10-26 07:27:59 -07:00
Junio C Hamano a5eccd30b2 Merge branch 'ps/setup-enforce-repo-passed-to-create-repository-has-no-state'
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()`
2026-10-26 07:27:59 -07:00
Junio C Hamano eab342c82b Merge branch 'rm/blame-default-ignore-revs'
'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
2026-10-26 07:27:59 -07:00
Shashank 8c3311231e t0081: modernize the code testing whether a file exists
Replace the old-style shell `test -f` command with Git's modern
`test_path_is_file`.

Signed-off-by: Shashank <shashu8660@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-25 09:29:19 -07:00
Thomas Bachem 3a7784d0d5 hook: accept .enabled and .parallel given without a value
hook.<name>.enabled and hook.<name>.parallel are booleans, and
git-config(1) documents a boolean without a value as true. But
hook_config_lookup_all() rejects every hook.<name>.<key> that has no
value, so "git -c hook.lint.parallel hook run pre-commit" fails with
"missing value for 'hook.lint.parallel'", and so does a bare
"parallel" under [hook "lint"]. The same happens with .enabled, for a
hook as well as for an event.

Keep rejecting a missing value for the other keys. For .enabled and
.parallel, pass it to git_parse_maybe_bool(), which takes it as true.

Assisted-by: Claude Fable 5.1
Signed-off-by: Thomas Bachem <mail@thomasbachem.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 10:47:35 -07:00
Thomas Bachem c3764d15e6 hook: make hook.<event>.enabled cover the hookdir hook
hook.<event>.enabled, added by dcfb5af67e (hook: add
hook.<event>.enabled switch, 2026-04-10), skips only the hooks
defined in the configuration when set to false. With
hook.pre-commit.enabled=false, "git commit" still runs
.git/hooks/pre-commit, and "git hook list" shows that hook without
the "event-disabled" mark.

That was the intent, but the documentation says "no hooks fire for
that event", which reads as covering the hookdir hook too. No other
setting turns off the hookdir hook of a single event either:
core.hooksPath=/dev/null turns off the hookdir hooks of all events.
Make the switch cover the hookdir hook as well, and say so in the
documentation. This changes behavior for anyone who set the switch
and relied on the hookdir hook still running.

The test for hook.<event>.enabled=false looks only at the standard
output, but "git hook run" sends hook output to the standard error,
so the test passes even when a disabled hook runs. Add a hookdir hook
to it and check the standard error as well.

Assisted-by: Claude Fable 5.1
Signed-off-by: Thomas Bachem <mail@thomasbachem.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 10:47:35 -07:00
Patrick Steinhardt b948c10c8b rerere: get rid of global rerere cache state
The rerere cache state is tracked via a global variable. On the one hand
this ties it to one specific repository. On the other hand it has the
consequence that the cache may be leaking state across multiple calls
into the rerere subsystem.

Refactor the subsystem to instead pass around the rerere cache state
explicitly and make callers responsible for setting it up and then
clearing it again.

For now, all callers are updated to do so ad-hoc. This of course means
that state that we could carry over across multiple calls would have to
be set up multiple times. But that doesn't really matter much right now
anyway, as the number of times we call those functions is bounded.

Note that `rerere_gc_needed()` is the only caller where we explicitly
don't set up the rerere cache state. This is intentional and matches the
previous status quo, where we didn't honor "rerere.enabled", either. The
function only needs access to `struct rerere_cache::dirs` anyway though,
so it's fine to partially initialize it, only.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 09:58:33 -07:00
Patrick Steinhardt ea54cda7c2 rerere: bundle global state into a struct
The state of the rerere subsystem is tracked across several global
variables. Move them into a struct so that we can easily de-globalize
the state.

Note that the lock timeout is only ever used in `setup_rerere()`. So
instead of moving it into the new struct, we just keep it as a local
variable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 09:58:33 -07:00
Patrick Steinhardt 4f67f74fc8 rerere: stop using the_repository
There's only a couple of trivial function calls left that implicitly
make us depend on `the_repository`. Refactor those to instead use their
variants that allow us to make the dependency explicit.

Note that this requires us to make `get_hash_hex_algop()` public.

With these changes, "rerere.c" no longer depends on `the_repository`, so
drop `USE_THE_REPOSITORY_VARIABLE`. Despite that, we still carry some
global state in this file that will tie a specific rerere cache to the
first repository used to populate it. This will be fixed in subsequent
commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 09:58:33 -07:00
Patrick Steinhardt 87ab289605 rerere: cache result of is_rerere_enabled()
The function `setup_rerere()` reads the rerere configuration and then
figures out whether the rerere cache is enabled after all, either
because it has been explicitly enabled or because it's implicitly
enabled and ".git/rr-cache" exists. Whether the cache is enabled will
not change in a single process though, so it does not make sense to
reevaluate these conditions every single time `setup_rerere()` is
called.

Adapt the function to instead cache the status of the rerere cache via
a new `struct repository::rerere_cache_enabled` member. This allows us
to get rid of the `GIT_PATH_FUNC()`, which caches the path to the rerere
cache directory. But now that we already cache the enabled state in the
first place it becomes moot to cache the path, as well.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 09:58:33 -07:00
Patrick Steinhardt a8b75e8eda rerere: remove redundant calls to repo_config()
When setting up the rerere cache we eventually end up calling
`repo_config()`. This call is redundant though, as all callers of
`setup_rerere()` already called `repo_config()` beforehand.

Next to being redundant though it also feels like a layering violation.
The intent of that function is to set up state for the rerere cache, but
we potentially end up modifying other global state, too. This is usually
fine, but it is surprising to say the very least. If a caller for
example were to call `repo_config()` and then modifies the parsed config
manually then those modifications would be lost when calling
`setup_rerere()`.

Despite the layering violation though it will also create problems with
a subsequent commit, where we are about to cache whether or not the
rerere cache is enabled. As part of that change we would stop calling
`repo_config()` when the rerere cache is disabled, but continue to call
it when it's enabled. So the above layering violation is essentially
becoming even worse, because we may or may not clobber config values.

Drop the call, as well as another redundant call in `rerere_gc()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 09:58:33 -07:00
Patrick Steinhardt f62947adf0 rerere: stop using the_repository in internal helpers
Most of the static helpers in "rerere.c" still rely on `the_repository`
even though their callers already have a `struct repository` available.
Thread the repository through those helpers so that we can get rid of
references to that global variable.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 09:58:33 -07:00
Patrick Steinhardt 9dba0b87e5 rerere: stop using the_repository in rerere_path()
The function `rerere_path()` computes paths of rerere cache entries
contained in the "rr-cache" directory of `the_repository`. This makes us
implicitly depend on global state.

Add a repository parameter so that callers can specify which repository
to compute the path for. Adjust the internal helpers that call it to
pass down the repository they already have available in their contexts.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-23 09:58:32 -07:00
Junio C Hamano fba2137294 Merge branch 'tb/rerere-wait-for-merge-rr-lock' into ps/rerere-remove-global-state
* tb/rerere-wait-for-merge-rr-lock:
  rerere: add "gc --skip-locked" for auto maintenance
  rerere: wait for MERGE_RR.lock before giving up
2026-10-23 09:58:03 -07:00