Merge branch 'master' of git://repo.or.cz/alt-git
[git/dscho.git] / t / t4023-diff-rename-typechange.sh
blob30bcaf0a7acedf1ac3b0e4820dfff84ff80a69bf
1 #!/bin/sh
3 test_description='typechange rename detection'
5 . ./test-lib.sh
7 if test "$no_symlinks"; then
8 say "symbolic links not supported - skipping test"
9 test_done;
12 test_expect_success setup '
14 rm -f foo bar &&
15 cat "$TEST_DIRECTORY"/../COPYING >foo &&
16 ln -s linklink bar &&
17 git add foo bar &&
18 git commit -a -m Initial &&
19 git tag one &&
21 rm -f foo bar &&
22 cat "$TEST_DIRECTORY"/../COPYING >bar &&
23 ln -s linklink foo &&
24 git add foo bar &&
25 git commit -a -m Second &&
26 git tag two &&
28 rm -f foo bar &&
29 cat "$TEST_DIRECTORY"/../COPYING >foo &&
30 git add foo &&
31 git commit -a -m Third &&
32 git tag three &&
34 mv foo bar &&
35 ln -s linklink foo &&
36 git add foo bar &&
37 git commit -a -m Fourth &&
38 git tag four &&
40 # This is purely for sanity check
42 rm -f foo bar &&
43 cat "$TEST_DIRECTORY"/../COPYING >foo &&
44 cat "$TEST_DIRECTORY"/../Makefile >bar &&
45 git add foo bar &&
46 git commit -a -m Fifth &&
47 git tag five &&
49 rm -f foo bar &&
50 cat "$TEST_DIRECTORY"/../Makefile >foo &&
51 cat "$TEST_DIRECTORY"/../COPYING >bar &&
52 git add foo bar &&
53 git commit -a -m Sixth &&
54 git tag six
58 test_expect_success 'cross renames to be detected for regular files' '
60 git diff-tree five six -r --name-status -B -M | sort >actual &&
62 echo "R100 foo bar"
63 echo "R100 bar foo"
64 } | sort >expect &&
65 test_cmp expect actual
69 test_expect_success 'cross renames to be detected for typechange' '
71 git diff-tree one two -r --name-status -B -M | sort >actual &&
73 echo "R100 foo bar"
74 echo "R100 bar foo"
75 } | sort >expect &&
76 test_cmp expect actual
80 test_expect_success 'moves and renames' '
82 git diff-tree three four -r --name-status -B -M | sort >actual &&
84 echo "R100 foo bar"
85 echo "T100 foo"
86 } | sort >expect &&
87 test_cmp expect actual
91 test_done