Commit Graph

80355 Commits

Author SHA1 Message Date
Junio C Hamano
fcff548ddb Merge branch 'mm/diff-no-index-find-object' into next
"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-03 13:41:21 -08:00
Junio C Hamano
e2d1e47015 Merge branch 'ps/ci-reduce-gitlab-envsize' into next
CI fix.

* ps/ci-reduce-gitlab-envsize:
  ci: unset GITLAB_FEATURES envvar to not bust xargs(1) limits
2026-03-03 13:41:21 -08:00
Junio C Hamano
c01b2c73d8 Merge branch 'fp/t3310-test-path-is-helpers' into next
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-03 13:41:21 -08:00
Junio C Hamano
1224b73913 Merge branch 'ss/test-that-that-typofix' into next
Typofix in t/.

* ss/test-that-that-typofix:
  t: fix "that that" typo in lib-unicode-nfc-nfd.sh
2026-03-03 13:41:21 -08:00
Junio C Hamano
70cbc2ea97 Merge branch 'rs/parse-options-duplicated-long-options' into next
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-03 13:41:20 -08:00
Junio C Hamano
5a4be22ab6 Merge branch 'ar/config-hooks' into next
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:
2026-03-03 13:41:20 -08:00
Junio C Hamano
54bc051969 Merge branch 'kh/format-patch-noprefix-is-boolean' into next
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
2026-03-03 13:41:20 -08:00
Junio C Hamano
1c1a636109 Sync with 'master' 2026-03-02 17:21:09 -08:00
Junio C Hamano
e1647839fa Merge branch 'jk/repo-structure-cleanup' into next
Code clean-up.

* jk/repo-structure-cleanup:
  repo: remove unnecessary variable shadow
2026-03-02 17:21:01 -08:00
Junio C Hamano
b979797314 Merge branch 'lp/diff-stat-utf8-display-width-fix' into next
"git log --graph --stat" did not count the display width of colored
graph part of its own output correctly, which has been corrected.

* lp/diff-stat-utf8-display-width-fix:
  t4052: test for diffstat width when prefix contains ANSI escape codes
  diff: handle ANSI escape codes in prefix when calculating diffstat width
2026-03-02 17:21:00 -08:00
Junio C Hamano
914bcef227 Merge branch 'jh/alias-i18n-fixes' into next
Further update to the i18n alias support to avoid regressions.

* jh/alias-i18n-fixes:
  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-02 17:21:00 -08:00
Junio C Hamano
c7251cc68f Merge branch 'cs/add-skip-submodule-ignore-all' into next
"git add <submodule>" has been taught to honor
submodule.<name>.ignore that is set to "all" (and requires "git add
-f" to override it).

* cs/add-skip-submodule-ignore-all:
  Documentation: update add --force option + ignore=all config
  tests: fix existing tests when add an ignore=all submodule
  tests: t2206-add-submodule-ignored: ignore=all and add --force tests
  read-cache: submodule add need --force given ignore=all configuration
  read-cache: update add_files_to_cache take param ignored_too
2026-03-02 17:20:59 -08:00
Junio C Hamano
f5aabac117 Merge branch 'ar/run-command-hook-take-2' into next
Use the hook API to replace ad-hoc invocation of hook scripts via
the run_command() API.

* ar/run-command-hook-take-2:
  builtin/receive-pack: avoid spinning no-op sideband async threads
2026-03-02 17:20:57 -08:00
Junio C Hamano
4805bb9930 The 9th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 17:06:53 -08:00
Junio C Hamano
9db3644607 Merge branch 'jt/object-file-use-container-of'
Code clean-up.

* jt/object-file-use-container-of:
  object-file.c: avoid container_of() of a NULL container
  object-file: use `container_of()` to convert from base types
2026-03-02 17:06:53 -08:00
Junio C Hamano
13763ecf7d Merge branch 'ps/receive-pack-shallow-optim'
The code to accept shallow "git push" has been optimized.

* ps/receive-pack-shallow-optim:
  commit: use commit graph in `lookup_commit_reference_gently()`
  commit: make `repo_parse_commit_no_graph()` more robust
  commit: avoid parsing non-commits in `lookup_commit_reference_gently()`
2026-03-02 17:06:53 -08:00
Junio C Hamano
34113149cf Merge branch 'kh/doc-patch-id-4'
Doc update.

* kh/doc-patch-id-4:
  doc: patch-id: see also git-cherry(1)
  doc: patch-id: add script example
  doc: patch-id: emphasize multi-patch processing
2026-03-02 17:06:53 -08:00
Junio C Hamano
427d39ca4f Merge branch 'ps/meson-gitk-git-gui'
Plumb gitk/git-gui build and install procedure in meson based
builds.

* ps/meson-gitk-git-gui:
  meson: wire up gitk and git-gui
2026-03-02 17:06:52 -08:00
Junio C Hamano
112252c844 Merge branch 'pw/meson-doc-mergetool'
Update build precedure for mergetool documentation in meson-based builds.

* pw/meson-doc-mergetool:
  meson: fix building mergetool docs
2026-03-02 17:06:52 -08:00
Junio C Hamano
05c4af5c8f Merge branch 'kh/doc-am-xref'
Doc update.

* kh/doc-am-xref:
  doc: am: fill out hook discussion
  doc: am: add missing config am.messageId
  doc: am: say that --message-id adds a trailer
  doc: am: normalize git(1) command links
2026-03-02 17:06:52 -08:00
Junio C Hamano
10dd04a3fe Merge branch 'ps/object-info-bits-cleanup'
A couple of bugs in use of flag bits around odb API has been
corrected, and the flag bits reordered.

* ps/object-info-bits-cleanup:
  odb: convert `odb_has_object()` flags into an enum
  odb: convert object info flags into an enum
  odb: drop gaps in object info flag values
  builtin/fsck: fix flags passed to `odb_has_object()`
  builtin/backfill: fix flags passed to `odb_has_object()`
2026-03-02 17:06:52 -08:00
Junio C Hamano
02c31a8ddc Merge branch 'ag/http-netrc-tests'
Additional tests were introduced to see the interaction with netrc
auth with auth failure on the http transport.

* ag/http-netrc-tests:
  t5550: add netrc tests for http 401/403
2026-03-02 17:06:51 -08:00
Junio C Hamano
664bd4e15a Merge branch 'ty/symlinks-use-unsigned-for-bitset'
Code clean-up.

* ty/symlinks-use-unsigned-for-bitset:
  symlinks: use unsigned int for flags
2026-03-02 17:06:51 -08:00
Junio C Hamano
146487360c Merge branch 'ps/validate-prefix-in-subtree-split'
"git subtree split --prefix=P <commit>" now checks the prefix P
against the tree of the (potentially quite different from the
current working tree) given commit.

* ps/validate-prefix-in-subtree-split:
  subtree: validate --prefix against commit in split
2026-03-02 17:06:51 -08:00
Junio C Hamano
dbae219b22 Merge branch 'uk/signature-is-good-after-key-expires'
A signature on a commit that was GPG signed long time ago ought to
be still valid after the key that was used to sign it has expired,
but we showed them in alarming red.

* uk/signature-is-good-after-key-expires:
  gpg-interface: signatures by expired keys are fine
2026-03-02 17:06:50 -08:00
Junio C Hamano
9eb5b3b999 Merge branch 'ps/odb-for-each-object'
Revamp object enumeration API around odb.

* ps/odb-for-each-object:
  odb: drop unused `for_each_{loose,packed}_object()` functions
  reachable: convert to use `odb_for_each_object()`
  builtin/pack-objects: use `packfile_store_for_each_object()`
  odb: introduce mtime fields for object info requests
  treewide: drop uses of `for_each_{loose,packed}_object()`
  treewide: enumerate promisor objects via `odb_for_each_object()`
  builtin/fsck: refactor to use `odb_for_each_object()`
  odb: introduce `odb_for_each_object()`
  packfile: introduce function to iterate through objects
  packfile: extract function to iterate through objects of a store
  object-file: introduce function to iterate through objects
  object-file: extract function to read object info from path
  odb: fix flags parameter to be unsigned
  odb: rename `FOR_EACH_OBJECT_*` flags
2026-03-02 17:06:50 -08:00
Junio C Hamano
ec1c4d974a Merge branch 'ar/run-command-hook-take-2' into ar/config-hooks
* ar/run-command-hook-take-2:
  builtin/receive-pack: avoid spinning no-op sideband async threads
2026-03-02 16:01:33 -08:00
Adrian Ratiu
005f3fbe07 builtin/receive-pack: avoid spinning no-op sideband async threads
Exit early if the hooks do not exist, to avoid spinning up/down
sideband async threads which no-op.

It is important to call the hook_exists() API provided by hook.[ch]
because it covers both config-defined hooks and the "traditional"
hooks from the hookdir. find_hook() only covers the hookdir hooks.

The regression happened because the no-op async threads add some
additional overhead which can be measured with the receive-refs test
of the benchmarks suite [1].

Reproduced using:
cd benchmarks/receive-refs && \
./run --revisions /path/to/git \
fc148b146ad41be71a7852c4867f0773cbfe1ff9~,fc148b146ad41be71a7852c4867f0773cbfe1ff9 \
--parameter-list refformat reftable --parameter-list refcount 10000

1: https://gitlab.com/gitlab-org/data-access/git/benchmarks

Fixes: fc148b146a ("receive-pack: convert update hooks to new API")
Reported-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
[jc: avoid duplicated hardcoded hook names]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 16:00:43 -08:00
Siddharth Shrimali
5ee8782f87 t: fix "that that" typo in lib-unicode-nfc-nfd.sh
In the comments of lib-unicode-nfc-nfd.sh, "that that" was used
unintentionally. Remove the redundant "that" to improve clarity.

Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 13:42:55 -08:00
Francesco Paparatto
f31b322008 t3310: replace test -f/-d with test_path_is_file/test_path_is_dir
Replace old-style path assertions with modern helpers that
provide clearer diagnostic messages on failure. When test -f
fails, the output gives no indication of what went wrong.

These instances were found using:

  git grep "test -[efd]" t/

as suggested in the microproject ideas.

Signed-off-by: Francesco Paparatto <francescopaparatto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 13:13:56 -08:00
Patrick Steinhardt
eb35167dd4 ci: unset GITLAB_FEATURES envvar to not bust xargs(1) limits
We have started to see the following assert happen in our GitLab CI
pipelines for jobs that use Windows with Meson:

  assertion "bc_ctl.arg_max >= LINE_MAX" failed: file "xargs.c", line 512, function: main

The assert in question verifies that we have enough room available to
pass at least `LINE_MAX` many bytes via the command line. The xargs(1)
binary in those jobs comes from Git for Windows, which in turn sources
the binaries from MSYS2, and has the following limits in place:

  $ & "C:/Program Files/Git/usr/bin/bash.exe" -l -c 'xargs --show-limits </dev/null'
  Your environment variables take up 17373 bytes
  POSIX upper limit on argument length (this system): 12579
  POSIX smallest allowable upper limit on argument length (all systems): 4096
  Maximum length of command we could actually use: 18446744073709546822
  Size of command buffer we are actually using: 12579
  Maximum parallelism (--max-procs must be no greater): 2147483647

What's interesting to see is the limit of 16 exabits for the maximum
command line length. This value might seem a bit high, and it is indeed
the result of an underflow: our environment is larger than the POSIX
upper limit on argument length, and the value is computed by subtracting
the former from the latter. So what we get is the result of `2^64 -
(17373 - 12579)`.

This makes it clear that the problem here is the size of our environment
variables. A listing sorted by length yields the following result:

  $ Get-ChildItem "Env:" |
      Sort-Object { $_.Value.Length } -Descending |
      Select-Object Name, @{Name="Length"; Expression={$_.Value.Length}}
  Name                                          Length
  ----                                          ------
  GITLAB_FEATURES                                 6386
  Path                                             706
  PSModulePath                                     229

The GITLAB_FEATURES environment variable makes up for roughly a third of
the complete environment. This variable is a comma-separated list of
features available for the GitLab instance, and seemingly it has been
growing over time as GitLab added more and more features.

Fix the issue by unsetting the environment variable in "ci/lib.sh". This
ensures that the environment variables are now smaller than the upper
limit on argument length again, and that in turn fixes the assert in
xargs(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 11:08:14 -08:00
Kristoffer Haugsbakk
ea3a62c40e doc: diff-options.adoc: make *.noprefix split translatable
We cannot split single words like what we did in the previous
commit. That is because the doc translations are processed in
bigger chunks.

Instead write the two paragraphs with the only variations being this
configuration variable.

Reported-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 08:53:28 -08:00
Michael Montalbo
b0ddc7947c diff: fix crash with --find-object outside repository
When "git diff --find-object=<oid>" is run outside a git repository,
the option parsing callback eagerly resolves the OID via
repo_get_oid(), which reaches get_main_ref_store() and hits a BUG()
assertion because no repository has been set up.

Check startup_info->have_repository before attempting to resolve the
OID, and return a user-friendly error instead.

Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 08:29:48 -08:00
René Scharfe
237e520d81 parseopt: check for duplicate long names and numerical options
We already check for duplicate short names.  Check for and report
duplicate long names and numerical options as well.

Perform the slightly expensive string duplicate check only when showing
the usage to keep the cost of normal invocations low.  t0012-help.sh
covers it.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-03-02 07:39:01 -08:00
Junio C Hamano
625c4fb2da Sync with 'master' 2026-02-27 15:16:50 -08:00
Junio C Hamano
ec9e0a36ff Merge branch 'ps/refs-for-each' into next
Code refactoring around refs-for-each-* API functions.

* ps/refs-for-each:
  refs: replace `refs_for_each_fullref_in()`
  refs: replace `refs_for_each_namespaced_ref()`
  refs: replace `refs_for_each_glob_ref()`
  refs: replace `refs_for_each_glob_ref_in()`
  refs: replace `refs_for_each_rawref_in()`
  refs: replace `refs_for_each_rawref()`
  refs: replace `refs_for_each_ref_in()`
  refs: improve verification for-each-ref options
  refs: generalize `refs_for_each_fullref_in_prefixes()`
  refs: generalize `refs_for_each_namespaced_ref()`
  refs: speed up `refs_for_each_glob_ref_in()`
  refs: introduce `refs_for_each_ref_ext`
  refs: rename `each_ref_fn`
  refs: rename `do_for_each_ref_flags`
  refs: move `do_for_each_ref_flags` further up
  refs: move `refs_head_ref_namespaced()`
  refs: remove unused `refs_for_each_include_root_ref()`
2026-02-27 15:16:31 -08:00
Junio C Hamano
b378558c1a Merge branch 'ps/fsck-stream-from-the-right-object-instance' into next
"fsck" iterates over packfiles and its access to pack data caused
the list to be permuted, which caused it to loop forever; the code
to access pack data by "fsck" has been updated to avoid this.

* ps/fsck-stream-from-the-right-object-instance:
  pack-check: fix verification of large objects
  packfile: expose function to read object stream for an offset
  object-file: adapt `stream_object_signature()` to take a stream
  t/helper: improve "genrandom" test helper
2026-02-27 15:16:31 -08:00
Junio C Hamano
2b2e3a1fa9 Merge branch 'ob/core-attributesfile-in-repository' into next
The core.attributesfile is intended to be set per repository, but
were kept track of by a single global variable in-core, which has
been corrected by moving it to per-repository data structure.

* ob/core-attributesfile-in-repository:
  environment: move "branch.autoSetupMerge" into `struct repo_config_values`
  environment: stop using core.sparseCheckout globally
  environment: stop storing `core.attributesFile` globally
2026-02-27 15:16:30 -08:00
Junio C Hamano
6a04cca28e Merge branch 'ar/config-hooks' into next
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-02-27 15:16:30 -08:00
Junio C Hamano
d6ebc97cb1 Merge branch 'pt/t7527-flake-workaround' into next
Test fixup.

* pt/t7527-flake-workaround:
  t7527: fix flaky fsmonitor event tests with retry logic
2026-02-27 15:16:29 -08:00
Junio C Hamano
2cc7191751 The 8th batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-27 15:11:55 -08:00
Junio C Hamano
e417bf2996 Merge branch 'ap/use-test-seq-f-more'
Test clean-up.

* ap/use-test-seq-f-more:
  t: use test_seq -f and pipes in a few more places
2026-02-27 15:11:55 -08:00
Junio C Hamano
4416ec1ae3 Merge branch 'db/doc-fetch-jobs-auto'
Doc update.

* db/doc-fetch-jobs-auto:
  doc: fetch: document `--jobs=0` behavior
2026-02-27 15:11:54 -08:00
Junio C Hamano
d64a20a1b1 Merge branch 'mf/format-patch-honor-from-for-cover-letter'
"git format-patch --from=<me>" did not honor the command line
option when writing out the cover letter, which has been corrected.

* mf/format-patch-honor-from-for-cover-letter:
  format-patch: fix From header in cover letter
2026-02-27 15:11:54 -08:00
Junio C Hamano
c0d0b8daed Merge branch 'jh/alias-i18n'
Extend the alias configuration syntax to allow aliases using
characters outside ASCII alphanumeric (plus '-').

* jh/alias-i18n:
  completion: fix zsh alias listing for subsection aliases
  alias: support non-alphanumeric names via subsection syntax
  alias: prepare for subsection aliases
  help: use list_aliases() for alias listing
2026-02-27 15:11:53 -08:00
Junio C Hamano
ac78c5804e Merge branch 'ps/tests-wo-iconv-fixes'
Some tests assumed "iconv" is available without honoring ICONV
prerequisite, which has been corrected.

* ps/tests-wo-iconv-fixes:
  t6006: don't use iconv(1) without ICONV prereq
  t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
  t4205: improve handling of ICONV prerequisite
  t40xx: don't use iconv(1) without ICONV prereq
  t: don't set ICONV prereq when iconv(1) is missing
2026-02-27 15:11:53 -08:00
Junio C Hamano
a62d0da86a Merge branch 'ps/ci-gitlab-msvc-updates'
CI update.

* ps/ci-gitlab-msvc-updates:
  gitlab-ci: handle failed tests on MSVC+Meson job
  gitlab-ci: use "run-test-slice-meson.sh"
  ci: make test slicing consistent across Meson/Make
  github: fix Meson tests not executing at all
  meson: fix MERGE_TOOL_DIR with "--no-bin-wrappers"
  ci: don't skip smallest test slice in GitLab
  ci: handle failures of test-slice helper
2026-02-27 15:11:52 -08:00
Junio C Hamano
0f0a57e1e3 Merge branch 'jc/whitespace-incomplete-line'
It does not make much sense to apply the "incomplete-line"
whitespace rule to symbolic links, whose contents almost always
lack the final newline.  "git apply" and "git diff" are now taught
to exclude them for a change to symbolic links.

* jc/whitespace-incomplete-line:
  whitespace: symbolic links usually lack LF at the end
2026-02-27 15:11:52 -08:00
Junio C Hamano
c33b464dfd Merge branch 'jc/checkout-switch-restore'
"git switch <name>", in an attempt to create a local branch <name>
after a remote tracking branch of the same name gave an advise
message to disambiguate using "git checkout", which has been
updated to use "git switch".

* jc/checkout-switch-restore:
  checkout: tell "parse_remote_branch" which command is calling it
  checkout: pass program-readable token to unified "main"
2026-02-27 15:11:51 -08:00
Junio C Hamano
ce4530ac10 Merge branch 'jk/ref-filter-lrstrip-optim'
Code clean-up.

* jk/ref-filter-lrstrip-optim:
  ref-filter: clarify lstrip/rstrip component counting
  ref-filter: avoid strrchr() in rstrip_ref_components()
  ref-filter: simplify rstrip_ref_components() memory handling
  ref-filter: simplify lstrip_ref_components() memory handling
  ref-filter: factor out refname component counting
2026-02-27 15:11:51 -08:00