]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4003-diff-rename-1.sh
[PATCH] Introducing software archaeologist's tool "pickaxe".
[thirdparty/git.git] / t / t4003-diff-rename-1.sh
CommitLineData
427dcb4b
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='More rename detection
7
8'
9. ./test-lib.sh
10
11test_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
18test_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
25GIT_DIFF_OPTS=-u0 git-diff-cache -M $tree |
26sed -e 's/\([0-9][0-9]*\)/#/g' >current &&
27cat >expected <<\EOF
28diff --git a/COPYING b/COPYING.#
29similarity index #%
30copy from COPYING
31copy 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
37diff --git a/COPYING b/COPYING.#
38similarity index #%
39rename old COPYING
40rename 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
52EOF
53
54test_expect_success \
55 'validate output from rename/copy detection' \
56 'diff -u current expected'
57
58test_expect_success \
59 'prepare work tree again' \
60 'mv COPYING.2 COPYING &&
61 git-update-cache --add --remove COPYING COPYING.1'
62
63GIT_DIFF_OPTS=-u0 git-diff-cache -C $tree |
64sed -e 's/\([0-9][0-9]*\)/#/g' >current
65cat >expected <<\EOF
66diff --git a/COPYING b/COPYING.#
67similarity index #%
68copy from COPYING
69copy 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
75diff --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
87EOF
88
89test_expect_success \
90 'validate output from rename/copy detection' \
91 'diff -u current expected'
92
93test_done