t7800: improve test descriptions with empty arguments
[alt-git.git] / t / t4003-diff-rename-1.sh
blobebe091828c878eb2d3ea3ab6f0f2e371e4d34329
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='More rename detection
10 TEST_PASSES_SANITIZE_LEAK=true
11 . ./test-lib.sh
12 . "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
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
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.?
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.
34 GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current
35 cat >expected <<\EOF
36 diff --git a/COPYING b/COPYING.1
37 copy from COPYING
38 copy to COPYING.1
39 --- a/COPYING
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
45 rename from COPYING
46 rename to COPYING.2
47 --- a/COPYING
48 +++ b/COPYING.2
49 @@ -2 +2 @@
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
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
58 EOF
60 test_expect_success 'validate output from rename/copy detection (#1)' '
61 compare_diff_patch current expected
64 test_expect_success 'prepare work tree again' '
65 mv COPYING.2 COPYING &&
66 git update-index --add --remove COPYING COPYING.1 COPYING.2
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.
74 GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current
75 cat >expected <<\EOF
76 diff --git a/COPYING b/COPYING
77 --- a/COPYING
78 +++ b/COPYING
79 @@ -2 +2 @@
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
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
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
96 EOF
98 test_expect_success 'validate output from rename/copy detection (#2)' '
99 compare_diff_patch current expected
102 test_expect_success 'prepare work tree once again' '
103 COPYING_test_data >COPYING &&
104 git update-index --add --remove COPYING COPYING.1
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
111 # git diff-index as well, should not be mentioned.
113 GIT_DIFF_OPTS=--unified=0 \
114 git diff-index -C --find-copies-harder -p $tree >current
115 cat >expected <<\EOF
116 diff --git a/COPYING b/COPYING.1
117 copy from COPYING
118 copy to COPYING.1
119 --- a/COPYING
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
126 test_expect_success 'validate output from rename/copy detection (#3)' '
127 compare_diff_patch current expected
130 test_done