3 test_description
='setup taking and sanitizing funny paths'
7 test_expect_success setup
'
16 test_expect_success
'git add (absolute)' '
18 git add "$D/a/b/c/d" &&
19 git ls-files >current &&
20 echo a/b/c/d >expect &&
21 test_cmp expect current
26 test_expect_success
'git add (funny relative)' '
33 git ls-files >current &&
35 test_cmp expect current
39 test_expect_success
'git rm (absolute)' '
43 git rm -f --cached "$D/a/b/c/d" &&
44 git ls-files >current &&
46 test_cmp expect current
50 test_expect_success
'git rm (funny relative)' '
56 git rm -f --cached "../e/./f"
58 git ls-files >current &&
59 echo a/b/c/d >expect &&
60 test_cmp expect current
64 test_expect_success
'git ls-files (absolute)' '
68 git ls-files "$D/a/e/../b" >current &&
69 echo a/b/c/d >expect &&
70 test_cmp expect current
74 test_expect_success
'git ls-files (relative #1)' '
83 test_cmp expect current
87 test_expect_success
'git ls-files (relative #2)' '
93 git ls-files --full-name "../e/f"
96 test_cmp expect current
100 test_expect_success
'git ls-files (relative #3)' '
106 git ls-files "../e/f"
108 echo ../e/f >expect &&
109 test_cmp expect current
113 test_expect_success
'commit using absolute path names' '
114 git commit -m "foo" &&
116 git commit -m "aa" "$(pwd)/a/b/c/d"
119 test_expect_success
'log using absolute path names' '
121 git commit -m "bb" "$(pwd)/a/b/c/d" &&
123 git log a/b/c/d >f1.txt &&
124 git log "$(pwd)/a/b/c/d" >f2.txt &&
125 test_cmp f1.txt f2.txt
128 test_expect_success
'blame using absolute path names' '
129 git blame a/b/c/d >f1.txt &&
130 git blame "$(pwd)/a/b/c/d" >f2.txt &&
131 test_cmp f1.txt f2.txt
134 test_expect_success
'setup deeper work tree' '
135 test_create_repo tester
138 test_expect_success
'add a directory outside the work tree' '(
140 d1="$(cd .. ; pwd)" &&
141 test_must_fail git add "$d1"
145 test_expect_success
'add a file outside the work tree, nasty case 1' '(
150 test_must_fail git add "$f"
153 test_expect_success
'add a file outside the work tree, nasty case 2' '(
155 f="$(pwd | sed "s/.$//")x" &&
158 test_must_fail git add "$f"