]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4023-diff-rename-typechange.sh
The third batch
[thirdparty/git.git] / t / t4023-diff-rename-typechange.sh
CommitLineData
b45563a2
JH
1#!/bin/sh
2
3test_description='typechange rename detection'
4
5. ./test-lib.sh
1c720357 6. "$TEST_DIRECTORY"/lib-diff.sh
b45563a2 7
622f98e2 8test_expect_success setup '
b45563a2
JH
9
10 rm -f foo bar &&
1c720357 11 COPYING_test_data >foo &&
622f98e2
JS
12 test_ln_s_add linklink bar &&
13 git add foo &&
b45563a2
JH
14 git commit -a -m Initial &&
15 git tag one &&
16
622f98e2 17 git rm -f foo bar &&
1c720357 18 COPYING_test_data >bar &&
622f98e2
JS
19 test_ln_s_add linklink foo &&
20 git add bar &&
b45563a2
JH
21 git commit -a -m Second &&
22 git tag two &&
23
622f98e2 24 git rm -f foo bar &&
1c720357 25 COPYING_test_data >foo &&
b45563a2
JH
26 git add foo &&
27 git commit -a -m Third &&
28 git tag three &&
29
30 mv foo bar &&
622f98e2
JS
31 test_ln_s_add linklink foo &&
32 git add bar &&
b45563a2
JH
33 git commit -a -m Fourth &&
34 git tag four &&
35
36 # This is purely for sanity check
37
622f98e2 38 git rm -f foo bar &&
1c720357 39 COPYING_test_data >foo &&
bfdbee98 40 cat "$TEST_DIRECTORY"/../Makefile >bar &&
b45563a2
JH
41 git add foo bar &&
42 git commit -a -m Fifth &&
43 git tag five &&
44
622f98e2 45 git rm -f foo bar &&
bfdbee98 46 cat "$TEST_DIRECTORY"/../Makefile >foo &&
1c720357 47 COPYING_test_data >bar &&
b45563a2
JH
48 git add foo bar &&
49 git commit -a -m Sixth &&
50 git tag six
51
52'
53
622f98e2 54test_expect_success 'cross renames to be detected for regular files' '
5f3bfdc4
ÆAB
55 git diff-tree five six -r --name-status -B -M >out &&
56 sort out >actual &&
b45563a2 57 {
7abcbcb7 58 echo "R100 foo bar" &&
b45563a2
JH
59 echo "R100 bar foo"
60 } | sort >expect &&
82ebb0b6 61 test_cmp expect actual
b45563a2
JH
62
63'
64
622f98e2 65test_expect_success 'cross renames to be detected for typechange' '
5f3bfdc4
ÆAB
66 git diff-tree one two -r --name-status -B -M >out &&
67 sort out >actual &&
b45563a2 68 {
7abcbcb7 69 echo "R100 foo bar" &&
b45563a2
JH
70 echo "R100 bar foo"
71 } | sort >expect &&
82ebb0b6 72 test_cmp expect actual
b45563a2
JH
73
74'
75
622f98e2 76test_expect_success 'moves and renames' '
5f3bfdc4
ÆAB
77 git diff-tree three four -r --name-status -B -M >out &&
78 sort out >actual &&
b45563a2 79 {
6936b585 80 # see -B -M (#6) in t4008
7abcbcb7 81 echo "C100 foo bar" &&
b45563a2
JH
82 echo "T100 foo"
83 } | sort >expect &&
82ebb0b6 84 test_cmp expect actual
b45563a2
JH
85
86'
87
88test_done