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