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 path0/COPYING path1/COPYING
49 'validate the result' \
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 # When we omit output from path0 it should still be able to tell us
55 # that path1/COPYING is result from a copy from path0/COPYING, not
56 # rename, which would imply path0/COPYING is now gone.
58 git-diff-cache -C $tree path1 >current
61 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 C100 path0/COPYING path1/COPYING
65 'validate the result' \
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 path0/COPYING path1/COPYING
85 'validate the result' \
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. Even if we restrict the output to path1, it still
91 # should show us the rename.
93 git-diff-cache -C $tree path1 >current
96 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 path0/COPYING path1/COPYING
100 'validate the result' \
101 'compare_diff_raw current expected'