Skip to content

Commit d930508

Browse files
ArjenLgitster
authored andcommitted
t/t4202-log.sh: Add testcases
Add testcases for 'git log --diff-filter=[CM]' (copies and renames). Also add a testcase for 'git log --follow'. Signed-off-by: Arjen Laarhoven <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9a01387 commit d930508

File tree

1 file changed

+50
-9
lines changed

1 file changed

+50
-9
lines changed

t/t4202-log.sh

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,31 @@ test_expect_success setup '
1616
test_tick &&
1717
git commit -m second &&
1818
19-
mkdir a &&
20-
echo ni >a/two &&
21-
git add a/two &&
19+
git mv one ichi &&
2220
test_tick &&
2321
git commit -m third &&
2422
25-
echo san >a/three &&
26-
git add a/three &&
23+
cp ichi ein &&
24+
git add ein &&
2725
test_tick &&
2826
git commit -m fourth &&
2927
30-
git rm a/three &&
28+
mkdir a &&
29+
echo ni >a/two &&
30+
git add a/two &&
31+
test_tick &&
32+
git commit -m fifth &&
33+
34+
git rm a/two &&
3135
test_tick &&
32-
git commit -m fifth
36+
git commit -m sixth
3337
3438
'
3539

3640
test_expect_success 'diff-filter=A' '
3741
3842
actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) &&
39-
expect=$(echo fourth ; echo third ; echo initial) &&
43+
expect=$(echo fifth ; echo fourth ; echo third ; echo initial) &&
4044
test "$actual" = "$expect" || {
4145
echo Oops
4246
echo "Actual: $actual"
@@ -60,7 +64,43 @@ test_expect_success 'diff-filter=M' '
6064
test_expect_success 'diff-filter=D' '
6165
6266
actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
63-
expect=$(echo fifth) &&
67+
expect=$(echo sixth ; echo third) &&
68+
test "$actual" = "$expect" || {
69+
echo Oops
70+
echo "Actual: $actual"
71+
false
72+
}
73+
74+
'
75+
76+
test_expect_success 'diff-filter=R' '
77+
78+
actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
79+
expect=$(echo third) &&
80+
test "$actual" = "$expect" || {
81+
echo Oops
82+
echo "Actual: $actual"
83+
false
84+
}
85+
86+
'
87+
88+
test_expect_success 'diff-filter=C' '
89+
90+
actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
91+
expect=$(echo fourth) &&
92+
test "$actual" = "$expect" || {
93+
echo Oops
94+
echo "Actual: $actual"
95+
false
96+
}
97+
98+
'
99+
100+
test_expect_success 'git log --follow' '
101+
102+
actual=$(git log --follow --pretty="format:%s" ichi) &&
103+
expect=$(echo third ; echo second ; echo initial) &&
64104
test "$actual" = "$expect" || {
65105
echo Oops
66106
echo "Actual: $actual"
@@ -72,6 +112,7 @@ test_expect_success 'diff-filter=D' '
72112
test_expect_success 'setup case sensitivity tests' '
73113
echo case >one &&
74114
test_tick &&
115+
git add one
75116
git commit -a -m Second
76117
'
77118

0 commit comments

Comments
 (0)