]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2100-update-cache-badpath.sh
path.c: don't call the match function without value in trie_find()
[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
25. ./test-lib.sh
26
27mkdir path2 path3
28date >path0
704a3143
JS
29if test_have_prereq SYMLINKS
30then
31 ln -s xyzzy path1
32else
33 date > path1
34fi
368f99d5
JH
35date >path2/file2
36date >path3/file3
37
38test_expect_success \
5be60078
JH
39 'git update-index --add to add various paths.' \
40 'git update-index --add -- path0 path1 path2/file2 path3/file3'
368f99d5
JH
41
42rm -fr path?
43
44mkdir path0 path1
45date >path2
704a3143
JS
46if test_have_prereq SYMLINKS
47then
48 ln -s frotz path3
49else
50 date > path3
51fi
368f99d5
JH
52date >path0/file0
53date >path1/file1
54
55for p in path0/file0 path1/file1 path2 path3
56do
41ac414e 57 test_expect_success \
5be60078 58 "git update-index to add conflicting path $p should fail." \
d492b31c 59 "test_must_fail git update-index --add -- $p"
368f99d5
JH
60done
61test_done