3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='Pathspec restrictions
13 .
"$TEST_DIRECTORY"/diff-lib.sh
;# test-lib chdir's into trash
19 echo rezrov >path1/file1 &&
20 git update-index --add file0 path1/file1 &&
21 tree=`git write-tree` &&
24 echo yomin >path1/file1 &&
25 git update-index file0 path1/file1'
30 'limit to path should show nothing' \
31 'git diff-index --cached $tree -- path >current &&
32 compare_diff_raw current expected'
35 :100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f
0a41e115ab61be0328a19b29f18cdcb49338d516 M path
1/file1
38 'limit to path1 should show path1/file1' \
39 'git diff-index --cached $tree -- path1 >current &&
40 compare_diff_raw current expected'
43 :100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f
0a41e115ab61be0328a19b29f18cdcb49338d516 M path
1/file1
46 'limit to path1/ should show path1/file1' \
47 'git diff-index --cached $tree -- path1/ >current &&
48 compare_diff_raw current expected'
51 :100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f
0a41e115ab61be0328a19b29f18cdcb49338d516 M file0
54 'limit to file0 should show file0' \
55 'git diff-index --cached $tree -- file0 >current &&
56 compare_diff_raw current expected'
61 'limit to file0/ should emit nothing.' \
62 'git diff-index --cached $tree -- file0/ >current &&
63 compare_diff_raw current expected'
65 test_expect_success
'diff-tree pathspec' '
66 tree2=$(git write-tree) &&
68 git diff-tree -r --name-only $tree $tree2 -- pa path1/a >current &&
70 test_cmp expected current