@matheusbsbs / matheus-bagliano / commits / cee9f2b37b
Fork 0

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 <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Tay Ray Chuan committed May 27, 2010 at 23:34 UTC cee9f2b37bd7c65de5fb507d11b4caac31c29039
1 file changed +27 -2
t/t7502-commit.sh
+27 -2
@@ -4,10 +4,10 @@ test_description='git commit porcelain-ish'
4
5 . ./test-lib.sh
6
7 -# Arguments: [<prefix] [<commit message>]
7 +# Arguments: [<prefix] [<commit message>] [<commit options>]
8 check_summary_oneline() {
9 test_tick &&
10 - git commit -m "$2" | head -1 > act &&
10 + git commit ${3+"$3"} -m "$2" | head -1 > act &&
11
12 # branch name
13 SUMMARY_PREFIX="$(git name-rev --name-only HEAD)" &&
@@ -36,6 +36,31 @@ test_expect_success 'output summary format' '
36 check_summary_oneline "" "a change"
37 '
38
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 +
64 output_tests_cleanup() {
65 # this is needed for "do not fire editor in the presence of conflicts"
66 git checkout master &&