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 if git ls-files "../e/f"
108 echo Gaah, should have failed
117 test_expect_success 'commit using absolute path names' '
118 git commit -m "foo" &&
120 git commit -m "aa" "$(pwd)/a/b/c/d"
123 test_expect_success 'log using absolute path names' '
125 git commit -m "bb" "$(pwd)/a/b/c/d" &&
127 git log a/b/c/d >f1.txt &&
128 git log "$(pwd)/a/b/c/d" >f2.txt &&
129 test_cmp f1.txt f2.txt
132 test_expect_success 'blame using absolute path names' '
133 git blame a/b/c/d >f1.txt &&
134 git blame "$(pwd)/a/b/c/d" >f2.txt &&
135 test_cmp f1.txt f2.txt
138 test_expect_success 'setup deeper work tree' '
139 test_create_repo tester
142 test_expect_success 'add a directory outside the work tree' '(
144 d1="$(cd .. ; pwd)" &&
145 test_must_fail git add "$d1"
149 test_expect_success 'add a file outside the work tree, nasty case 1' '(
154 test_must_fail git add "$f"
157 test_expect_success 'add a file outside the work tree, nasty case 2' '(
159 f="$(pwd | sed "s/.$//")x" &&
162 test_must_fail git add "$f"