]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2100-update-cache-badpath.sh
The seventh batch
[thirdparty/git.git] / t / t2100-update-cache-badpath.sh
CommitLineData
368f99d5
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
5be60078 6test_description='git update-index nonsense-path test.
368f99d5
JH
7
8This 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 15and 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
22All of the attempts should fail.
23'
24
d96fb140 25TEST_PASSES_SANITIZE_LEAK=true
368f99d5
JH
26. ./test-lib.sh
27
28mkdir path2 path3
29date >path0
704a3143
JS
30if test_have_prereq SYMLINKS
31then
32 ln -s xyzzy path1
33else
34 date > path1
35fi
368f99d5
JH
36date >path2/file2
37date >path3/file3
38
39test_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
43rm -fr path?
44
45mkdir path0 path1
46date >path2
704a3143
JS
47if test_have_prereq SYMLINKS
48then
49 ln -s frotz path3
50else
51 date > path3
52fi
368f99d5
JH
53date >path0/file0
54date >path1/file1
55
56for p in path0/file0 path1/file1 path2 path3
57do
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
61done
62test_done