grep: simplify -p output
[git/vmiklos.git] / t / t4023-diff-rename-typechange.sh
blob9bdf6596d82878f709a375084095697124a97609
1 #!/bin/sh
3 test_description='typechange rename detection'
5 . ./test-lib.sh
7 if ! test_have_prereq SYMLINKS
8 then
9 say 'Symbolic links not supported, skipping tests.'
10 test_done
13 test_expect_success setup '
15 rm -f foo bar &&
16 cat "$TEST_DIRECTORY"/../COPYING >foo &&
17 ln -s linklink bar &&
18 git add foo bar &&
19 git commit -a -m Initial &&
20 git tag one &&
22 rm -f foo bar &&
23 cat "$TEST_DIRECTORY"/../COPYING >bar &&
24 ln -s linklink foo &&
25 git add foo bar &&
26 git commit -a -m Second &&
27 git tag two &&
29 rm -f foo bar &&
30 cat "$TEST_DIRECTORY"/../COPYING >foo &&
31 git add foo &&
32 git commit -a -m Third &&
33 git tag three &&
35 mv foo bar &&
36 ln -s linklink foo &&
37 git add foo bar &&
38 git commit -a -m Fourth &&
39 git tag four &&
41 # This is purely for sanity check
43 rm -f foo bar &&
44 cat "$TEST_DIRECTORY"/../COPYING >foo &&
45 cat "$TEST_DIRECTORY"/../Makefile >bar &&
46 git add foo bar &&
47 git commit -a -m Fifth &&
48 git tag five &&
50 rm -f foo bar &&
51 cat "$TEST_DIRECTORY"/../Makefile >foo &&
52 cat "$TEST_DIRECTORY"/../COPYING >bar &&
53 git add foo bar &&
54 git commit -a -m Sixth &&
55 git tag six
59 test_expect_success 'cross renames to be detected for regular files' '
61 git diff-tree five six -r --name-status -B -M | sort >actual &&
63 echo "R100 foo bar"
64 echo "R100 bar foo"
65 } | sort >expect &&
66 test_cmp expect actual
70 test_expect_success 'cross renames to be detected for typechange' '
72 git diff-tree one two -r --name-status -B -M | sort >actual &&
74 echo "R100 foo bar"
75 echo "R100 bar foo"
76 } | sort >expect &&
77 test_cmp expect actual
81 test_expect_success 'moves and renames' '
83 git diff-tree three four -r --name-status -B -M | sort >actual &&
85 echo "R100 foo bar"
86 echo "T100 foo"
87 } | sort >expect &&
88 test_cmp expect actual
92 test_done