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