3 # Copyright (c) 2005 Junio C Hamano
6 test_description='Same rename detection as t4003 but testing diff-raw -z.
10 . "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
13 'prepare reference tree' \
14 'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
16 git update-index --add COPYING rezrov &&
17 orig=$(git hash-object COPYING) &&
18 tree=$(git write-tree) &&
23 'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&
24 sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&
26 c1=$(git hash-object COPYING.1) &&
27 c2=$(git hash-object COPYING.2) &&
28 git update-index --add --remove COPYING COPYING.?'
30 # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2,
31 # both are slightly edited, and unchanged rezrov. We say COPYING.1
32 # and COPYING.2 are based on COPYING, and do not say anything about
35 git diff-index -z -C $tree >current
38 :100644 100644 $orig $c1 C1234
41 :100644 100644 $orig $c2 R1234
47 'validate output from rename/copy detection (#1)' \
48 'compare_diff_raw_z current expected'
50 ################################################################
53 'prepare work tree again' \
54 'mv COPYING.2 COPYING &&
55 git update-index --add --remove COPYING COPYING.1 COPYING.2'
57 # tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
58 # both are slightly edited, and unchanged rezrov. We say COPYING.1
59 # is based on COPYING and COPYING is still there, and do not say anything
62 git diff-index -z -C $tree >current
64 :100644 100644 $orig $c2 M
66 :100644 100644 $orig $c1 C1234
72 'validate output from rename/copy detection (#2)' \
73 'compare_diff_raw_z current expected'
75 ################################################################
77 # tree has COPYING and rezrov. work tree has the same COPYING and
78 # copy-edited COPYING.1, and unchanged rezrov. We should not say
79 # anything about rezrov or COPYING, since the revised again diff-raw
80 # nows how to say Copy.
83 'prepare work tree once again' \
84 'cat "$TEST_DIRECTORY"/lib-diff/COPYING >COPYING &&
85 git update-index --add --remove COPYING COPYING.1'
87 git diff-index -z -C --find-copies-harder $tree >current
89 :100644 100644 $orig $c1 C1234
95 'validate output from rename/copy detection (#3)' \
96 'compare_diff_raw_z current expected'