Commit Graph

80205 Commits

Author SHA1 Message Date
Patrick Steinhardt
6fea405bb9 builtin/fsck: stop using the_repository in error reporting
In the preceding commit we have introduced the repository into `struct
fsck_object_report`. This allows us to drop remaining uses of the global
`the_repository` variable.

Drop them and remove `USE_THE_REPOSITORY_VARIABLE`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:11 -07:00
Patrick Steinhardt
cc050f00cd builtin/fsck: stop using the_repository when marking objects
We implicitly rely on `the_repository` when marking objects for
connectivity. Refactor this to instead inject the repository via the
callback payload.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:11 -07:00
Patrick Steinhardt
1c5f77b610 builtin/fsck: stop using the_repository when checking packed objects
We implicitly rely on `the_repository` when checking objects part of a
packfile. These objects are iterated over via `verify_pack()`, which is
provided by the packfile subsystem, and a callback function is then
invoked for each of the objects in that specific pack.

Unfortunately, it is not possible to provide a payload to the callback
function. Refactor `verify_pack()` to accept a payload that is passed
through to the callback so that we can inject the repository and get rid
of the use of `the_repository`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:11 -07:00
Patrick Steinhardt
2b2287c479 builtin/fsck: stop using the_repository with loose objects
We depend on `the_repository` when performing consistency checks for
loose objects. Refactor this to use a context-provided repository
instead that is injected via the `struct for_each_loose_cb`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:11 -07:00
Patrick Steinhardt
38e09ebfd4 builtin/fsck: stop using the_repository when checking reflogs
We implicitly rely on `the_repository` when checking reflogs. Refactor
this to instead inject the repository via the callback payload.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:10 -07:00
Patrick Steinhardt
3ea779432d builtin/fsck: stop using the_repository when checking refs
We implicitly rely on `the_repository` when checking refs. Refactor this
to instead inject the repository via the callback payload.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:10 -07:00
Patrick Steinhardt
4c44db7dc5 builtin/fsck: stop using the_repository when snapshotting refs
We depedn on `the_repository` when snapshotting refs. Refactor this to
use a context-provided repository instead that is injected via the
`struct snapshot_ref_data`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:10 -07:00
Patrick Steinhardt
da3ead3ee3 builtin/fsck: fix trivial dependence on the_repository
We have a bunch of sites in "builtin/fsck.c" that depend on
`the_repository` even though we already have a repository available, or
in cases where we can trivially make it available.

Refactor such sites to use the context-provided repository instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:10 -07:00
Patrick Steinhardt
fe5f16ecc3 fsck: drop USE_THE_REPOSITORY
Stop using `the_repository` in "fsck.c" in favor of the repository that
we've already got available via `struct fsck_options`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:10 -07:00
Patrick Steinhardt
3749853908 fsck: store repository in fsck options
The fsck subsystem relies on `the_repository` quite a bit. While we
could of course explicitly pass a repository down the callchain, we
already have a `struct fsck_options` that we pass to almost all
functions.

Extend the options to also store the repository to make it readily
available.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:10 -07:00
Patrick Steinhardt
f223609026 fsck: initialize fsck options via a function
We initialize the `struct fsck_options` via a set of macros, often in
global scope. In the next commit though we're about to introduce a new
repository field to the options that must be initialized, and naturally
we don't have a repo other than `the_repository` available in this
scope.

Refactor the code to instead intrdouce a new `fsck_options_init()`
function that initializes the options for us and move initialization
into function scope.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:10 -07:00
Patrick Steinhardt
17cabd369b fetch-pack: move fsck options into function scope
When fetching a packfile, we optionally verify received objects via the
fsck subsystem. The options for those consistency checks are declared in
global scope without a good reason, and they are never cleaned up. So in
case the options are reused, they may accumulate more state over time.

Furthermore, in subsequent changes we'll introduce a repository pointer
into the structure. Obviously though, we don't have a repository
available at static time, except for `the_repository`, which we don't
want to use here.

Refactor the code to move the options into the respective functions and
properly manage their lifecycle.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-23 08:33:09 -07:00
Junio C Hamano
ca1db8a0f7 The 17th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-16 10:48:15 -07:00
Junio C Hamano
9883fcb960 Merge branch 'ty/patch-ids-document-lazy-eval'
In-code comment update to record a design decision to allow lazy
computation of patch IDs.

* ty/patch-ids-document-lazy-eval:
  patch-ids: document intentional const-casting in patch_id_neq()
2026-03-16 10:48:15 -07:00
Junio C Hamano
3c59f3bc4b Merge branch 'rs/history-ergonomics-updates-fix'
Fix use of uninitialized variable.

* rs/history-ergonomics-updates-fix:
  history: initialize rev_info in cmd_history_reword()
2026-03-16 10:48:15 -07:00
Junio C Hamano
2eec0f5115 Merge branch 'jk/unleak-mmap'
Plug a few leaks where mmap'ed memory regions are not unmapped.

* jk/unleak-mmap:
  meson: turn on NO_MMAP when building with LSan
  Makefile: turn on NO_MMAP when building with LSan
  object-file: fix mmap() leak in odb_source_loose_read_object_stream()
  pack-revindex: avoid double-loading .rev files
  check_connected(): fix leak of pack-index mmap
  check_connected(): delay opening new_pack
2026-03-16 10:48:15 -07:00
Junio C Hamano
c563b12ce7 Merge branch 'ty/setup-error-tightening'
While discovering a ".git" directory, the code treats any stat()
failure as a sign that a filesystem entity .git does not exist
there, and ignores ".git" that is not a "gitdir" file or a
directory.  The code has been tightened to notice and report
filesystem corruption better.

* ty/setup-error-tightening:
  setup: improve error diagnosis for invalid .git files
2026-03-16 10:48:14 -07:00
Junio C Hamano
d4b2a7908d Merge branch 'os/doc-git-custom-commands'
Doc update.

* os/doc-git-custom-commands:
  doc: make it easier to find custom command information
2026-03-16 10:48:14 -07:00
Junio C Hamano
a11f0ad992 Merge branch 'fp/t3310-unhide-git-failures'
The construct 'test "$(command)" = expectation' loses the exit
status from the command, which has been fixed by breaking up the
statement into pieces.

* fp/t3310-unhide-git-failures:
  t3310: avoid hiding failures from rev-parse in command substitutions
2026-03-16 10:48:14 -07:00
Junio C Hamano
61a45befd3 Merge branch 'jt/repo-structure-extrema'
"git repo structure" command learns to report maximum values on
various aspects of objects it inspects.

* jt/repo-structure-extrema:
  builtin/repo: find tree with most entries
  builtin/repo: find commit with most parents
  builtin/repo: add OID annotations to table output
  builtin/repo: collect largest inflated objects
  builtin/repo: add helper for printing keyvalue output
  builtin/repo: update stats for each object
2026-03-16 10:48:14 -07:00
Junio C Hamano
b8ac2bf3f0 Merge branch 'sp/wt-status-wo-the-repository'
Reduce dependence on the global the_hash_algo and the_repository
variables of wt-status code path.

* sp/wt-status-wo-the-repository:
  wt-status: use hash_algo from local repository instead of global the_hash_algo
  wt-status: replace uses of the_repository with local repository instances
  wt-status: pass struct repository through function parameters
2026-03-16 10:48:14 -07:00
Junio C Hamano
dc6ecd5354 The 16th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-12 14:09:07 -07:00
Junio C Hamano
c89a495ce4 Merge branch 'ps/odb-sources'
The object source API is getting restructured to allow plugging new
backends.

* ps/odb-sources:
  odb/source: make `begin_transaction()` function pluggable
  odb/source: make `write_alternate()` function pluggable
  odb/source: make `read_alternates()` function pluggable
  odb/source: make `write_object_stream()` function pluggable
  odb/source: make `write_object()` function pluggable
  odb/source: make `freshen_object()` function pluggable
  odb/source: make `for_each_object()` function pluggable
  odb/source: make `read_object_stream()` function pluggable
  odb/source: make `read_object_info()` function pluggable
  odb/source: make `close()` function pluggable
  odb/source: make `reprepare()` function pluggable
  odb/source: make `free()` function pluggable
  odb/source: introduce source type for robustness
  odb: move reparenting logic into respective subsystems
  odb: embed base source in the "files" backend
  odb: introduce "files" source
  odb: split `struct odb_source` into separate header
2026-03-12 14:09:07 -07:00
Junio C Hamano
d0413b31dd Merge branch 'hn/status-compare-with-push'
"git status" learned to show comparison between the current branch
and various other branches listed on status.compareBranches
configuration.

* hn/status-compare-with-push:
  status: clarify how status.compareBranches deduplicates
  status: add status.compareBranches config for multiple branch comparisons
  refactor format_branch_comparison in preparation
2026-03-12 14:09:06 -07:00
Junio C Hamano
03161747b4 Merge branch 'ds/for-each-repo-w-worktree'
"git for-each-repo" started from a secondary worktree did not work
as expected, which has been corrected.

* ds/for-each-repo-w-worktree:
  for-each-repo: simplify passing of parameters
  for-each-repo: work correctly in a worktree
  run-command: extract sanitize_repo_env helper
  for-each-repo: test outside of repo context
2026-03-12 14:09:05 -07:00
Junio C Hamano
67006b9db8 The 15th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-12 10:56:05 -07:00
Junio C Hamano
99da934835 Merge branch 'sp/send-email-validate-charset'
"git send-email" has learned to be a bit more careful when it
accepts charset to use from the end-user, to avoid 'y' (mistaken
'yes' when expecting a charset like 'UTF-8') and other nonsense.

* sp/send-email-validate-charset:
  send-email: validate charset name in 8bit encoding prompt
2026-03-12 10:56:05 -07:00
Junio C Hamano
8985491423 Merge branch 'dt/send-email-client-cert'
"git send-email" learns to support use of client-side certificates.

* dt/send-email-client-cert:
  send-email: add client certificate options
2026-03-12 10:56:05 -07:00
Junio C Hamano
fdfa7f64d6 Merge branch 'ps/ci-gitlab-prepare-for-macos-14-deprecation'
Move gitlab CI from macOS 14 images that are being deprecated.

* ps/ci-gitlab-prepare-for-macos-14-deprecation:
  gitlab-ci: update to macOS 15 images
  meson: detect broken iconv that requires ICONV_RESTART_RESET
  meson: simplify iconv-emits-BOM check
2026-03-12 10:56:04 -07:00
Junio C Hamano
b2102627d7 Merge branch 'ag/send-email-sasl-with-host-port'
"git send-email" learns to pass hostname/port to Authen::SASL
module.

* ag/send-email-sasl-with-host-port:
  send-email: pass smtp hostname and port to Authen::SASL
2026-03-12 10:56:04 -07:00
Junio C Hamano
0724f727ee Merge branch 'ss/t9123-setup-inside-test-expect-success'
Test clean-up.

* ss/t9123-setup-inside-test-expect-success:
  t9123: use test_when_finished for cleanup
2026-03-12 10:56:04 -07:00
Junio C Hamano
9a591a99d0 Merge branch 'sk/oidmap-clear-with-custom-free-func'
A bit of OIDmap API enhancement and cleanup.

* sk/oidmap-clear-with-custom-free-func:
  builtin/rev-list: migrate missing_objects cleanup to oidmap_clear_with_free()
  oidmap: make entry cleanup explicit in oidmap_clear
2026-03-12 10:56:04 -07:00
Junio C Hamano
642aa4f393 Merge branch 'jt/doc-submitting-patches-study-before-sending'
Doc update for our contributors.

* jt/doc-submitting-patches-study-before-sending:
  Documentation: extend guidance for submitting patches
2026-03-12 10:56:03 -07:00
Junio C Hamano
198eb1b93e Merge branch 'os/doc-custom-subcommand-on-path'
The way end-users can add their own "git <cmd>" subcommand by
storing "git-<cmd>" in a directory on their $PATH has not been
documented clearly, which has been corrected.

* os/doc-custom-subcommand-on-path:
  doc: add information regarding external commands
2026-03-12 10:56:03 -07:00
Junio C Hamano
f3e18324c2 Merge branch 'ss/t3700-modernize'
Test clean-up.

* ss/t3700-modernize:
  t3700: use test_grep helper for better diagnostics
  t3700: avoid suppressing git's exit code
2026-03-12 10:56:03 -07:00
Junio C Hamano
9b194289d4 Merge branch 'lp/doc-gitprotocol-pack-fixes'
Doc update.

* lp/doc-gitprotocol-pack-fixes:
  doc: gitprotocol-pack: normalize italic formatting
  doc: gitprotocol-pack: improve paragraphs structure
  doc: gitprotocol-pack: fix pronoun-antecedent agreement
2026-03-12 10:56:03 -07:00
Junio C Hamano
69affbe67f Merge branch 'kj/path-micro-code-cleanup'
Code clean-up.

* kj/path-micro-code-cleanup:
  path: remove redundant function calls
  path: use size_t for dir_prefix length
  path: remove unused header
2026-03-12 10:56:02 -07:00
Junio C Hamano
8194f1795b Merge branch 'bc/sha1-256-interop-02'
The code to maintain mapping between object names in multiple hash
functions is being added, written in Rust.

* bc/sha1-256-interop-02:
  object-file-convert: always make sure object ID algo is valid
  rust: add a small wrapper around the hashfile code
  rust: add a new binary object map format
  rust: add functionality to hash an object
  rust: add a build.rs script for tests
  rust: fix linking binaries with cargo
  hash: expose hash context functions to Rust
  write-or-die: add an fsync component for the object map
  csum-file: define hashwrite's count as a uint32_t
  rust: add additional helpers for ObjectID
  hash: add a function to look up hash algo structs
  rust: add a hash algorithm abstraction
  rust: add a ObjectID struct
  hash: use uint32_t for object_id algorithm
  conversion: don't crash when no destination algo
  repository: require Rust support for interoperability
2026-03-12 10:56:02 -07:00
Junio C Hamano
7f19e4e1b6 The 14th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-10 14:23:24 -07:00
Junio C Hamano
42afcb954b Merge branch 'jh/alias-i18n-fixes'
Further update to the i18n alias support to avoid regressions.

* jh/alias-i18n-fixes:
  doc: fix list continuation in alias.adoc
  git, help: fix memory leaks in alias listing
  alias: treat empty subsection [alias ""] as plain [alias]
  doc: fix list continuation in alias subsection example
2026-03-10 14:23:24 -07:00
Junio C Hamano
08c3609935 Merge branch 'pt/fsmonitor-watchman-sample-fix'
Fix typo-induced breakages in fsmonitor-watchman sample hook.

* pt/fsmonitor-watchman-sample-fix:
  fsmonitor-watchman: fix variable reference and remove redundant code
2026-03-10 14:23:23 -07:00
Junio C Hamano
015cf12578 Merge branch 'mm/diff-no-index-find-object'
"git diff --no-index --find-object=<object-name>" outside a
repository of course wouldn't be able to find the object and died
while parsing the command line, which is made to die in a bit more
user-friendly way.

* mm/diff-no-index-find-object:
  diff: fix crash with --find-object outside repository
2026-03-10 14:23:22 -07:00
Junio C Hamano
0f34e8c174 Merge branch 'ps/ci-reduce-gitlab-envsize'
CI fix.

* ps/ci-reduce-gitlab-envsize:
  ci: unset GITLAB_FEATURES envvar to not bust xargs(1) limits
2026-03-10 14:23:21 -07:00
Junio C Hamano
755eb44fa4 Merge branch 'fp/t3310-test-path-is-helpers'
Test clean-up.

* fp/t3310-test-path-is-helpers:
  t3310: replace test -f/-d with test_path_is_file/test_path_is_dir
2026-03-10 14:23:20 -07:00
Junio C Hamano
cdc7ffacaf Merge branch 'ss/test-that-that-typofix'
Typofix in t/.

* ss/test-that-that-typofix:
  t: fix "that that" typo in lib-unicode-nfc-nfd.sh
2026-03-10 14:23:20 -07:00
Junio C Hamano
6953f24e40 Merge branch 'rs/parse-options-duplicated-long-options'
The parse-options API learned to notice an options[] array with
duplicated long options.

* rs/parse-options-duplicated-long-options:
  parseopt: check for duplicate long names and numerical options
  pack-objects: remove duplicate --stdin-packs definition
2026-03-10 14:23:19 -07:00
Junio C Hamano
f330d46dee Merge branch 'ar/config-hooks'
Allow hook commands to be defined (possibly centrally) in the
configuration files, and run multiple of them for the same hook
event.

* ar/config-hooks:
  hook: add -z option to "git hook list"
  hook: allow out-of-repo 'git hook' invocations
  hook: allow event = "" to overwrite previous values
  hook: allow disabling config hooks
  hook: include hooks from the config
  hook: add "git hook list" command
  hook: run a list of hooks to prepare for multihook support
  hook: add internal state alloc/free callbacks
2026-03-10 14:23:18 -07:00
Junio C Hamano
9a8aebae97 Merge branch 'kh/format-patch-noprefix-is-boolean'
The configuration variable format.noprefix did not behave as a
proper boolean variable, which has now been fixed and documented.

* kh/format-patch-noprefix-is-boolean:
  doc: diff-options.adoc: make *.noprefix split translatable
  doc: diff-options.adoc: show format.noprefix for format-patch
  format-patch: make format.noprefix a boolean
2026-03-10 14:23:17 -07:00
Junio C Hamano
d181b9354c The 13th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-09 14:36:56 -07:00
Junio C Hamano
676c145afd Merge branch 'jk/repo-structure-cleanup'
Code clean-up.

* jk/repo-structure-cleanup:
  repo: remove unnecessary variable shadow
2026-03-09 14:36:56 -07:00