3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='git-ls-tree test.
8 This test runs git-ls-tree with the following in a tree.
12 path2/foo - a file in a directory
13 path2/bazbo - a symlink in a directory
14 path2/baz/b - a file in a directory in a directory
16 The new path restriction code should do the right thing for path2 and
23 'mkdir path2 path2/baz &&
27 ln -s ../path1 path2/bazbo &&
28 echo Mi >path2/baz/b &&
29 find path? \( -type f -o -type l \) -print |
30 xargs git-update-cache --add &&
31 tree=`git-write-tree` &&
34 _x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
35 _x40
="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
37 sed -e "s/ $_x40 / X /" <current
>check
38 diff -u expected check
43 'git-ls-tree $tree >current &&
44 cat >expected <<\EOF &&
53 'git-ls-tree -r $tree >current &&
54 cat >expected <<\EOF &&
58 040000 tree X path2/baz
59 100644 blob X path2/baz/b
60 120000 blob X path2/bazbo
61 100644 blob X path2/foo
67 'git-ls-tree $tree path >current &&
68 cat >expected <<\EOF &&
75 'git-ls-tree $tree path1 path0 >current &&
76 cat >expected <<\EOF &&
84 'git-ls-tree $tree path2 >current &&
85 cat >expected <<\EOF &&
87 040000 tree X path2/baz
88 100644 blob X path2/baz/b
89 120000 blob X path2/bazbo
90 100644 blob X path2/foo
96 'git-ls-tree $tree path2/baz >current &&
97 cat >expected <<\EOF &&
98 040000 tree X path2/baz
99 100644 blob X path2/baz/b