summaryrefslogtreecommitdiff
path: root/t
AgeCommit message (Collapse)AuthorFilesLines
2022-03-17hook tests: turn exit code assertions into a loopLibravatar Ævar Arnfjörð Bjarmason1-25/+10
Amend a test added in 96e7225b310 (hook: add 'run' subcommand, 2021-12-22) to use a for-loop instead of a copy/pasting the same test for the four exit codes we test. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-17test-lib-functions: add and use a "test_hook" wrapperLibravatar Ævar Arnfjörð Bjarmason13-43/+97
Add a "test_hook" wrapper similar to the existing "test_config" wrapper added in d960c47a881 (test-lib: add helper functions for config, 2011-08-17). This wrapper: - Will clean up the hook with "test_when_finished", unless --setup is provided. - Will error if we clobber a hook, unless --clobber is provided. - Takes a name like "update" instead of ".git/hooks/update". - Accepts -C <dir>, like "test_config" and "test_commit". By using a wrapper we'll be able to easily change all the hook-related code that assumes that the template-created ".git/hooks" directory is created by "init", "clone" etc. once another topic follows-up and changes the test suite to stop creating trash directories using those templates. In addition this will make it easy to have the hooks configured using the "configuration-based hooks" topic, once we get around to integrating that. I.e. we'll be able to run the tests in a mode where we sometimes create a .git/hooks/<name>, and other times create a script in another location, and point the relevant configuration snippet to it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-16Merge branch 'ab/string-list-count-in-size-t'Libravatar Junio C Hamano1-3/+4
Count string_list items in size_t, not "unsigned int". * ab/string-list-count-in-size-t: string-list API: change "nr" and "alloc" to "size_t" gettext API users: don't explicitly cast ngettext()'s "n"
2022-03-16Merge branch 'ab/keep-git-exit-codes-in-tests'Libravatar Junio C Hamano19-218/+245
Updates tests around the use of "test $(git cmd) = constant". * ab/keep-git-exit-codes-in-tests: rev-list simplify tests: don't ignore "git" exit code checkout tests: don't ignore "git <cmd>" exit code apply tests: don't ignore "git ls-files" exit code, drop sub-shell gettext tests: don't ignore "test-tool regex" exit code rev-list tests: don't hide abort() in "test_expect_failure" diff tests: don't ignore "git rev-list" exit code notes tests: don't ignore "git" exit code rev-parse tests: don't ignore "git reflog" exit code merge tests: use "test_must_fail" instead of ad-hoc pattern apply tests: use "test_must_fail" instead of ad-hoc pattern diff tests: don't ignore "git diff" exit code in "read" loop diff tests: don't ignore "git diff" exit code read-tree tests: check "diff-files" exit code on failure tests: use "test_stdout_line_count", not "test $(git [...] | wc -l)" tests: change some 'test $(git) = "x"' to test_cmp
2022-03-16Merge branch 'tk/t7063-chmtime-dirs-too'Libravatar Junio C Hamano1-12/+9
Teach "test-chmtime" to work on a directory and use it to avoid having to wait for a second in a few places in tests. * tk/t7063-chmtime-dirs-too: t7063: mtime-mangling instead of delays in untracked cache testing t/helper/test-chmtime: update mingw to support chmtime on directories
2022-03-16Merge branch 'ds/commit-graph-gen-v2-fixes'Libravatar Junio C Hamano6-50/+153
Fixes to the way generation number v2 in the commit-graph files are (not) handled. * ds/commit-graph-gen-v2-fixes: commit-graph: declare bankruptcy on GDAT chunks commit-graph: fix generation number v2 overflow values commit-graph: start parsing generation v2 (again) commit-graph: fix ordering bug in generation numbers t5318: extract helpers to lib-commit-graph.sh test-read-graph: include extra post-parse info
2022-03-16Merge branch 'jc/stash-drop'Libravatar Junio C Hamano1-1/+42
"git stash drop" is reimplemented as an internal call to reflog_delete() function, instead of invoking "git reflog delete" via run_command() API. * jc/stash-drop: stash: call reflog_delete() in reflog.c reflog: libify delete reflog function and helpers stash: add tests to ensure reflog --rewrite --updatref behavior
2022-03-16Merge branch 'tb/rename-remote-progress'Libravatar Junio C Hamano1-1/+3
"git remote rename A B", depending on the number of remote-tracking refs involved, takes long time renaming them. The command has been taught to show progress bar while making the user wait. * tb/rename-remote-progress: builtin/remote.c: show progress when renaming remote references builtin/remote.c: parse options in 'rename'
2022-03-16Merge branch 'vd/sparse-read-tree'Libravatar Junio C Hamano3-0/+144
"git read-tree" has been made to be aware of the sparse-index feature. * vd/sparse-read-tree: read-tree: make three-way merge sparse-aware read-tree: make two-way merge sparse-aware read-tree: narrow scope of index expansion for '--prefix' read-tree: integrate with sparse index read-tree: expand sparse checkout test coverage read-tree: explicitly disallow prefixes with a leading '/' status: fix nested sparse directory diff in sparse index sparse-index: prevent repo root from becoming sparse
2022-03-16Merge branch 'tk/empty-untracked-cache'Libravatar Junio C Hamano1-0/+7
The untracked cache newly computed weren't written back to the on-disk index file when there is no other change to the index, which has been corrected. * tk/empty-untracked-cache: untracked-cache: write index when populating empty untracked cache t7519: populate untracked cache before test t7519: avoid file to index mtime race for untracked cache
2022-03-16Merge branch 'ab/grep-patterntype'Libravatar Junio C Hamano1-1/+0
Test fix-up for a topic already in master. * ab/grep-patterntype: log tests: fix "abort tests early" regression in ff37a60c369
2022-03-13Merge branch 'ps/fetch-atomic-fixup'Libravatar Junio C Hamano1-15/+5
Test simplification. * ps/fetch-atomic-fixup: t5503: simplify setup of test which exercises failure of backfill
2022-03-13Merge branch 'fs/gpgsm-update'Libravatar Junio C Hamano2-7/+7
Newer version of GPGSM changed its output in a backward incompatible way to break our code that parses its output. It also added more processes our tests need to kill when cleaning up. Adjustments have been made to accommodate these changes. * fs/gpgsm-update: t/lib-gpg: kill all gpg components, not just gpg-agent t/lib-gpg: reload gpg components after updating trustlist gpg-interface/gpgsm: fix for v2.3
2022-03-13Merge branch 'ab/make-optim-noop'Libravatar Junio C Hamano3-0/+9
Makefile refactoring with a bit of suffixes rule stripping to optimize the runtime overhead. * ab/make-optim-noop: Makefiles: add and use wildcard "mkdir -p" template Makefile: add "$(QUIET)" boilerplate to shared.mak Makefile: move $(comma), $(empty) and $(space) to shared.mak Makefile: move ".SUFFIXES" rule to shared.mak Makefile: define $(LIB_H) in terms of $(FIND_SOURCE_FILES) Makefile: disable GNU make built-in wildcard rules Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to it scalar Makefile: use "The default target of..." pattern
2022-03-13Merge branch 'ps/fetch-atomic'Libravatar Junio C Hamano2-0/+103
"git fetch" can make two separate fetches, but ref updates coming from them were in two separate ref transactions under "--atomic", which has been corrected. * ps/fetch-atomic: fetch: make `--atomic` flag cover pruning of refs fetch: make `--atomic` flag cover backfilling of tags refs: add interface to iterate over queued transactional updates fetch: report errors when backfilling tags fails fetch: control lifecycle of FETCH_HEAD in a single place fetch: backfill tags before setting upstream fetch: increase test coverage of fetches
2022-03-09Merge branch 'ab/help-fixes'Libravatar Junio C Hamano1-0/+94
Updates to how command line options to "git help" are handled. * ab/help-fixes: help: don't print "\n" before single-section output help: add --no-[external-commands|aliases] for use with --all help: error if [-a|-g|-c] and [-i|-m|-w] are combined help: correct usage & behavior of "git help --all" help: note the option name on option incompatibility help.c: split up list_all_cmds_help() function help tests: test "git" and "git help [-a|-g] spacing help.c: use puts() instead of printf{,_ln}() for consistency help doc: add missing "]" to "[-a|--all]"
2022-03-09Merge branch 'jc/cat-file-batch-commands'Libravatar Junio C Hamano1-6/+129
"git cat-file" learns "--batch-command" mode, which is a more flexible interface than the existing "--batch" or "--batch-check" modes, to allow different kinds of inquiries made. * jc/cat-file-batch-commands: cat-file: add --batch-command mode cat-file: add remove_timestamp helper cat-file: introduce batch_mode enum to replace print_contents cat-file: rename cmdmode to transform_mode
2022-03-09Merge branch 'en/present-despite-skipped'Libravatar Junio C Hamano7-80/+83
In sparse-checkouts, files mis-marked as missing from the working tree could lead to later problems. Such files were hard to discover, and harder to correct. Automatically detecting and correcting the marking of such files has been added to avoid these problems. * en/present-despite-skipped: repo_read_index: add config to expect files outside sparse patterns Accelerate clear_skip_worktree_from_present_files() by caching Update documentation related to sparsity and the skip-worktree bit repo_read_index: clear SKIP_WORKTREE bit from files present in worktree unpack-trees: fix accidental loss of user changes t1011: add testcase demonstrating accidental loss of user modifications
2022-03-07rev-list simplify tests: don't ignore "git" exit codeLibravatar Ævar Arnfjörð Bjarmason1-5/+7
Change a fragile test pattern introduced in 65347030590 (Topo-sort before --simplify-merges, 2008-08-03) to check the exit code of both "git name-rev" and "git log". This test as a whole would fail under SANITIZE=leak, but we'd pass several "failing" tests due to hiding these exit codes before we'd spot git dying with abort(). Now we'll instead spot all of the failures. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07checkout tests: don't ignore "git <cmd>" exit codeLibravatar Ævar Arnfjörð Bjarmason1-16/+35
Change a fragile pattern introduced in 696acf45f96 (checkout: implement "-" abbreviation, add docs and tests, 2009-01-17) to check the exit code of both "git symbolic-ref" and "git rev-parse". Without this change this test will become flaky e.g. under SANITIZE=leak if some (but not all) memory leaks revealed by these commands are fixed. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07apply tests: don't ignore "git ls-files" exit code, drop sub-shellLibravatar Ævar Arnfjörð Bjarmason1-1/+2
Fix code added in 969c877506c (git apply --directory broken for new files, 2008-10-12) so that it doesn't invoke "git ls-files" on the left-hand-side of a pipe, instead let's use an intermediate file. Since we're doing that we can also drop the sub-shell that was here to group the two. There are a lot of these sorts of patterns in the test suite, and there's no particular reason to fix this one other than in a preceding commit all similar patterns except this one were fixed in "t/t4128-apply-root.sh", so let's fix this one straggler as well. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07gettext tests: don't ignore "test-tool regex" exit codeLibravatar Ævar Arnfjörð Bjarmason1-3/+13
Amend a prerequisite check added in 5c1ebcca4d1 (grep/icase: avoid kwsset on literal non-ascii strings, 2016-06-25) to do invoke 'test-tool regex' in such a way that we'll notice if it dies under SANITIZE=leak due to having a memory leak, as opposed to us not having the "ICASE" support we're checking for. Because we weren't making a distinction between the two I'd marked these tests as passing under SANITIZE=leak in 03d85e21951 (leak tests: mark remaining leak-free tests as such, 2021-12-17). Doing this is tricky. Ideally "test_lazy_prereq" would materialize as a "real" test that we could check the exit code of with the same signal matching that "test_must_fail" does. However lazy prerequisites aren't real tests, and are instead lazily materialized in the guts of "test_have_prereq" when we've already started another test. We could detect the abort() (or similar) there and pass that exit code down, and fail the test that caused the prerequisites to be materialized. But that would require extensive changes to test-lib.sh and test-lib-functions.sh. Let's instead simply check if the exit code of "test-tool regex" is zero, and if so set the prerequisites. If it's non-zero let's run it again with "test_must_fail". We'll thus make a distinction between "bad" non-zero (segv etc) and "good" (exit 1 etc.). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07rev-list tests: don't hide abort() in "test_expect_failure"Libravatar Ævar Arnfjörð Bjarmason1-4/+9
Change a couple of uses of "test_expect_failure" to use a "test_expect_success" to positively assert the current behavior, and replace the intent of "test_expect_failure" with a "TODO" comment int the description. As noted in [1] the "test_expect_failure" feature is overly eager to accept any failure as OK, and thus by design hides segfaults, abort() etc. Because of that I didn't notice in dd9cede9136 (leak tests: mark some rev-list tests as passing with SANITIZE=leak, 2021-10-31) that this test leaks memory under SANITIZE=leak. I have some larger local changes to add a better "test_expect_failure", which would work just like "test_expect_success", but would allow us say "test_todo" here (and "success" would emit a "not ok [...] # TODO", not "ok [...]". So even though using "test_expect_success" here comes with its own problems[2], let's use it as a narrow change to fix the problem at hand here and stop conflating the current "success" with actual SANITIZE=leak failures. 1. https://lore.kernel.org/git/87tuhmk19c.fsf@evledraar.gmail.com/ 2. https://lore.kernel.org/git/xmqq4k9kj15p.fsf@gitster.g/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07diff tests: don't ignore "git rev-list" exit codeLibravatar Ævar Arnfjörð Bjarmason1-5/+2
Change a fragile pattern introduced in 2b459b483cb (diff: make sure work tree side is shown as 0{40} when different, 2008-03-02) to check the exit code of "git rev-list", while we're at it let's get rid of the needless sub-shell for invoking it in favor of the "-C" option. Because of this I'd marked these tests as passing under SANITIZE=leak in 16d4bd4f14e (leak tests: mark some diff tests as passing with SANITIZE=leak, 2021-10-31), let's remove the "TEST_PASSES_SANITIZE_LEAK=true" annotation as they no longer do. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07notes tests: don't ignore "git" exit codeLibravatar Ævar Arnfjörð Bjarmason3-15/+14
Change a fragile test pattern that's been with us ever since these tests were introduced in [1], [2] and [3] to properly return the exit code of the failing command on failure. Because of this I'd marked this test as passing under SANITIZE=leak in [4] and [5]. We need to remove those annotations as these tests will no longer pass. 1. 9081a421a6d (checkout: fix "branch info" memory leaks, 2021-11-16) 2. 0057c0917d3 (Add selftests verifying that we can parse notes trees with various fanouts, 2009-10-09) 3. 048cdd4665e (t3305: Verify that adding many notes with git-notes triggers increased fanout, 2010-02-13) 4. ca089724952 (leak tests: mark some notes tests as passing with SANITIZE=leak, 2021-10-31) 5. 9081a421a6d (checkout: fix "branch info" memory leaks, 2021-11-16) Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07rev-parse tests: don't ignore "git reflog" exit codeLibravatar Ævar Arnfjörð Bjarmason1-2/+3
Amend a test added in 9c46c054ae4 (rev-parse: tests git rev-parse --verify master@{n}, for various n, 2010-08-24) so that we'll stop ignoring the exit code of "git reflog" by having it on the left-hand-side of a pipe. Because of this I'd marked this test as passing under SANITIZE=leak in f442c94638d (leak tests: mark some rev-parse tests as passing with SANITIZE=leak, 2021-10-31). As all of it except this specific test will now pass, let's skip it under the !SANITIZE_LEAK prerequisite. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07merge tests: use "test_must_fail" instead of ad-hoc patternLibravatar Ævar Arnfjörð Bjarmason1-16/+6
As in the preceding commit change a similar fragile test pattern introduced in b798671fa93 (merge-recursive: do not rudely die on binary merge, 2007-08-14) to use a "test_must_fail" instead. Before this we wouldn't distinguish normal "git merge" failures from segfaults or abort(). Unlike the preceding commit we didn't end up hiding any SANITIZE=leak failures in this case, but let's correspondingly change these anyway. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07apply tests: use "test_must_fail" instead of ad-hoc patternLibravatar Ævar Arnfjörð Bjarmason1-16/+2
Change a fragile test pattern introduced in 6b763c424e4 (git-apply: do not read past the end of buffer, 2007-09-05). Before this we wouldn't distinguish normal "git apply" failures from segfaults or abort(). I'd previously marked this test as passing under SANITIZE=leak in f54f48fc074 (leak tests: mark some apply tests as passing with SANITIZE=leak, 2021-10-31). Let's remove that annotation as this test will no longer pass. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07diff tests: don't ignore "git diff" exit code in "read" loopLibravatar Ævar Arnfjörð Bjarmason1-51/+53
Fix a test pattern that originated in f1af60bdba4 (Support 'diff=pgm' attribute, 2007-04-22) so that we'll stop using "git diff" on the left-hand-side of a pipe, and thus ignoring its exit code. Rather than use intermediate files let's rewrite these tests to a much simpler but more exhaustive "test_tmp" where we'll ignore certain fields in the output. Note that this is not a faithful conversion of the previous "read/test" in some cases, as we were ignoring more fields there than we strictly needed to. Now we'll "test_cmp" everything we can, and only ignore the likes of paths to $TEMPDIR etc. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07diff tests: don't ignore "git diff" exit codeLibravatar Ævar Arnfjörð Bjarmason1-27/+22
Fix a test pattern that originated in f1af60bdba4 (Support 'diff=pgm' attribute, 2007-04-22) so that we'll stop using "git diff" on the left-hand-side of a pipe, and thus ignoring its exit code. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07read-tree tests: check "diff-files" exit code on failureLibravatar Ævar Arnfjörð Bjarmason2-6/+6
Fix an issue with the exit code of "diff-files" being ignored, which has been ignored ever since these tests were originally added in c859600954d ([PATCH] read-tree: save more user hassles during fast-forward., 2005-06-07). Since the exit code was ignored we'd hide errors here under SANITIZE=leak, which resulted in me mistakenly marking these tests as passing under SANITIZE=leak in e5a917fcf42 (unpack-trees: don't leak memory in verify_clean_subdirectory(), 2021-10-07) and 4ea08416b8e (leak tests: mark a read-tree test as passing SANITIZE=leak, 2021-10-31). As it would be non-trivial to fix these tests (the leak is in revision.c) let's un-mark them as passing under SANITIZE=leak in addition to fixing the issue of ignoring the exit code. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07tests: use "test_stdout_line_count", not "test $(git [...] | wc -l)"Libravatar Ævar Arnfjörð Bjarmason1-22/+21
Use the test_stdout_line_count helper added in cdff1bb5a3d (test-lib-functions: introduce test_stdout_line_count, 2021-07-04) so that we'll spot if git itself dies, segfaults etc in these expressions. Because we didn't distinguish these failure conditions before I'd mistakenly marked these tests as passing under SANITIZE=leak in dd9cede9136 (leak tests: mark some rev-list tests as passing with SANITIZE=leak, 2021-10-31). While we're at it let's re-indent these lines to match our usual style, as we're having to change all of them anyway. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07tests: change some 'test $(git) = "x"' to test_cmpLibravatar Ævar Arnfjörð Bjarmason4-29/+50
Change some of the patterns in the test suite where we were hiding the exit code from "git" by invoking it in a sub-shell within a "test" expression to use temporary files and test_cmp instead. These are not all the occurrences of this anti-pattern, but these in particular hid issues where LSAN was dying, and I'd thus marked these tests as passing under the linux-leaks CI job in past commits with "TEST_PASSES_SANITIZE_LEAK=true". Let's deal with that by either removing that marking, or skipping specific tests under !SANITIZE_LEAK. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07string-list API: change "nr" and "alloc" to "size_t"Libravatar Ævar Arnfjörð Bjarmason1-3/+4
Change the "nr" and "alloc" members of "struct string_list" to use "size_t" instead of "nr". On some platforms the size of an "unsigned int" will be smaller than a "size_t", e.g. a 32 bit unsigned v.s. 64 bit unsigned. As "struct string_list" is a generic API we use in a lot of places this might cause overflows. As one example: code in "refs.c" keeps track of the number of refs with a "size_t", and auxiliary code in builtin/remote.c in get_ref_states() appends those to a "struct string_list". While we're at it split the "nr" and "alloc" in string-list.h across two lines, which is the case for most such struct member declarations (e.g. in "strbuf.h" and "strvec.h"). Changing e.g. "int i" to "size_t i" in run_and_feed_hook() isn't strictly necessary, and there are a lot more cases where we'll use a local "int", "unsigned int" etc. variable derived from the "nr" in the "struct string_list". But in that case as well as add_wrapped_shortlog_msg() in builtin/shortlog.c we need to adjust the printf format referring to "nr" anyway, so let's also change the other variables referring to it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-06Merge branch 'jt/ls-files-stage-recurse'Libravatar Junio C Hamano1-1/+17
Many output modes of "ls-files" do not work with its "--recurse-submodules" option, but the "-s" mode has been taught to work with it. * jt/ls-files-stage-recurse: ls-files: support --recurse-submodules --stage
2022-03-06Merge branch 'gc/stash-on-branch-with-multi-level-name'Libravatar Junio C Hamano1-0/+11
"git checkout -b branch/with/multi/level/name && git stash" only recorded the last level component of the branch name, which has been corrected. * gc/stash-on-branch-with-multi-level-name: stash: strip "refs/heads/" with skip_prefix
2022-03-06Merge branch 'ah/advice-switch-requires-detach-to-detach'Libravatar Junio C Hamano1-0/+11
The error message given by "git switch HEAD~4" has been clarified to suggest the "--detach" option that is required. * ah/advice-switch-requires-detach-to-detach: switch: mention the --detach option when dying due to lack of a branch
2022-03-06Merge branch 'mc/index-pack-report-max-size'Libravatar Junio C Hamano1-0/+8
When "index-pack" dies due to incoming data exceeding the maximum allowed input size, include the value of the limit in the error message. * mc/index-pack-report-max-size: index-pack: clarify the breached limit
2022-03-06Merge branch 'ac/usage-string-fixups'Libravatar Junio C Hamano1-3/+3
Usage-string normalization. * ac/usage-string-fixups: amend remaining usage strings according to style guide
2022-03-06Merge branch 'ab/test-leak-diag'Libravatar Junio C Hamano1-10/+40
Random test-framework clean-up. * ab/test-leak-diag: test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS test-lib: make $GIT_BUILD_DIR an absolute path test-lib: correct and assert TEST_DIRECTORY overriding test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS
2022-03-06Merge branch 'ab/hook-tests'Libravatar Junio C Hamano1-41/+53
Test modernization. * ab/hook-tests: hook tests: use a modern style for "pre-push" tests hook tests: test for exact "pre-push" hook input
2022-03-06Merge branch 'rs/bisect-executable-not-found'Libravatar Junio C Hamano1-0/+45
A not-so-common mistake is to write a script to feed "git bisect run" without making it executable, in which case all tests will exit with 126 or 127 error codes, even on revisions that are marked as good. Try to recognize this situation and stop iteration early. * rs/bisect-executable-not-found: bisect--helper: double-check run command on exit code 126 and 127 bisect: document run behavior with exit codes 126 and 127 bisect--helper: release strbuf and strvec on run error bisect--helper: report actual bisect_state() argument on error
2022-03-06Merge branch 'en/sparse-checkout-fixes'Libravatar Junio C Hamano1-2/+88
Further polishing of "git sparse-checkout". * en/sparse-checkout-fixes: sparse-checkout: reject arguments in cone-mode that look like patterns sparse-checkout: error or warn when given individual files sparse-checkout: pay attention to prefix for {set, add} sparse-checkout: correctly set non-cone mode when expected sparse-checkout: correct reapply's handling of options
2022-03-06Merge branch 'cg/t3903-modernize'Libravatar Junio C Hamano2-9/+41
Test modernization. * cg/t3903-modernize: tests: make the code more readable tests: allow testing if a path is truly a file or a directory t/t3903-stash.sh: replace test [-d|-f] with test_path_is_*
2022-03-04t/lib-gpg: kill all gpg components, not just gpg-agentLibravatar Todd Zullinger1-1/+1
The gpg-agent is one of several processes that newer releases of GnuPG start automatically. Issue a kill to each of them to ensure they do not affect separate tests. (Yes, the separate GNUPGHOME should do that already. If we find that is case, we could drop the --kill entirely.) In terms of compatibility, the 'all' keyword was added to the --kill & --reload options in GnuPG 2.1.18. Debian and RHEL are often used as indicators of how a change might affect older systems we often try to support. - Debian Strech (old old stable), which has limited security support until June 2022, has GnuPG 2.1.18 (or 2.2.x in backports). - CentOS/RHEL 7, which is supported until June 2024, has GnuPG 2.0.22, which lacks the --kill option, so the change won't have any impact. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-04t/lib-gpg: reload gpg components after updating trustlistLibravatar Todd Zullinger1-0/+1
With gpgsm from gnupg-2.3, the changes to the trustlist.txt do not appear to be picked up without refreshing the gpg-agent. Use the 'all' keyword to reload all of the gpg components. The scdaemon is started as a child of gpg-agent, for example. We used to have a --kill at this spot, but I removed it in 2e285e7803 (t/lib-gpg: drop redundant killing of gpg-agent, 2019-02-07). It seems like it might be necessary (again) for 2.3. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-04gpg-interface/gpgsm: fix for v2.3Libravatar Fabian Stelzer2-6/+5
Checking if signing was successful will now accept '[GNUPG]: SIG_CREATED' on the beginning of the first or any subsequent line. Not just explictly the second one anymore. Gpgsm v2.3 changed its output when listing keys from `fingerprint` to `sha1/2 fpr`. This leads to the gpgsm tests silently not being executed because of a failed prerequisite. Switch to gpg's `--with-colons` output format when evaluating test prerequisites to make parsing more robust. This also allows us to combine the existing grep/cut/tr/echo pipe for writing the trustlist.txt into a single awk expression. Adjust error message checking in test for v2.3 specific output changes. Helped-By: Junio C Hamano <gitster@pobox.com> Helped-By: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-04log tests: fix "abort tests early" regression in ff37a60c369Libravatar Ævar Arnfjörð Bjarmason1-1/+0
Fix a regression in ff37a60c369 (log tests: check if grep_config() is called by "log"-like cmds, 2022-02-16), a "test_done" command used during development made it into a submitted patch causing tests 41-136 in t/t4202-log.sh to be skipped. Reported-by: Fabian Stelzer <fs@gigacodes.de> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-03builtin/remote.c: show progress when renaming remote referencesLibravatar Taylor Blau1-1/+3
When renaming a remote, Git needs to rename all remote tracking references to the remote's new name (e.g., renaming "refs/remotes/old/foo" to "refs/remotes/new/foo" when renaming a remote from "old" to "new"). This can be somewhat slow when there are many references to rename, since each rename is done in a separate call to rename_ref() as opposed to grouping all renames together into the same transaction. It would be nice to execute all renames as a single transaction, but there is a snag: the reference transaction backend doesn't support renames during a transaction (only individually, via rename_ref()). The reasons there are described in more detail in [1], but the main problem is that in order to preserve the existing reflog, it must be moved while holding both locks (i.e., on "oldname" and "newname"), and the ref transaction code doesn't support inserting arbitrary actions into the middle of a transaction like that. As an aside, adding support for this to the ref transaction code is less straightforward than inserting both a ref_update() and ref_delete() call into the same transaction. rename_ref()'s special handling to detect D/F conflicts would need to be rewritten for the transaction code if we wanted to proactively catch D/F conflicts when renaming a reference during a transaction. The reftable backend could support this much more readily because of its lack of D/F conflicts. Instead of a more complex modification to the ref transaction code, display a progress meter when running verbosely in order to convince the user that Git is doing work while renaming a remote. This is mostly done as-expected, with the minor caveat that we intentionally count symrefs renames twice, since renaming a symref takes place over two separate calls (one to delete the old one, and another to create the new one). [1]: https://lore.kernel.org/git/572367B4.4050207@alum.mit.edu/ Suggested-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-03t5503: simplify setup of test which exercises failure of backfillLibravatar Patrick Steinhardt1-15/+5
In the testcase to exercise backfilling of tags for fetches we evoke a failure of the backfilling mechanism by creating a reference that later on causes a D/F conflict. Because the assumption was that git-fetch(1) would notice the D/F conflict early on this conflicting reference was created via the reference-transaction hook just when we were about to write the backfilled tag. As it turns out though this is not the case, and the fetch fails in the same way when we create the conflicting ref up front. Simplify the test setup creating the reference up front, which allows us to get rid of the hook script. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>