Merge branch 'jc/exclusion-doc'
[alt-git.git] / t / t4023-diff-rename-typechange.sh
blob8c9823765e66aca886a1ec32a8ad523c1c28e1bc
1 #!/bin/sh
3 test_description='typechange rename detection'
5 . ./test-lib.sh
7 test_expect_success setup '
9 rm -f foo bar &&
10 cat "$TEST_DIRECTORY"/../COPYING >foo &&
11 test_ln_s_add linklink bar &&
12 git add foo &&
13 git commit -a -m Initial &&
14 git tag one &&
16 git rm -f foo bar &&
17 cat "$TEST_DIRECTORY"/../COPYING >bar &&
18 test_ln_s_add linklink foo &&
19 git add bar &&
20 git commit -a -m Second &&
21 git tag two &&
23 git rm -f foo bar &&
24 cat "$TEST_DIRECTORY"/../COPYING >foo &&
25 git add foo &&
26 git commit -a -m Third &&
27 git tag three &&
29 mv foo bar &&
30 test_ln_s_add linklink foo &&
31 git add bar &&
32 git commit -a -m Fourth &&
33 git tag four &&
35 # This is purely for sanity check
37 git rm -f foo bar &&
38 cat "$TEST_DIRECTORY"/../COPYING >foo &&
39 cat "$TEST_DIRECTORY"/../Makefile >bar &&
40 git add foo bar &&
41 git commit -a -m Fifth &&
42 git tag five &&
44 git rm -f foo bar &&
45 cat "$TEST_DIRECTORY"/../Makefile >foo &&
46 cat "$TEST_DIRECTORY"/../COPYING >bar &&
47 git add foo bar &&
48 git commit -a -m Sixth &&
49 git tag six
53 test_expect_success 'cross renames to be detected for regular files' '
55 git diff-tree five six -r --name-status -B -M | sort >actual &&
57 echo "R100 foo bar"
58 echo "R100 bar foo"
59 } | sort >expect &&
60 test_cmp expect actual
64 test_expect_success 'cross renames to be detected for typechange' '
66 git diff-tree one two -r --name-status -B -M | sort >actual &&
68 echo "R100 foo bar"
69 echo "R100 bar foo"
70 } | sort >expect &&
71 test_cmp expect actual
75 test_expect_success 'moves and renames' '
77 git diff-tree three four -r --name-status -B -M | sort >actual &&
79 # see -B -M (#6) in t4008
80 echo "C100 foo bar"
81 echo "T100 foo"
82 } | sort >expect &&
83 test_cmp expect actual
87 test_done