summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorLines
2026-04-17Merge branch 'en/diffstat-utf8-truncation-fix' into seenseenJunio C Hamano-2/+49
The computation to shorten the filenames shown in diffstat measured width of individual UTF-8 characters to add up, but forgot to take into account error cases (e.g., an invalid UTF-8 sequence, or a control character). * en/diffstat-utf8-truncation-fix: diff: fix out-of-bounds reads and NULL deref in diffstat UTF-8 truncation
2026-04-17Merge branch 'en/batch-prefetch' into seenJunio C Hamano-1/+321
In a lazy clone, "git cherry" and "git grep" often fetch necessary blob objects one by one from promisor remotes. It has been corrected to collect necessary object names and fetch them in bulk to gain reasonable performance. * en/batch-prefetch: grep: prefetch necessary blobs builtin/log: prefetch necessary blobs for `git cherry` patch-ids.h: add missing trailing parenthesis in documentation comment
2026-04-17grep: prefetch necessary blobsElijah Newren-0/+177
In partial clones, `git grep` fetches necessary blobs on-demand one at a time, which can be very slow. In partial clones, add an extra preliminary walk over the tree similar to grep_tree() which collects the blobs of interest, and then prefetches them. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17builtin/log: prefetch necessary blobs for `git cherry`Elijah Newren-0/+143
In partial clones, `git cherry` fetches necessary blobs on-demand one at a time, which can be very slow. We would like to prefetch all necessary blobs upfront. To do so, we need to be able to first figure out which blobs are needed. `git cherry` does its work in a two-phase approach: first computing header-only IDs (based on file paths and modes), then falling back to full content-based IDs only when header-only IDs collide -- or, more accurately, whenever the oidhash() of the header-only object_ids collide. patch-ids.c handles this by creating an ids->patches hashmap that has all the data we need, but the problem is that any attempt to query the hashmap will invoke the patch_id_neq() function on any colliding objects, which causes the on-demand fetching. Insert a new prefetch_cherry_blobs() function before checking for collisions. Use a temporary replacement on the ids->patches.cmpfn in order to enumerate the blobs that would be needed without yet fetching them, and then fetch them all at once, then restore the old ids->patches.cmpfn. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17patch-ids.h: add missing trailing parenthesis in documentation commentElijah Newren-1/+1
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17diff: fix out-of-bounds reads and NULL deref in diffstat UTF-8 truncationElijah Newren-2/+49
f85b49f3d4a (diff: improve scaling of filenames in diffstat to handle UTF-8 chars, 2026-01-16) introduced a loop in show_stats() that calls utf8_width() repeatedly to skip leading characters until the displayed width fits. However, utf8_width() can return problematic values: - For invalid UTF-8 sequences, pick_one_utf8_char() sets the name pointer to NULL and utf8_width() returns 0. Since name_len does not change, the loop iterates once more and pick_one_utf8_char() dereferences the NULL pointer, crashing. - For control characters, utf8_width() returns -1, so name_len grows when it is expected to shrink. This can cause the loop to consume more characters than the string contains, reading past the trailing NUL. By default, fill_print_name() will C-quotes filenames which escapes control characters and invalid bytes to printable text. That avoids this bug from being triggered; however, with core.quotePath=false, raw bytes can reach this code. Add tests exercising both failure modes with core.quotePath=false and a narrow --stat-name-width to force truncation: one with a bare 0xC0 byte (invalid UTF-8 lead byte, triggers NULL deref) and one with a 0x01 byte (control character, causes the loop to read past the end of the string). Fix both issues by introducing utf8_ish_width(), a thin wrapper around utf8_width() that guarantees the pointer always advances and the returned width is never negative: - On invalid UTF-8 it restores the pointer, advances by one byte, and returns width 1 (matching the strlen()-based fallback used by utf8_strwidth()). - On a control character it returns 0 (matching utf8_strnwidth() which skips them). Also add a "&& *name" guard to the while-loop condition so it terminates at end-of-string even when utf8_strwidth()'s strlen() fallback causes name_len to exceed the sum of per-character widths. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17Merge branch 'mc/http-emptyauth-negotiate-fix' into seenJunio C Hamano-4/+112
The 'http.emptyAuth=auto' configuration now correctly attempts Negotiate authentication before falling back to manual credentials. This allows seamless Kerberos ticket-based authentication without requiring users to explicitly set 'http.emptyAuth=true'. * mc/http-emptyauth-negotiate-fix: t5563: add tests for http.emptyAuth with Negotiate http: attempt Negotiate auth in http.emptyAuth=auto mode http: extract http_reauth_prepare() from retry paths
2026-04-17Merge branch 'en/backfill-fixes-and-edges' into seenJunio C Hamano-10/+153
The 'git backfill' command now rejects revision-limiting options that are incompatible with its operation, uses standard documentation for revision ranges, and includes blobs from boundary commits by default to improve performance of subsequent operations. * en/backfill-fixes-and-edges: backfill: default to grabbing edge blobs too backfill: document acceptance of revision-range in more standard manner backfill: reject rev-list arguments that do not make sense
2026-04-17Merge branch 'ss/t7004-unhide-git-failures' into seenJunio C Hamano-22/+21
Test clean-up. * ss/t7004-unhide-git-failures: t7004: avoid subshells to capture git exit codes t7004: dynamically grab expected state in tests t7004: drop hardcoded tag count in invalid name test
2026-04-17Merge branch 'tb/pseudo-merge-bugfixes' into seenJunio C Hamano-10/+396
* tb/pseudo-merge-bugfixes: pack-bitmap: prevent pattern leak on pseudo-merge re-assignment pack-bitmap: reject pseudo-merge "sampleRate" of 0 pack-bitmap: parse commits in `find_pseudo_merge_group_for_ref()` pack-bitmap: fix pseudo-merge lookup for shared commits pack-bitmap: fix inverted binary search in `pseudo_merge_at()` pack-bitmap-write: sort pseudo-merge commit lookup table in pack order t5333: demonstrate various pseudo-merge bugs t/helper: add 'test-tool bitmap write' subcommand
2026-04-17Merge branch 'sb/userdiff-lisp-family' into seenJunio C Hamano-11/+43
The userdiff driver for the Scheme language has been extended to cover other Lisp dialects. * sb/userdiff-lisp-family: userdiff: extend Scheme support to cover other Lisp dialects userdiff: tighten word-diff test case of the scheme driver
2026-04-17Merge branch 'hn/git-checkout-m-with-stash' into seenJunio C Hamano-171/+483
"git checkout -m another-branch" was invented to deal with local changes to paths that are different between the current and the new branch, but it gave only one chance to resolve conflicts. The command was taught to create a stash to save the local changes. * hn/git-checkout-m-with-stash: checkout -m: autostash when switching branches checkout: rollback lock on early returns in merge_working_tree sequencer: teach autostash apply to take optional conflict marker labels sequencer: allow create_autostash to run silently stash: add --label-ours, --label-theirs, --label-base for apply
2026-04-17Merge branch 'ps/test-set-e-clean' into seenJunio C Hamano-69/+91
The test suite harness and many individual test scripts have been updated to work correctly when 'set -e' is in effect, which helps detect misspelled test commands. * ps/test-set-e-clean: t: detect errors outside of test cases t9902: fix use of `read` with `set -e` t6002: fix use of `expr` with `set -e` t1301: don't fail in case setfacl(1) doesn't exist or fails t0008: silence error in subshell when using `grep -v` t: prepare `test_when_finished ()`/`test_atexit()` for `set -e` t: prepare execution of potentially failing commands for `set -e` t: prepare conditional test execution for `set -e` t: prepare `git config --unset` calls for `set -e` t: prepare `stop_git_daemon ()` for `set -e` t: prepare `test_must_fail ()` for `set -e` t: prepare `test_match_signal ()` calls for `set -e`
2026-04-17Merge branch 'pt/fsmonitor-linux' into seenJunio C Hamano-63/+1272
The fsmonitor daemon has been implemented for Linux. * pt/fsmonitor-linux: fsmonitor: convert shown khash to strset in do_handle_client fsmonitor: add tests for Linux fsmonitor: add timeout to daemon stop command fsmonitor: close inherited file descriptors and detach in daemon run-command: add close_fd_above_stderr option fsmonitor: implement filesystem change listener for Linux fsmonitor: rename fsm-settings-darwin.c to fsm-settings-unix.c fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c fsmonitor: use pthread_cond_timedwait for cookie wait compat/win32: add pthread_cond_timedwait fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon fsmonitor: fix khash memory leak in do_handle_client t9210, t9211: disable GIT_TEST_SPLIT_INDEX for scalar clone tests
2026-04-17Merge branch 'jc/doc-timestamps-in-stat' into seenJunio C Hamano-0/+6
Doc update. * jc/doc-timestamps-in-stat: CodingGuidelines: st_mtimespec vs st_mtim vs st_mtime
2026-04-17Merge branch 'ps/odb-in-memory' into seenJunio C Hamano-118/+854
Add a new odb "in-memory" source that is meant to only hold tentative objects (like the virtual blob object that represents the working tree file used by "git blame"). * ps/odb-in-memory: t/unit-tests: add tests for the in-memory object source odb: generic in-memory source odb/source-inmemory: stub out remaining functions odb/source-inmemory: implement `freshen_object()` callback odb/source-inmemory: implement `count_objects()` callback odb/source-inmemory: implement `find_abbrev_len()` callback odb/source-inmemory: implement `for_each_object()` callback odb/source-inmemory: convert to use oidtree oidtree: add ability to store data cbtree: allow using arbitrary wrapper structures for nodes odb/source-inmemory: implement `write_object_stream()` callback odb/source-inmemory: implement `write_object()` callback odb/source-inmemory: implement `read_object_stream()` callback odb/source-inmemory: implement `read_object_info()` callback odb: fix unnecessary call to `find_cached_object()` odb/source-inmemory: implement `free()` callback odb: introduce "in-memory" source
2026-04-17Merge branch 'sp/refs-with-less-the-repository' into seenJunio C Hamano-0/+0
Reduce the reference to the_repository in the refs subsystem. * sp/refs-with-less-the-repository: refs/reftable-backend: drop uses of the_repository refs: remove the_hash_algo global state refs: add struct repository parameter in get_files_ref_lock_timeout_ms()
2026-04-17Merge branch 'ps/shift-root-in-graph' into seenJunio C Hamano-6/+188
In a history with more than one root commit, "git log --graph --oneline" stuffed an unrelated commit immediately below a root commit, which has been corrected by making the spot below a root unavailable. * ps/shift-root-in-graph: graph: add indentation for commits preceded by a parentless commit
2026-04-17Merge branch 'js/adjust-tests-to-explicitly-access-bare-repo' into seenJunio C Hamano-93/+74
Some tests assume that bare repository accesses are by default allowed; rewrite some of them to avoid the assumption, rewrite others to explicitly set safe.bareRepository to allow them. * js/adjust-tests-to-explicitly-access-bare-repo: git p4 clone --bare: need to be explicit about the gitdir t9700: stop relying on implicit bare repo discovery t9210: pass `safe.bareRepository=all` to `scalar register` t6020: use `-C` for worktree, `--git-dir` for bare repository t5619: wrap `test_commit_bulk` in `GIT_DIR` subshell for bare repo t5540/t5541: avoid accessing a bare repository via `-C <dir>` t5509: specify bare repository path explicitly t5505: export `GIT_DIR` after `git init --bare` t5503: avoid discovering a bare repository t2406: use `--git-dir=.` for bare repository worktree repair t2400: explicitly specify bare repo for `git worktree add` t1900: avoid using `-C <dir>` for a bare repository t1020: use `--git-dir` instead of subshell for bare repo t0056: allow implicit bare repo discovery for `-C` work-tree tests t0003: use `--git-dir` for bare repo attribute tests t0001: replace `cd`+`git` with `git --git-dir` in `check_config` t0001: allow implicit bare repo discovery for aliased-command test
2026-04-17Merge branch 'kh/doc-trailers' into seenJunio C Hamano-18/+50
Documentation updates. * kh/doc-trailers: doc: interpret-trailers: document comment line treatment doc: interpret-trailers: commit to “trailer block” term doc: interpret-trailers: add key format example doc: interpret-trailers: explain key format doc: interpret-trailers: explain the format after the intro doc: interpret-trailers: not just for commit messages doc: interpret-trailers: use “metadata” in Name as well doc: interpret-trailers: replace “lines” with “metadata” doc: interpret-trailers: stop fixating on RFC 822
2026-04-17Merge branch 'jt/odb-transaction-write' into seenJunio C Hamano-216/+306
ODB transaction interface is being reworked to explicitly handle object writes. Comments? * jt/odb-transaction-write: odb/transaction: make `write_object_stream()` pluggable object-file: generalize packfile writes to use odb_write_stream object-file: avoid fd seekback by checking object size upfront object-file: remove flags from transaction packfile writes odb: update `struct odb_write_stream` read() callback odb/transaction: use pluggable `begin_transaction()` odb: split `struct odb_transaction` into separate header
2026-04-17Merge branch 'ps/setup-wo-the-repository' into seenJunio C Hamano-377/+393
Many uses of the_repository has been updated to use a more appropriate struct repository instance in setup.c codepath. * ps/setup-wo-the-repository: setup: stop using `the_repository` in `init_db()` setup: stop using `the_repository` in `create_reference_database()` setup: stop using `the_repository` in `initialize_repository_version()` setup: stop using `the_repository` in `check_repository_format()` setup: stop using `the_repository` in `upgrade_repository_format()` setup: stop using `the_repository` in `setup_git_directory()` setup: stop using `the_repository` in `setup_git_directory_gently()` setup: stop using `the_repository` in `setup_git_env()` setup: stop using `the_repository` in `set_git_work_tree()` setup: stop using `the_repository` in `setup_work_tree()` setup: stop using `the_repository` in `enter_repo()` setup: stop using `the_repository` in `verify_non_filename()` setup: stop using `the_repository` in `verify_filename()` setup: stop using `the_repository` in `path_inside_repo()` setup: stop using `the_repository` in `prefix_path()` setup: stop using `the_repository` in `is_inside_git_dir()` setup: stop using `the_repository` in `is_inside_worktree()` setup: replace use of `the_repository` in static functions
2026-04-17Merge branch 'ps/graph-lane-limit' into seenJunio C Hamano-24/+311
The graph output from commands like "git log --graph" can now be limited to a specified number of lanes, preventing overly wide output in repositories with many branches. * ps/graph-lane-limit: graph: add truncation mark to capped lanes graph: add --graph-lane-limit option graph: limit the graph width to a hard-coded max
2026-04-17Merge branch 'jr/bisect-custom-terms-in-output' into seenJunio C Hamano-25/+76
"git bisect" now uses the selected terms (e.g., old/new) more consistently in its output. * jr/bisect-custom-terms-in-output: rev-parse: use selected alternate terms to look up refs bisect: use selected alternate terms in status output
2026-04-17Merge branch 'kh/name-rev-custom-format' into seenJunio C Hamano-12/+202
"git name-rev" learned to use custom format instead of the object name in an extended SHA-1 expression form. * kh/name-rev-custom-format: name-rev: learn --format=<pretty> name-rev: wrap both blocks in braces
2026-04-17Merge branch 'jc/neuter-sideband-post-3.0' into seenJunio C Hamano-8/+28
The final step, split from earlier attempt by Dscho, to loosen the sideband restriction for now and tighten later at Git v3.0 boundary. * jc/neuter-sideband-post-3.0: sideband: delay sanitizing by default to Git v3.0
2026-04-17Merge branch 'ab/clone-default-object-filter' into seenJunio C Hamano-0/+214
"git clone" learns to pay attention to "clone.<url>.defaultObjectFilter" configuration and behave as if the "--filter=<filter-spec>" option was given on the command line. * ab/clone-default-object-filter: clone: add clone.<url>.defaultObjectFilter config
2026-04-17Merge branch 'cs/subtree-split-recursion' into seenJunio C Hamano-7/+88
When processing large history graphs on Debian or Ubuntu, "git subtree" can die with a "recursion depth reached" error. Comments? * cs/subtree-split-recursion: contrib/subtree: reduce recursion during split contrib/subtree: functionalize split traversal contrib/subtree: reduce function side-effects
2026-04-17Merge branch 'tb/incremental-midx-part-3.3' into seenJunio C Hamano-156/+1792
The repacking code has been refactored and compaction of MIDX layers have been implemented, and incremental strategy that does not require all-into-one repacking has been introduced. * tb/incremental-midx-part-3.3: repack: allow `--write-midx=incremental` without `--geometric` repack: introduce `--write-midx=incremental` repack: implement incremental MIDX repacking packfile: ensure `close_pack_revindex()` frees in-memory revindex builtin/repack.c: convert `--write-midx` to an `OPT_CALLBACK` repack-geometry: prepare for incremental MIDX repacking repack-midx: extract `repack_fill_midx_stdin_packs()` repack-midx: factor out `repack_prepare_midx_command()` midx: expose `midx_layer_contains_pack()` repack: track the ODB source via existing_packs midx: support custom `--base` for incremental MIDX writes midx: introduce `--checksum-only` for incremental MIDX writes midx: use `strvec` for `keep_hashes` strvec: introduce `strvec_init_alloc()` midx: use `string_list` for retained MIDX files midx-write: handle noop writes when converting incremental chains
2026-04-17rev-parse: use selected alternate terms to look up refsJonas Rebmann-2/+38
git rev-parse --bisect does not work when alternate bisect terms are used, simply listing no revisions at all. This is because a such bisect using e.g. "old" and "new" in place of "good" and "bad" will name refs "refs/bisect/old" (or new) accordingly so the hardcoded "refs/bisect/bad" (and good) yields no results in a bisect using alternate terms. Use the current bisect_terms to make rev-parse --bisect work in an alternate term bisect. Signed-off-by: Jonas Rebmann <kernel@schlaraffenlan.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17bisect: use selected alternate terms in status outputJonas Rebmann-23/+38
Alternate bisect terms are helpful when the terms "good" and "bad" are confusing such as when bisecting for the resolution of an issue (the first good commit) rather than the introduction of a regression. These terms must be used when marking a commit (e.g. `git bisect new`), they will be used in reference names (e.g. refs/bisect/new) and they are used in parts of git's log output such as "<sha> was both old and new" in git bisect skip's output. However, hardcoded "good"/"bad" terms are still used in a few status messages and can cause confusion about the status of the bisect such as: $ git bisect old [sha] is the first bad commit or about the required action such as: status: waiting for bad commit, 1 good commit known $ git bisect bad error: Invalid command: you're currently in a new/old bisect fatal: unknown command: 'bad' This commit updates all remaining output messages which use hardcoded "good" and "bad" terms to use the selected terms consistently across the bisect output and adds tests. Signed-off-by: Jonas Rebmann <kernel@schlaraffenlan.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: detect errors outside of test casesPatrick Steinhardt-0/+14
We have recently merged a patch series that had a simple misspelling of `test_expect_success`. Instead of making our tests fail though, this typo went completely undetected and all of our tests passed, which is of course unfortunate. This is a more general issue with our test suite: all commands that run outside of a specific test case can fail, and if we don't explicitly check for such failure then this failure will be silently ignored. Improve the status quo by enabling the errexit option so that any such unchecked failures will cause us to abort immediately. Note that for now, we only enable this option for Bash 5 and newer. This is because other shells have wildly different behaviour, and older versions of Bash (especially on macOS) are buggy. The list of enabled shells may be extended going forward. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t9902: fix use of `read` with `set -e`Patrick Steinhardt-4/+2
In t9902 we're using the `read` builtin to read some values into a variable. This is done by using `-d ""`, which cause us to read until the end of the heredoc. As the read is terminated by EOF, the command will end up returning a non-zero error code. This hasn't been an issue until now as we didn't run with `set -e`, but that'll change in a subsequent commit. Prepare for this change by not using read at all, as we can simply store the multi-line value directly. Suggested-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t6002: fix use of `expr` with `set -e`Patrick Steinhardt-7/+10
In `test_bisection_diff ()` we use `expr` to perform some math. This command has some gotchas though in that it will only return success when the result is neither null nor zero. In some of our cases though it actually _is_ zero, and that will cause the expressions to fail once we enable `set -e`. Prepare for this change by instead using `$(( ))`, which doesn't have the same issue. While at it, modernize the function a tiny bit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t1301: don't fail in case setfacl(1) doesn't exist or failsPatrick Steinhardt-1/+1
In t1301 we're trying to remove any potentially-existing default ACLs that might exist on the transh directory by executing setfacl(1). According to 8ed0a740dd (t1301-shared-repo.sh: don't let a default ACL interfere with the test, 2008-10-16), this is done because we play around with permissions and umasks in this test suite. The setfacl(1) binary may not exist on some systems though, even though tests ultimately still pass. This doesn't matter currently, but will cause the test to fail once we start running with `set -e`. Silence such failures by ignoring failures here. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t0008: silence error in subshell when using `grep -v`Patrick Steinhardt-2/+2
In t0008 we use `grep -v` in a subshell, but expect that this command will sometimes not match anything. This would cause grep(1) to return an error code, but given that we don't run with `set -e` we swallow this error. We're about to enable `set -e`. Prepare for this by ignoring any errors. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: prepare `test_when_finished ()`/`test_atexit()` for `set -e`Patrick Steinhardt-2/+2
Both `test_when_finished ()` and `test_atexit ()` build up a chain of cleanup commands by prepending each new command to the existing cleanup string. To preserve the exit code of the test body across cleanup execution, we append the following logic: } && (exit "$eval_ret"); eval_ret=$?; ... The intent of this is to run the cleanup block and then unconditionally restore `eval_ret`. The original behaviour of this is is: +------------------+---------+------------------------------------+ |test body │ cleanup │ old behaviour │ +------------------+---------+------------------------------------+ │pass (eval_ret=0) | pass │ && taken -> (exit 0) -> eval_ret=0 | +------------------+---------+------------------------------------+ │pass (eval_ret=0) | fail │ && not taken -> eval_ret=$? | +------------------+---------+------------------------------------+ │fail (eval_ret=1) | pass │ && taken -> (exit 1) -> eval_ret=1 | +------------------+---------+------------------------------------+ │fail (eval_ret=1) | fail | && not taken -> eval_ret=$? | +------------------+---------+------------------------------------+ This logic will start to fail once we enable `set -e`. When `$eval_ret` is non-zero, the subshell we create will fail, and with `set -e` we'll thus bail out without evaluating the logic after the semicolon. Fix this issue by instead using `|| eval_ret=\$?; ...`. Besides being a bit simpler, it also retains the original behaviour: +------------------+---------+------------------------------------+ |test body │ cleanup │ old behaviour │ +------------------+---------+------------------------------------+ │pass (eval_ret=0) | pass │ || not taken -> eval_ret unchanged | +------------------+---------+------------------------------------+ │pass (eval_ret=0) | fail │ || taken -> eval_ret=$? | +------------------+---------+------------------------------------+ │fail (eval_ret=1) | pass │ || not taken -> eval_ret unchanged | +------------------+---------+------------------------------------+ │fail (eval_ret=1) | fail | || taken -> eval_ret=$? | +------------------+---------+------------------------------------+ Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: prepare execution of potentially failing commands for `set -e`Patrick Steinhardt-24/+24
Several of our tests verify whether a certain binary can be executed, potentially skipping tests in case we cannot, for example because the binary doesn't exist. In those cases we often run the binary outside of any conditionally. This will start to fail once we enable `set -e`, as that will cause us to bail out the test immediately. Improve these tests by executing them inside of a conditional instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: prepare conditional test execution for `set -e`Patrick Steinhardt-16/+20
We have some test in our test suite where we use the pattern of `test ... && test_expect_succeess` to conditionally execute a test. The problem is that when we decide to not execute the test, we'll indeed skip the test, but the overall statement will also be unsuccessful. This will become a problem once we enable `set -e`. Prepare for this future by turning this into a proper conditional, which is also a bit easier to read overall. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: prepare `git config --unset` calls for `set -e`Patrick Steinhardt-5/+5
We have a couple of calls to `git config --unset` that ultimately end up as no-ops as the configuration variables aren't set (anymore) in the first place. These calls are mostly intended to recover unconditionally from tests that may have executed only partially, but they'll ultimately fail during a normal test run. This hasn't been a problem until now as we aren't running tests with `set -e`. This is about to change though, so let's silence the case where we cannot unset the config keys. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: prepare `stop_git_daemon ()` for `set -e`Patrick Steinhardt-3/+5
We have a couple of calls to `stop_git_daemon ()` outside of specific test cases that will kill a backgrounded git-daemon(1) process and expect the process with a specific error code. While these function calls do end up killing git-daemon(1), the error handling we have in those contexts is basically ineffective. So while we expect the process to exit with a specific error code, we will just continue with any error in case it doesn't. This will change once we enable `set -e` in a subsequent commit. There's two issues though that will make this _always_ fail: - Our call to `wait` is expected to fail, but because it's not part of a condition it will cause us to bail out immediately with `set -e`. - We try to kill git-daemon(1) a second time via the pidfile. We can generally expect that this is the same PID though as we had in the "GIT_DAEMON_PID" environment variable, and thus it's more likely than not that we have already killed it, and the call to kill will fail. Prepare for this change by handling the failure of `wait` with `||` and by silencing failures of the second call to `kill`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: prepare `test_must_fail ()` for `set -e`Patrick Steinhardt-2/+3
The helper function `test_must_fail ()` executes a specific Git command that may or may not fail in a specific way. This is done by executing the command in question and then comparing its exit code against a set of conditions. This works, but once we run our test suite with `set -e` we may bail out of `test_must_fail ()` early in case the command actually fails, even though we expect it to fail. Prepare for this change by handling the failed case with `||`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-17t: prepare `test_match_signal ()` calls for `set -e`Patrick Steinhardt-3/+3
We have a couple of calls to `test_match_signal ()` where we execute a Git command and expect it to die with a specific signal. These calls will essentially execute the process in a subshell via `foo; echo $?`, but as we expect `foo` to fail this will cause the overall subshell to fail once we `set -e`. Fix this issue by using `foo && echo 0 || echo $?` instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-16Merge branch 'th/promisor-quiet-per-repo' into jchjchJunio C Hamano-2/+45
The "promisor.quiet" configuration variable was not used from relevant submodules when commands like "grep --recurse-submodules" triggered a lazy fetch, which has been corrected. Comments? * th/promisor-quiet-per-repo: promisor-remote: fix promisor.quiet to use the correct repository
2026-04-16Merge branch 'jt/config-lock-timeout' into jchJunio C Hamano-2/+12
The code path to update the configuration file has been taught to use a short timeout to retry. * jt/config-lock-timeout: config: retry acquiring config.lock for 100ms
2026-04-16Merge branch 'cl/conditional-config-on-worktree-path' into jchJunio C Hamano-11/+130
The [includeIf "condition"] conditional inclusion facility for configuration files has learned to use the location of worktree in its condition. Comments? * cl/conditional-config-on-worktree-path: config: add "worktree" and "worktree/i" includeIf conditions config: refactor include_by_gitdir() into include_by_path()
2026-04-16Merge branch 'ds/fetch-negotiation-options' into jchJunio C Hamano-44/+489
The negotiation tip options in "git fetch" have been reworked to allow requiring certain refs to be sent as "have" lines, and to restrict negotiation to a specific set of refs. * ds/fetch-negotiation-options: send-pack: pass negotiation config in push remote: add negotiationRequire config as default for --negotiation-require fetch: add --negotiation-require option for negotiation remote: add remote.*.negotiationRestrict config transport: rename negotiation_tips fetch: add --negotiation-restrict option t5516: fix test order flakiness
2026-04-16Merge branch 'sa/cat-file-batch-mailmap-switch' into jchJunio C Hamano-4/+143
"git cat-file --batch" learns an in-line command "mailmap" that lets the user toggle use of mailmap. * sa/cat-file-batch-mailmap-switch: cat-file: add mailmap subcommand to --batch-command
2026-04-16Merge branch 'ua/push-remote-group' into jchJunio C Hamano-0/+3
"git push" learned to take a "remote group" name to push to, which causes pushes to multiple places, just like "git fetch" would do. * ua/push-remote-group: SQUASH??? - futureproof against the attack of the "main"
2026-04-16Merge branch 'ua/push-remote-group' (early part) into jchJunio C Hamano-83/+355
* 'ua/push-remote-group' (early part): push: support pushing to a remote group remote: move remote group resolution to remote.c