aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2024-02-27 01:16:09 -0800
committerJunio C Hamano <gitster@pobox.com>2024-02-27 09:40:46 -0800
commit688a0a751e9ee032be9fb70d7d63220bc85acae1 (patch)
tree74511084cdb4bc7539b685175b629f63d82e6358 /builtin
parent0d464a4e6a5a19bd8fbea1deae22d48d14dccb01 (diff)
downloadgit-688a0a751e9ee032be9fb70d7d63220bc85acae1.tar.gz
commit: avoid redundant scissor line with --cleanup=scissors -v
`git commit --cleanup=scissors -v` prints two scissors lines: one at the start of the comment lines, and the other right before the diff. This is redundant, and pushes the diff further down in the user's editor than it needs to be. Make wt_status_add_cut_line() remember if it has added a cut line before, and avoid adding a redundant one. Add a test for this. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 65196a2827..7860af552e 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -926,7 +926,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
if (whence != FROM_COMMIT) {
if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
!merge_contains_scissors)
- wt_status_add_cut_line(s->fp);
+ wt_status_add_cut_line(s);
status_printf_ln(
s, GIT_COLOR_NORMAL,
whence == FROM_MERGE ?
@@ -947,7 +947,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_all, comment_line_char);
else if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) {
if (whence == FROM_COMMIT && !merge_contains_scissors)
- wt_status_add_cut_line(s->fp);
+ wt_status_add_cut_line(s);
} else /* COMMIT_MSG_CLEANUP_SPACE, that is. */
status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_space, comment_line_char);