summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-04-03 09:34:00 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-04-03 09:34:00 -0700
commit97fefaf6d32d3e8dbb78778f62fcdd980dcf46c7 (patch)
tree410a80ba3143ff806a0bfbba469b42a5950a0e18 /t
parentUpdate draft release notes to 1.8.3 (diff)
parentcheckout: avoid unnecessary match_pathspec calls (diff)
downloadtgif-97fefaf6d32d3e8dbb78778f62fcdd980dcf46c7.tar.xz
Merge branch 'nd/checkout-paths-reduce-match-pathspec-calls'
Consolidate repeated pathspec matches on the same paths, while fixing a bug in "git checkout dir/" code started from an unmerged index. * nd/checkout-paths-reduce-match-pathspec-calls: checkout: avoid unnecessary match_pathspec calls
Diffstat (limited to 't')
-rwxr-xr-xt/t2022-checkout-paths.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t2022-checkout-paths.sh b/t/t2022-checkout-paths.sh
index 56090d2eba..8e3545d868 100755
--- a/t/t2022-checkout-paths.sh
+++ b/t/t2022-checkout-paths.sh
@@ -39,4 +39,26 @@ 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=$(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 &&
+
+ 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 &&
+ test_cmp expect.next0 actual.next0
+'
+
test_done