3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='Same rename detection as t4003 but testing diff-raw.
12 # When heuristics are improved, the score numbers would change.
13 # Ignore them while comparing.
14 sed -e 's/ \([CR]\)[0-9]* /\1#/' <"$1" >.tmp-1
15 sed -e 's/ \([CR]\)[0-9]* /\1#/' <"$2" >.tmp-2
16 diff -u .tmp-1 .tmp-2
&& rm -f .tmp-1 .tmp-2
19 compare_diff_patch
() {
20 # When heuristics are improved, the score numbers would change.
21 # Ignore them while comparing.
22 sed -e '/^similarity index [0-9]*%$/d' <"$1" >.tmp-1
23 sed -e '/^similarity index [0-9]*%$/d' <"$2" >.tmp-2
24 diff -u .tmp-1 .tmp-2
&& rm -f .tmp-1 .tmp-2
28 'prepare reference tree' \
29 'cat ../../COPYING >COPYING &&
31 git-update-cache --add COPYING rezrov &&
32 tree=$(git-write-tree) &&
37 'sed -e 's
/HOWEVER
/However
/' <COPYING >COPYING.1 &&
38 sed -e 's
/GPL
/G.P.L
/g
' <COPYING >COPYING.2 &&
40 git-update-cache --add --remove COPYING COPYING.?'
42 # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2,
43 # both are slightly edited, and unchanged rezrov. We say COPYING.1
44 # and COPYING.2 are based on COPYING, and do not say anything about
47 git-diff-cache
-M $tree >current
50 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3
0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING
.1
51 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3
06c67961bbaed34a127f76d261f4c0bf73eda471 R1234 COPYING COPYING
.2
55 'validate output from rename/copy detection (#1)' \
56 'compare_diff_raw current expected'
58 # make sure diff-helper can grok it.
60 GIT_DIFF_OPTS
=--unified=0 git-diff-helper
<diff-raw
>current
62 diff --git a
/COPYING b
/COPYING
.1
68 - HOWEVER
, in order to allow a migration to GPLv3
if that seems like
69 + However
, in order to allow a migration to GPLv3
if that seems like
70 diff --git a
/COPYING b
/COPYING
.2
76 - Note that the only valid version of the GPL as far as this project
77 + Note that the only valid version of the G.P.L as far as this project
79 - HOWEVER
, in order to allow a migration to GPLv3
if that seems like
80 + HOWEVER
, in order to allow a migration to G.P.Lv3
if that seems like
82 - This
file is licensed under the GPL v2
, or a later version
83 + This
file is licensed under the G.P.L v2
, or a later version
87 'validate output from diff-helper (#1)' \
88 'compare_diff_patch current expected'
90 ################################################################
93 'prepare work tree again' \
94 'mv COPYING.2 COPYING &&
95 git-update-cache --add --remove COPYING COPYING.1 COPYING.2'
97 # tree has COPYING and rezrov. work tree has COPYING and COPYING.1,
98 # both are slightly edited, and unchanged rezrov. We say COPYING.1
99 # is based on COPYING and COPYING is still there, and do not say anything
102 git-diff-cache
-C $tree >current
104 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3
06c67961bbaed34a127f76d261f4c0bf73eda471 M COPYING
105 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3
0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING
.1
108 test_expect_success \
109 'validate output from rename/copy detection (#2)' \
110 'compare_diff_raw current expected'
112 test_expect_success \
113 'prepare work tree once again' \
114 'cat ../../COPYING >COPYING &&
115 git-update-cache --add --remove COPYING COPYING.1'
117 # make sure diff-helper can grok it.
119 GIT_DIFF_OPTS
=--unified=0 git-diff-helper
<diff-raw
>current
121 diff --git a
/COPYING b
/COPYING
125 - Note that the only valid version of the GPL as far as this project
126 + Note that the only valid version of the G.P.L as far as this project
128 - HOWEVER
, in order to allow a migration to GPLv3
if that seems like
129 + HOWEVER
, in order to allow a migration to G.P.Lv3
if that seems like
131 - This
file is licensed under the GPL v2
, or a later version
132 + This
file is licensed under the G.P.L v2
, or a later version
133 diff --git a
/COPYING b
/COPYING
.1
139 - HOWEVER
, in order to allow a migration to GPLv3
if that seems like
140 + However
, in order to allow a migration to GPLv3
if that seems like
143 test_expect_success \
144 'validate output from diff-helper (#2)' \
145 'compare_diff_patch current expected'
147 ################################################################
149 # tree has COPYING and rezrov. work tree has the same COPYING and
150 # copy-edited COPYING.1, and unchanged rezrov. We should not say
151 # anything about rezrov nor COPYING, since the revised again diff-raw
152 # nows how to say Copy.
154 git-diff-cache
-C $tree >current
156 :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3
0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING
.1
159 test_expect_success \
160 'validate output from rename/copy detection (#3)' \
161 'compare_diff_raw current expected'
163 # make sure diff-helper can grok it.
165 GIT_DIFF_OPTS
=--unified=0 git-diff-helper
<diff-raw
>current
167 diff --git a
/COPYING b
/COPYING
.1
173 - HOWEVER
, in order to allow a migration to GPLv3
if that seems like
174 + However
, in order to allow a migration to GPLv3
if that seems like
177 test_expect_success \
178 'validate output from diff-helper (#3)' \
179 'compare_diff_patch current expected'