]>
Commit | Line | Data |
---|---|---|
b45563a2 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='typechange rename detection' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
704a3143 JS |
7 | if ! test_have_prereq SYMLINKS |
8 | then | |
fadb5156 | 9 | skip_all='Symbolic links not supported, skipping tests.' |
704a3143 | 10 | test_done |
704a3143 JS |
11 | fi |
12 | ||
b45563a2 JH |
13 | test_expect_success setup ' |
14 | ||
15 | rm -f foo bar && | |
bfdbee98 | 16 | cat "$TEST_DIRECTORY"/../COPYING >foo && |
b45563a2 JH |
17 | ln -s linklink bar && |
18 | git add foo bar && | |
19 | git commit -a -m Initial && | |
20 | git tag one && | |
21 | ||
22 | rm -f foo bar && | |
bfdbee98 | 23 | cat "$TEST_DIRECTORY"/../COPYING >bar && |
b45563a2 JH |
24 | ln -s linklink foo && |
25 | git add foo bar && | |
26 | git commit -a -m Second && | |
27 | git tag two && | |
28 | ||
29 | rm -f foo bar && | |
bfdbee98 | 30 | cat "$TEST_DIRECTORY"/../COPYING >foo && |
b45563a2 JH |
31 | git add foo && |
32 | git commit -a -m Third && | |
33 | git tag three && | |
34 | ||
35 | mv foo bar && | |
36 | ln -s linklink foo && | |
37 | git add foo bar && | |
38 | git commit -a -m Fourth && | |
39 | git tag four && | |
40 | ||
41 | # This is purely for sanity check | |
42 | ||
43 | rm -f foo bar && | |
bfdbee98 JH |
44 | cat "$TEST_DIRECTORY"/../COPYING >foo && |
45 | cat "$TEST_DIRECTORY"/../Makefile >bar && | |
b45563a2 JH |
46 | git add foo bar && |
47 | git commit -a -m Fifth && | |
48 | git tag five && | |
49 | ||
50 | rm -f foo bar && | |
bfdbee98 JH |
51 | cat "$TEST_DIRECTORY"/../Makefile >foo && |
52 | cat "$TEST_DIRECTORY"/../COPYING >bar && | |
b45563a2 JH |
53 | git add foo bar && |
54 | git commit -a -m Sixth && | |
55 | git tag six | |
56 | ||
57 | ' | |
58 | ||
59 | test_expect_success 'cross renames to be detected for regular files' ' | |
60 | ||
61 | git diff-tree five six -r --name-status -B -M | sort >actual && | |
62 | { | |
63 | echo "R100 foo bar" | |
64 | echo "R100 bar foo" | |
65 | } | sort >expect && | |
82ebb0b6 | 66 | test_cmp expect actual |
b45563a2 JH |
67 | |
68 | ' | |
69 | ||
70 | test_expect_success 'cross renames to be detected for typechange' ' | |
71 | ||
72 | git diff-tree one two -r --name-status -B -M | sort >actual && | |
73 | { | |
74 | echo "R100 foo bar" | |
75 | echo "R100 bar foo" | |
76 | } | sort >expect && | |
82ebb0b6 | 77 | test_cmp expect actual |
b45563a2 JH |
78 | |
79 | ' | |
80 | ||
81 | test_expect_success 'moves and renames' ' | |
82 | ||
83 | git diff-tree three four -r --name-status -B -M | sort >actual && | |
84 | { | |
85 | echo "R100 foo bar" | |
86 | echo "T100 foo" | |
87 | } | sort >expect && | |
82ebb0b6 | 88 | test_cmp expect actual |
b45563a2 JH |
89 | |
90 | ' | |
91 | ||
92 | test_done |