]>
Commit | Line | Data |
---|---|---|
c43ce6d6 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Junio C Hamano | |
4 | # | |
5 | ||
5be60078 | 6 | test_description='git read-tree --prefix test. |
c43ce6d6 JH |
7 | ' |
8 | ||
98300c81 | 9 | TEST_PASSES_SANITIZE_LEAK=true |
c43ce6d6 JH |
10 | . ./test-lib.sh |
11 | ||
12 | test_expect_success setup ' | |
13 | echo hello >one && | |
5be60078 | 14 | git update-index --add one && |
7f311eb5 | 15 | tree=$(git write-tree) && |
c43ce6d6 JH |
16 | echo tree is $tree |
17 | ' | |
18 | ||
19 | echo 'one | |
20 | two/one' >expect | |
21 | ||
22 | test_expect_success 'read-tree --prefix' ' | |
5be60078 JH |
23 | git read-tree --prefix=two/ $tree && |
24 | git ls-files >actual && | |
c43ce6d6 JH |
25 | cmp expect actual |
26 | ' | |
27 | ||
cc89331d VD |
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 && | |
32 | ||
33 | git rm -rf . && | |
34 | test_must_fail git read-tree --prefix=/ $tree && | |
35 | git read-tree --prefix= $tree | |
36 | ' | |
37 | ||
c43ce6d6 | 38 | test_done |