Windows ANSI - hook write()
[git/mingw/4msysgit/peterh.git] / t / t4023-diff-rename-typechange.sh
blobbcaf94019f98c5fd442b5a1e943c77a7c8ed0b63
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 ../../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 ../../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 ../../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 ../../COPYING >foo &&
44 cat ../../Makefile >bar &&
45 git add foo bar &&
46 git commit -a -m Fifth &&
47 git tag five &&
49 rm -f foo bar &&
50 cat ../../Makefile >foo &&
51 cat ../../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