Merge branch 'ja/doc-synopsis-markup'
[git/gitster.git] / t / t2100-update-cache-badpath.sh
blob7915e7b8211dbb16f49c9f1e5f0433c6f3230e58
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git update-index nonsense-path test.
8 This test creates the following structure in the cache:
10 path0 - a file
11 path1 - a symlink
12 path2/file2 - a file in a directory
13 path3/file3 - a file in a directory
15 and tries to git update-index --add the following:
17 path0/file0 - a file in a directory
18 path1/file1 - a file in a directory
19 path2 - a file
20 path3 - a symlink
22 All of the attempts should fail.
25 TEST_PASSES_SANITIZE_LEAK=true
26 . ./test-lib.sh
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
36 date >path2/file2
37 date >path3/file3
39 test_expect_success \
40 'git update-index --add to add various paths.' \
41 'git update-index --add -- path0 path1 path2/file2 path3/file3'
43 rm -fr path?
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
53 date >path0/file0
54 date >path1/file1
56 for p in path0/file0 path1/file1 path2 path3
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