3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='Rename interaction with pathspec.
11 _x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
12 _x40
="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
13 sanitize_diff_raw
='s/ \('"$_x40"'\) \1 \([CR]\)[0-9]* / \1 \1 \2# /'
15 # When heuristics are improved, the score numbers would change.
16 # Ignore them while comparing.
17 # Also we do not check SHA1 hash generation in this test, which
18 # is a job for t0000-basic.sh
20 sed -e "$sanitize_diff_raw" <"$1" >.tmp-1
21 sed -e "$sanitize_diff_raw" <"$2" >.tmp-2
22 diff -u .tmp-1 .tmp-2
&& rm -f .tmp-1 .tmp-2
26 'prepare reference tree' \
28 cp ../../COPYING path0/COPYING &&
29 git-update-cache --add path0/COPYING &&
30 tree=$(git-write-tree) &&
35 'cp path0/COPYING path1/COPYING &&
36 git-update-cache --add --remove path0/COPYING path1/COPYING'
38 # In the tree, there is only path0/COPYING. In the cache, path0 and
39 # path1 both have COPYING and the latter is a copy of path0/COPYING.
40 # Comparing the full tree with cache should tell us so.
42 git-diff-cache
-C $tree >current
45 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3
6ff87c4664981e4397625791c8ea3bbb5f2279a3 C100 path
0/COPYING path
1/COPYING
49 'validate the result (#1)' \
50 'compare_diff_raw current expected'
52 # In the tree, there is only path0/COPYING. In the cache, path0 and
53 # path1 both have COPYING and the latter is a copy of path0/COPYING.
54 # However when we say we care only about path1, we should just see
55 # path1/COPYING suddenly appearing from nowhere, not detected as
56 # a copy from path0/COPYING.
58 git-diff-cache
-C $tree path1
>current
61 :000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 N path
1/COPYING
65 'validate the result (#2)' \
66 'compare_diff_raw current expected'
70 'rm -f path0/COPYING &&
71 git-update-cache --remove path0/COPYING'
73 # In the tree, there is only path0/COPYING. In the cache, path0 does
74 # not have COPYING anymore and path1 has COPYING which is a copy of
75 # path0/COPYING. Showing the full tree with cache should tell us about
78 git-diff-cache
-C $tree >current
81 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3
6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 path
0/COPYING path
1/COPYING
85 'validate the result (#3)' \
86 'compare_diff_raw current expected'
88 # In the tree, there is only path0/COPYING. In the cache, path0 does
89 # not have COPYING anymore and path1 has COPYING which is a copy of
90 # path0/COPYING. When we say we care only about path1, we should just
91 # see path1/COPYING appearing from nowhere.
93 git-diff-cache
-C $tree path1
>current
96 :000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 N path
1/COPYING
100 'validate the result (#4)' \
101 'compare_diff_raw current expected'