Merge branch 'rj/cygwin-has-dev-tty'
[git/gitster.git] / t / t1003-read-tree-prefix.sh
blobc860c08ecb46a37a6f20bf403963afd7576fed9f
1 #!/bin/sh
3 # Copyright (c) 2006 Junio C Hamano
6 test_description='git read-tree --prefix test.
9 TEST_PASSES_SANITIZE_LEAK=true
10 . ./test-lib.sh
12 test_expect_success setup '
13 echo hello >one &&
14 git update-index --add one &&
15 tree=$(git write-tree) &&
16 echo tree is $tree
19 echo 'one
20 two/one' >expect
22 test_expect_success 'read-tree --prefix' '
23 git read-tree --prefix=two/ $tree &&
24 git ls-files >actual &&
25 cmp expect actual
28 test_expect_success 'read-tree --prefix with leading slash exits with error' '
29 git rm -rf . &&
30 test_must_fail git read-tree --prefix=/two/ $tree &&
31 git read-tree --prefix=two/ $tree &&
33 git rm -rf . &&
34 test_must_fail git read-tree --prefix=/ $tree &&
35 git read-tree --prefix= $tree
38 test_done