commit-template: distinguish status information unconditionally

The commit template adds the status information without adding a new line to distinguish them in the absence of optional parts. This results in difficulty in interpreting it's content, specifically for inexperienced users. Unconditionally, add new lines to separate the status message from the other parts of the commit-template to make it more readable. Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kaartic Sivaraam committed Jun 30, 2017 at 17:42 UTC b3cf1b77894861920671def129a981b54ec9618e
2 files changed +24 -2
builtin/commit.c
+1 -2
@@ -873,8 +873,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
873 (int)(ci.name_end - ci.name_begin), ci.name_begin,
874 (int)(ci.mail_end - ci.mail_begin), ci.mail_begin);
875
876 - if (ident_shown)
877 - status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
876 + status_printf_ln(s, GIT_COLOR_NORMAL, "%s", ""); /* Add new line for clarity */
877
878 saved_color_setting = s->use_color;
879 s->use_color = 0;
t/t7500-commit.sh
+23
@@ -329,4 +329,27 @@ test_expect_success 'invalid message options when using --fixup' '
329 test_must_fail git commit --fixup HEAD~1 -F log
330 '
331
332 +cat >expected-template <<EOF
333 +
334 +# Please enter the commit message for your changes. Lines starting
335 +# with '#' will be ignored, and an empty message aborts the commit.
336 +#
337 +# Author: A U Thor <author@example.com>
338 +#
339 +# On branch commit-template-check
340 +# Changes to be committed:
341 +# new file: commit-template-check
342 +#
343 +# Untracked files not listed
344 +EOF
345 +
346 +test_expect_success 'new line found before status message in commit template' '
347 + git checkout -b commit-template-check &&
348 + git reset --hard HEAD &&
349 + touch commit-template-check &&
350 + git add commit-template-check &&
351 + GIT_EDITOR="cat >editor-input" git commit --untracked-files=no --allow-empty-message &&
352 + test_i18ncmp expected-template editor-input
353 +'
354 +
355 test_done