Skip to content

Commit f5d79bf

Browse files
avargitster
authored andcommitted
tests: refactor a few tests to use "test_commit --append"
Refactor a few more tests to use the new "--append" option to "test_commit". I added it for use in the mailmap tests, but this demonstrates how useful it is in general. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3373518 commit f5d79bf

File tree

3 files changed

+8
-29
lines changed

3 files changed

+8
-29
lines changed

t/t1412-reflog-loop.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ test_description='reflog walk shows repeated commits again'
44
. ./test-lib.sh
55

66
test_expect_success 'setup commits' '
7-
test_tick &&
8-
echo content >file && git add file && git commit -m one &&
9-
git tag one &&
10-
echo content >>file && git add file && git commit -m two &&
11-
git tag two
7+
test_commit one file content &&
8+
test_commit --append two file content
129
'
1310

1411
test_expect_success 'setup reflog with alternating commits' '

t/t2012-checkout-last.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ test_description='checkout can switch to last branch and merge base'
55
. ./test-lib.sh
66

77
test_expect_success 'setup' '
8-
echo hello >world &&
9-
git add world &&
10-
git commit -m initial &&
8+
test_commit initial world hello &&
119
git branch other &&
12-
echo "hello again" >>world &&
13-
git add world &&
14-
git commit -m second
10+
test_commit --append second world "hello again"
1511
'
1612

1713
test_expect_success '"checkout -" does not work initially' '
@@ -93,9 +89,7 @@ test_expect_success 'switch to twelfth from the last' '
9389

9490
test_expect_success 'merge base test setup' '
9591
git checkout -b another other &&
96-
echo "hello again" >>world &&
97-
git add world &&
98-
git commit -m third
92+
test_commit --append third world "hello again"
9993
'
10094

10195
test_expect_success 'another...master' '

t/t7810-grep.sh

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -687,21 +687,9 @@ test_expect_success 'grep -C1 hunk mark between files' '
687687
'
688688

689689
test_expect_success 'log grep setup' '
690-
echo a >>file &&
691-
test_tick &&
692-
GIT_AUTHOR_NAME="With * Asterisk" \
693-
GIT_AUTHOR_EMAIL="[email protected]" \
694-
git commit -a -m "second" &&
695-
696-
echo a >>file &&
697-
test_tick &&
698-
git commit -a -m "third" &&
699-
700-
echo a >>file &&
701-
test_tick &&
702-
GIT_AUTHOR_NAME="Night Fall" \
703-
GIT_AUTHOR_EMAIL="[email protected]" \
704-
git commit -a -m "fourth"
690+
test_commit --append --author "With * Asterisk <[email protected]>" second file a &&
691+
test_commit --append third file a &&
692+
test_commit --append --author "Night Fall <[email protected]>" fourth file a
705693
'
706694

707695
test_expect_success 'log grep (1)' '

0 commit comments

Comments
 (0)