Skip to content

Commit cee9f2b

Browse files
rctaygitster
authored andcommitted
t7502-commit: add summary output tests for empty and merge commits
After c197702 (pretty: Respect --abbrev option), non-abbreviated hashes began to appear, leading to failures for these tests. Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fc6fa0d commit cee9f2b

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

t/t7502-commit.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ test_description='git commit porcelain-ish'
44

55
. ./test-lib.sh
66

7-
# Arguments: [<prefix] [<commit message>]
7+
# Arguments: [<prefix] [<commit message>] [<commit options>]
88
check_summary_oneline() {
99
test_tick &&
10-
git commit -m "$2" | head -1 > act &&
10+
git commit ${3+"$3"} -m "$2" | head -1 > act &&
1111

1212
# branch name
1313
SUMMARY_PREFIX="$(git name-rev --name-only HEAD)" &&
@@ -36,6 +36,31 @@ test_expect_success 'output summary format' '
3636
check_summary_oneline "" "a change"
3737
'
3838

39+
test_expect_failure 'output summary format for commit with an empty diff' '
40+
41+
check_summary_oneline "" "empty" "--allow-empty"
42+
'
43+
44+
test_expect_failure 'output summary format for merges' '
45+
46+
git checkout -b recursive-base &&
47+
test_commit base file1 &&
48+
49+
git checkout -b recursive-a recursive-base &&
50+
test_commit commit-a file1 &&
51+
52+
git checkout -b recursive-b recursive-base &&
53+
test_commit commit-b file1 &&
54+
55+
# conflict
56+
git checkout recursive-a &&
57+
test_must_fail git merge recursive-b &&
58+
# resolve the conflict
59+
echo commit-a > file1 &&
60+
git add file1 &&
61+
check_summary_oneline "" "Merge"
62+
'
63+
3964
output_tests_cleanup() {
4065
# this is needed for "do not fire editor in the presence of conflicts"
4166
git checkout master &&

0 commit comments

Comments
 (0)