]>
Commit | Line | Data |
---|---|---|
368f99d5 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
5be60078 | 6 | test_description='git update-index nonsense-path test. |
368f99d5 JH |
7 | |
8 | This test creates the following structure in the cache: | |
9 | ||
10 | path0 - a file | |
11 | path1 - a symlink | |
12 | path2/file2 - a file in a directory | |
13 | path3/file3 - a file in a directory | |
14 | ||
5be60078 | 15 | and tries to git update-index --add the following: |
368f99d5 JH |
16 | |
17 | path0/file0 - a file in a directory | |
18 | path1/file1 - a file in a directory | |
19 | path2 - a file | |
20 | path3 - a symlink | |
21 | ||
22 | All of the attempts should fail. | |
23 | ' | |
24 | ||
d96fb140 | 25 | TEST_PASSES_SANITIZE_LEAK=true |
368f99d5 JH |
26 | . ./test-lib.sh |
27 | ||
28 | mkdir path2 path3 | |
29 | date >path0 | |
704a3143 JS |
30 | if test_have_prereq SYMLINKS |
31 | then | |
32 | ln -s xyzzy path1 | |
33 | else | |
34 | date > path1 | |
35 | fi | |
368f99d5 JH |
36 | date >path2/file2 |
37 | date >path3/file3 | |
38 | ||
39 | test_expect_success \ | |
5be60078 JH |
40 | 'git update-index --add to add various paths.' \ |
41 | 'git update-index --add -- path0 path1 path2/file2 path3/file3' | |
368f99d5 JH |
42 | |
43 | rm -fr path? | |
44 | ||
45 | mkdir path0 path1 | |
46 | date >path2 | |
704a3143 JS |
47 | if test_have_prereq SYMLINKS |
48 | then | |
49 | ln -s frotz path3 | |
50 | else | |
51 | date > path3 | |
52 | fi | |
368f99d5 JH |
53 | date >path0/file0 |
54 | date >path1/file1 | |
55 | ||
56 | for p in path0/file0 path1/file1 path2 path3 | |
57 | do | |
41ac414e | 58 | test_expect_success \ |
5be60078 | 59 | "git update-index to add conflicting path $p should fail." \ |
d492b31c | 60 | "test_must_fail git update-index --add -- $p" |
368f99d5 JH |
61 | done |
62 | test_done |