3 # Copyright (c) 2005 Junio C Hamano
6 test_description='Same rename detection as t4003 but testing diff-raw -z.
10 . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
13 'prepare reference tree' \
14 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
16 git update-index --add COPYING rezrov &&
17 tree=$(git write-tree) &&
22 'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&
23 sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&
25 git update-index --add --remove COPYING COPYING.?'
27 # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2,
28 # both are slightly edited, and unchanged rezrov. We say COPYING.1
29 # and COPYING.2 are based on COPYING, and do not say anything about
32 git diff-index -z -C $tree >current
35 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
38 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 R1234
44 'validate output from rename/copy detection (#1)' \
45 'compare_diff_raw_z current expected'
47 ################################################################
50 'prepare work tree again' \
51 'mv COPYING.2 COPYING &&
52 git update-index --add --remove COPYING COPYING.1 COPYING.2'
54 # tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
55 # both are slightly edited, and unchanged rezrov. We say COPYING.1
56 # is based on COPYING and COPYING is still there, and do not say anything
59 git diff-index -z -C $tree >current
61 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 M
63 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
69 'validate output from rename/copy detection (#2)' \
70 'compare_diff_raw_z current expected'
72 ################################################################
74 # tree has COPYING and rezrov. work tree has the same COPYING and
75 # copy-edited COPYING.1, and unchanged rezrov. We should not say
76 # anything about rezrov or COPYING, since the revised again diff-raw
77 # nows how to say Copy.
80 'prepare work tree once again' \
81 'cat "$TEST_DIRECTORY"/../COPYING >COPYING &&
82 git update-index --add --remove COPYING COPYING.1'
84 git diff-index -z -C --find-copies-harder $tree >current
86 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234
92 'validate output from rename/copy detection (#3)' \
93 'compare_diff_raw_z current expected'