]> git.ipfire.org Git - thirdparty/git.git/blob - t/t2100-update-cache-badpath.sh
The third batch
[thirdparty/git.git] / t / t2100-update-cache-badpath.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Junio C Hamano
4 #
5
6 test_description='git update-index nonsense-path test.
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
15 and tries to git update-index --add the following:
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
25 TEST_PASSES_SANITIZE_LEAK=true
26 . ./test-lib.sh
27
28 mkdir path2 path3
29 date >path0
30 if test_have_prereq SYMLINKS
31 then
32 ln -s xyzzy path1
33 else
34 date > path1
35 fi
36 date >path2/file2
37 date >path3/file3
38
39 test_expect_success \
40 'git update-index --add to add various paths.' \
41 'git update-index --add -- path0 path1 path2/file2 path3/file3'
42
43 rm -fr path?
44
45 mkdir path0 path1
46 date >path2
47 if test_have_prereq SYMLINKS
48 then
49 ln -s frotz path3
50 else
51 date > path3
52 fi
53 date >path0/file0
54 date >path1/file1
55
56 for p in path0/file0 path1/file1 path2 path3
57 do
58 test_expect_success \
59 "git update-index to add conflicting path $p should fail." \
60 "test_must_fail git update-index --add -- $p"
61 done
62 test_done