Re: [PATCH v3] checkout: avoid unnecessary match_pathspec calls
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:34
Nguyễn Thái Ngọc Duy [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/t/t2022-checkout-paths.sh b/t/t2022-checkout-paths.sh index 56090d2..5e01d58 100755 --- a/t/t2022-checkout-paths.sh +++ b/t/t2022-checkout-paths.sh@@ -39,4 +39,25 @@ test_expect_success 'checking out paths out of a tree does not clobber unrelated test_cmp expect.next2 dir/next2 ' +test_expect_success 'do not touch unmerged entries matching $path but not in $tree' ' + git checkout next && + git reset --hard && + + cat dir/common >expect.common && + EMPTY_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 &&
EMPTY_SHA1=$(git hash-object -w --stdin </dev/null)
+ git rm dir/next0 && + cat >expect.next0<<EOF && +100644 $EMPTY_SHA1 1 dir/next0 +100644 $EMPTY_SHA1 2 dir/next0 +EOF + git update-index --index-info < expect.next0 &&
cat >expect.next0 <<-EOF &&
100644 $EMPTY_SHA1 1 dir/next0
100644 $EMPTY_SHA1 2 dir/next0
EOF
git update-index --index-info <expect.next0 &&
+ + git checkout master dir && + + test_cmp expect.common dir/common && + test_path_is_file dir/master && + git diff --exit-code master dir/master && + git ls-files -s dir/next0 >actual.next0 +'
... and actual.next0 is checked against what? Ending this test with git ls-files -s dir/next0 >actual.next0 && test_cmp expect.next0 actual.next0 would be sufficient, methinks. Will replace v2 with the above fixups. Thanks.
+ test_done