]>
Commit | Line | Data |
---|---|---|
427dcb4b JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
6 | test_description='More rename detection | |
7 | ||
8 | ' | |
16d4bd4f ÆAB |
9 | |
10 | TEST_PASSES_SANITIZE_LEAK=true | |
427dcb4b | 11 | . ./test-lib.sh |
ebd73f50 | 12 | . "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash |
b6d8f309 | 13 | |
9297229d JC |
14 | test_expect_success 'prepare reference tree' ' |
15 | COPYING_test_data >COPYING && | |
16 | echo frotz >rezrov && | |
17 | git update-index --add COPYING rezrov && | |
18 | tree=$(git write-tree) && | |
19 | echo $tree | |
20 | ' | |
21 | ||
22 | test_expect_success 'prepare work tree' ' | |
23 | sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 && | |
24 | sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 && | |
25 | rm -f COPYING && | |
26 | git update-index --add --remove COPYING COPYING.? | |
27 | ' | |
427dcb4b | 28 | |
f7c1512a JH |
29 | # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2, |
30 | # both are slightly edited, and unchanged rezrov. So we say you | |
31 | # copy-and-edit one, and rename-and-edit the other. We do not say | |
32 | # anything about rezrov. | |
c3e7fbcb | 33 | |
0940e5f2 | 34 | GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current |
427dcb4b | 35 | cat >expected <<\EOF |
b6d8f309 | 36 | diff --git a/COPYING b/COPYING.1 |
427dcb4b | 37 | copy from COPYING |
b6d8f309 | 38 | copy to COPYING.1 |
427dcb4b | 39 | --- a/COPYING |
b6d8f309 JH |
40 | +++ b/COPYING.1 |
41 | @@ -6 +6 @@ | |
42 | - HOWEVER, in order to allow a migration to GPLv3 if that seems like | |
43 | + However, in order to allow a migration to GPLv3 if that seems like | |
44 | diff --git a/COPYING b/COPYING.2 | |
dc938417 LT |
45 | rename from COPYING |
46 | rename to COPYING.2 | |
427dcb4b | 47 | --- a/COPYING |
b6d8f309 JH |
48 | +++ b/COPYING.2 |
49 | @@ -2 +2 @@ | |
427dcb4b JH |
50 | - Note that the only valid version of the GPL as far as this project |
51 | + Note that the only valid version of the G.P.L as far as this project | |
b6d8f309 JH |
52 | @@ -6 +6 @@ |
53 | - HOWEVER, in order to allow a migration to GPLv3 if that seems like | |
54 | + HOWEVER, in order to allow a migration to G.P.Lv3 if that seems like | |
55 | @@ -12 +12 @@ | |
56 | - This file is licensed under the GPL v2, or a later version | |
57 | + This file is licensed under the G.P.L v2, or a later version | |
427dcb4b JH |
58 | EOF |
59 | ||
9297229d JC |
60 | test_expect_success 'validate output from rename/copy detection (#1)' ' |
61 | compare_diff_patch current expected | |
62 | ' | |
427dcb4b | 63 | |
9297229d JC |
64 | test_expect_success 'prepare work tree again' ' |
65 | mv COPYING.2 COPYING && | |
66 | git update-index --add --remove COPYING COPYING.1 COPYING.2 | |
67 | ' | |
c3e7fbcb | 68 | |
f7c1512a JH |
69 | # tree has COPYING and rezrov. work tree has COPYING and COPYING.1, |
70 | # both are slightly edited, and unchanged rezrov. So we say you | |
71 | # edited one, and copy-and-edit the other. We do not say | |
72 | # anything about rezrov. | |
427dcb4b | 73 | |
5be60078 | 74 | GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current |
427dcb4b | 75 | cat >expected <<\EOF |
427dcb4b JH |
76 | diff --git a/COPYING b/COPYING |
77 | --- a/COPYING | |
78 | +++ b/COPYING | |
b6d8f309 | 79 | @@ -2 +2 @@ |
427dcb4b JH |
80 | - Note that the only valid version of the GPL as far as this project |
81 | + Note that the only valid version of the G.P.L as far as this project | |
b6d8f309 JH |
82 | @@ -6 +6 @@ |
83 | - HOWEVER, in order to allow a migration to GPLv3 if that seems like | |
84 | + HOWEVER, in order to allow a migration to G.P.Lv3 if that seems like | |
85 | @@ -12 +12 @@ | |
86 | - This file is licensed under the GPL v2, or a later version | |
87 | + This file is licensed under the G.P.L v2, or a later version | |
25d5ea41 JH |
88 | diff --git a/COPYING b/COPYING.1 |
89 | copy from COPYING | |
90 | copy to COPYING.1 | |
91 | --- a/COPYING | |
92 | +++ b/COPYING.1 | |
93 | @@ -6 +6 @@ | |
94 | - HOWEVER, in order to allow a migration to GPLv3 if that seems like | |
95 | + However, in order to allow a migration to GPLv3 if that seems like | |
427dcb4b JH |
96 | EOF |
97 | ||
9297229d JC |
98 | test_expect_success 'validate output from rename/copy detection (#2)' ' |
99 | compare_diff_patch current expected | |
100 | ' | |
c3e7fbcb | 101 | |
9297229d JC |
102 | test_expect_success 'prepare work tree once again' ' |
103 | COPYING_test_data >COPYING && | |
104 | git update-index --add --remove COPYING COPYING.1 | |
105 | ' | |
c3e7fbcb | 106 | |
f7c1512a JH |
107 | # tree has COPYING and rezrov. work tree has COPYING and COPYING.1, |
108 | # but COPYING is not edited. We say you copy-and-edit COPYING.1; this | |
109 | # is only possible because -C mode now reports the unmodified file to | |
110 | # the diff-core. Unchanged rezrov, although being fed to | |
5be60078 | 111 | # git diff-index as well, should not be mentioned. |
c3e7fbcb | 112 | |
4727f640 | 113 | GIT_DIFF_OPTS=--unified=0 \ |
5be60078 | 114 | git diff-index -C --find-copies-harder -p $tree >current |
c3e7fbcb | 115 | cat >expected <<\EOF |
b6d8f309 | 116 | diff --git a/COPYING b/COPYING.1 |
c3e7fbcb | 117 | copy from COPYING |
b6d8f309 | 118 | copy to COPYING.1 |
c3e7fbcb | 119 | --- a/COPYING |
b6d8f309 JH |
120 | +++ b/COPYING.1 |
121 | @@ -6 +6 @@ | |
122 | - HOWEVER, in order to allow a migration to GPLv3 if that seems like | |
123 | + However, in order to allow a migration to GPLv3 if that seems like | |
c3e7fbcb JH |
124 | EOF |
125 | ||
9297229d JC |
126 | test_expect_success 'validate output from rename/copy detection (#3)' ' |
127 | compare_diff_patch current expected | |
128 | ' | |
427dcb4b JH |
129 | |
130 | test_done |