git-prompt: use here-doc instead of here-string
[git/gitster.git] / t / t4023-diff-rename-typechange.sh
blob787605ce3fd076b101d1c825fca174020ae7ff46
1 #!/bin/sh
3 test_description='typechange rename detection'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/lib-diff.sh
8 test_expect_success setup '
10 rm -f foo bar &&
11 COPYING_test_data >foo &&
12 test_ln_s_add linklink bar &&
13 git add foo &&
14 git commit -a -m Initial &&
15 git tag one &&
17 git rm -f foo bar &&
18 COPYING_test_data >bar &&
19 test_ln_s_add linklink foo &&
20 git add bar &&
21 git commit -a -m Second &&
22 git tag two &&
24 git rm -f foo bar &&
25 COPYING_test_data >foo &&
26 git add foo &&
27 git commit -a -m Third &&
28 git tag three &&
30 mv foo bar &&
31 test_ln_s_add linklink foo &&
32 git add bar &&
33 git commit -a -m Fourth &&
34 git tag four &&
36 # This is purely for sanity check
38 git rm -f foo bar &&
39 COPYING_test_data >foo &&
40 cat "$TEST_DIRECTORY"/../Makefile >bar &&
41 git add foo bar &&
42 git commit -a -m Fifth &&
43 git tag five &&
45 git rm -f foo bar &&
46 cat "$TEST_DIRECTORY"/../Makefile >foo &&
47 COPYING_test_data >bar &&
48 git add foo bar &&
49 git commit -a -m Sixth &&
50 git tag six
54 test_expect_success 'cross renames to be detected for regular files' '
55 git diff-tree five six -r --name-status -B -M >out &&
56 sort out >actual &&
58 echo "R100 foo bar" &&
59 echo "R100 bar foo"
60 } | sort >expect &&
61 test_cmp expect actual
65 test_expect_success 'cross renames to be detected for typechange' '
66 git diff-tree one two -r --name-status -B -M >out &&
67 sort out >actual &&
69 echo "R100 foo bar" &&
70 echo "R100 bar foo"
71 } | sort >expect &&
72 test_cmp expect actual
76 test_expect_success 'moves and renames' '
77 git diff-tree three four -r --name-status -B -M >out &&
78 sort out >actual &&
80 # see -B -M (#6) in t4008
81 echo "C100 foo bar" &&
82 echo "T100 foo"
83 } | sort >expect &&
84 test_cmp expect actual
88 test_done