summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-08-01 16:58:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-08-01 16:58:38 (GMT)
commitacdb1e1053c5bc0832866780bb517f7465aea7a2 (patch)
treeba5bbd70486f552d70d8833d684ec8831dcc09c9 /t
parentf0f9a033ed3c053b6cff33fd0aed59aed1e8dc00 (diff)
parent611c7785e8e22637e183333c54ed266e6e83e163 (diff)
downloadgit-acdb1e1053c5bc0832866780bb517f7465aea7a2.zip
git-acdb1e1053c5bc0832866780bb517f7465aea7a2.tar.gz
git-acdb1e1053c5bc0832866780bb517f7465aea7a2.tar.bz2
Merge branch 'mt/checkout-count-fix'
"git checkout" miscounted the paths it updated, which has been corrected. source: <cover.1657799213.git.matheus.bernardino@usp.br> * mt/checkout-count-fix: checkout: fix two bugs on the final count of updated entries checkout: show bug about failed entries being included in final report checkout: document bug where delayed checkout counts entries twice
Diffstat (limited to 't')
-rw-r--r--t/lib-parallel-checkout.sh6
-rwxr-xr-xt/t0021-conversion.sh22
-rwxr-xr-xt/t2080-parallel-checkout-basics.sh48
3 files changed, 75 insertions, 1 deletions
diff --git a/t/lib-parallel-checkout.sh b/t/lib-parallel-checkout.sh
index 83b279a..acaee9c 100644
--- a/t/lib-parallel-checkout.sh
+++ b/t/lib-parallel-checkout.sh
@@ -25,7 +25,11 @@ test_checkout_workers () {
local trace_file=trace-test-checkout-workers &&
rm -f "$trace_file" &&
- GIT_TRACE2="$(pwd)/$trace_file" "$@" 2>&8 &&
+ (
+ GIT_TRACE2="$(pwd)/$trace_file" &&
+ export GIT_TRACE2 &&
+ "$@" 2>&8
+ ) &&
local workers="$(grep "child_start\[..*\] git checkout--worker" "$trace_file" | wc -l)" &&
test $workers -eq $expected_workers &&
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index bad37ab..1c84034 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -1132,4 +1132,26 @@ do
'
done
+test_expect_success PERL 'delayed checkout correctly reports the number of updated entries' '
+ rm -rf repo &&
+ git init repo &&
+ (
+ cd repo &&
+ git config filter.delay.process "../rot13-filter.pl delayed.log clean smudge delay" &&
+ git config filter.delay.required true &&
+
+ echo "*.a filter=delay" >.gitattributes &&
+ echo a >test-delay10.a &&
+ echo a >test-delay11.a &&
+ git add . &&
+ git commit -m files &&
+
+ rm *.a &&
+ git checkout . 2>err &&
+ grep "IN: smudge test-delay10.a .* \\[DELAYED\\]" delayed.log &&
+ grep "IN: smudge test-delay11.a .* \\[DELAYED\\]" delayed.log &&
+ grep "Updated 2 paths from the index" err
+ )
+'
+
test_done
diff --git a/t/t2080-parallel-checkout-basics.sh b/t/t2080-parallel-checkout-basics.sh
index 3e0f8c6..c683e60 100755
--- a/t/t2080-parallel-checkout-basics.sh
+++ b/t/t2080-parallel-checkout-basics.sh
@@ -226,4 +226,52 @@ test_expect_success SYMLINKS 'parallel checkout checks for symlinks in leading d
)
'
+# This test is here (and not in e.g. t2022-checkout-paths.sh), because we
+# check the final report including sequential, parallel, and delayed entries
+# all at the same time. So we must have finer control of the parallel checkout
+# variables.
+test_expect_success PERL '"git checkout ." report should not include failed entries' '
+ write_script rot13-filter.pl "$PERL_PATH" \
+ <"$TEST_DIRECTORY"/t0021/rot13-filter.pl &&
+
+ test_config_global filter.delay.process \
+ "\"$(pwd)/rot13-filter.pl\" --always-delay delayed.log clean smudge delay" &&
+ test_config_global filter.delay.required true &&
+ test_config_global filter.cat.clean cat &&
+ test_config_global filter.cat.smudge cat &&
+ test_config_global filter.cat.required true &&
+
+ set_checkout_config 2 0 &&
+ git init failed_entries &&
+ (
+ cd failed_entries &&
+ cat >.gitattributes <<-EOF &&
+ *delay* filter=delay
+ parallel-ineligible* filter=cat
+ EOF
+ echo a >missing-delay.a &&
+ echo a >parallel-ineligible.a &&
+ echo a >parallel-eligible.a &&
+ echo b >success-delay.b &&
+ echo b >parallel-ineligible.b &&
+ echo b >parallel-eligible.b &&
+ git add -A &&
+ git commit -m files &&
+
+ a_blob="$(git rev-parse :parallel-ineligible.a)" &&
+ rm .git/objects/$(test_oid_to_path $a_blob) &&
+ rm *.a *.b &&
+
+ test_checkout_workers 2 test_must_fail git checkout . 2>err &&
+
+ # All *.b entries should succeed and all *.a entries should fail:
+ # - missing-delay.a: the delay filter will drop this path
+ # - parallel-*.a: the blob will be missing
+ #
+ grep "Updated 3 paths from the index" err &&
+ test_stdout_line_count = 3 ls *.b &&
+ ! ls *.a
+ )
+'
+
test_done