]> git.ipfire.org Git - thirdparty/git.git/blob - t/t4003-diff-rename-1.sh
[PATCH] Introducing software archaeologist's tool "pickaxe".
[thirdparty/git.git] / t / t4003-diff-rename-1.sh
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
10
11 test_expect_success \
12 'prepare reference tree' \
13 'cat ../../COPYING >COPYING &&
14 git-update-cache --add COPYING &&
15 tree=$(git-write-tree) &&
16 echo $tree'
17
18 test_expect_success \
19 'prepare work tree' \
20 'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&
21 sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&
22 rm -f COPYING &&
23 git-update-cache --add --remove COPYING COPYING.?'
24
25 GIT_DIFF_OPTS=-u0 git-diff-cache -M $tree |
26 sed -e 's/\([0-9][0-9]*\)/#/g' >current &&
27 cat >expected <<\EOF
28 diff --git a/COPYING b/COPYING.#
29 similarity index #%
30 copy from COPYING
31 copy to COPYING.#
32 --- a/COPYING
33 +++ b/COPYING.#
34 @@ -# +# @@
35 - HOWEVER, in order to allow a migration to GPLv# if that seems like
36 + However, in order to allow a migration to GPLv# if that seems like
37 diff --git a/COPYING b/COPYING.#
38 similarity index #%
39 rename old COPYING
40 rename new COPYING.#
41 --- a/COPYING
42 +++ b/COPYING.#
43 @@ -# +# @@
44 - Note that the only valid version of the GPL as far as this project
45 + Note that the only valid version of the G.P.L as far as this project
46 @@ -# +# @@
47 - HOWEVER, in order to allow a migration to GPLv# if that seems like
48 + HOWEVER, in order to allow a migration to G.P.Lv# if that seems like
49 @@ -# +# @@
50 - This file is licensed under the GPL v#, or a later version
51 + This file is licensed under the G.P.L v#, or a later version
52 EOF
53
54 test_expect_success \
55 'validate output from rename/copy detection' \
56 'diff -u current expected'
57
58 test_expect_success \
59 'prepare work tree again' \
60 'mv COPYING.2 COPYING &&
61 git-update-cache --add --remove COPYING COPYING.1'
62
63 GIT_DIFF_OPTS=-u0 git-diff-cache -C $tree |
64 sed -e 's/\([0-9][0-9]*\)/#/g' >current
65 cat >expected <<\EOF
66 diff --git a/COPYING b/COPYING.#
67 similarity index #%
68 copy from COPYING
69 copy to COPYING.#
70 --- a/COPYING
71 +++ b/COPYING.#
72 @@ -# +# @@
73 - HOWEVER, in order to allow a migration to GPLv# if that seems like
74 + However, in order to allow a migration to GPLv# if that seems like
75 diff --git a/COPYING b/COPYING
76 --- a/COPYING
77 +++ b/COPYING
78 @@ -# +# @@
79 - Note that the only valid version of the GPL as far as this project
80 + Note that the only valid version of the G.P.L as far as this project
81 @@ -# +# @@
82 - HOWEVER, in order to allow a migration to GPLv# if that seems like
83 + HOWEVER, in order to allow a migration to G.P.Lv# if that seems like
84 @@ -# +# @@
85 - This file is licensed under the GPL v#, or a later version
86 + This file is licensed under the G.P.L v#, or a later version
87 EOF
88
89 test_expect_success \
90 'validate output from rename/copy detection' \
91 'diff -u current expected'
92
93 test_done