diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-03-07 15:59:41 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-07 15:59:41 -0800 |
commit | 798ddfc17fbbe58494f2af0f71e0b53264ee82b5 (patch) | |
tree | 24daff91349aa29c3a7f08881c7c39adc25a2e29 /builtin | |
parent | ae46d5fb98b316767f51a82fc0c1441174995a34 (diff) | |
parent | e90cc075cc43f2bf08a8963ae84d3e4da50ebfc3 (diff) | |
download | git-798ddfc17fbbe58494f2af0f71e0b53264ee82b5.tar.gz |
Merge branch 'jt/commit-redundant-scissors-fix'
"git commit -v --cleanup=scissors" used to add the scissors line
twice in the log message buffer, which has been corrected.
* jt/commit-redundant-scissors-fix:
commit: unify logic to avoid multiple scissors lines when merging
commit: avoid redundant scissor line with --cleanup=scissors -v
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/commit.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 3841fa27d2..a91197245f 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -738,7 +738,6 @@ static int prepare_to_commit(const char *index_file, const char *prefix, const char *hook_arg2 = NULL; int clean_message_contents = (cleanup_mode != COMMIT_MSG_CLEANUP_NONE); int old_display_comment_prefix; - int merge_contains_scissors = 0; int invoked_hook; /* This checks and barfs if author is badly specified */ @@ -842,7 +841,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, wt_status_locate_end(sb.buf + merge_msg_start, sb.len - merge_msg_start) < sb.len - merge_msg_start) - merge_contains_scissors = 1; + s->added_cut_line = 1; } else if (!stat(git_path_squash_msg(the_repository), &statbuf)) { if (strbuf_read_file(&sb, git_path_squash_msg(the_repository), 0) < 0) die_errno(_("could not read SQUASH_MSG")); @@ -925,9 +924,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, " yourself if you want to.\n" "An empty message aborts the commit.\n"); if (whence != FROM_COMMIT) { - if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS && - !merge_contains_scissors) - wt_status_add_cut_line(s->fp); + if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) + wt_status_add_cut_line(s); status_printf_ln( s, GIT_COLOR_NORMAL, whence == FROM_MERGE ? @@ -947,8 +945,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, if (cleanup_mode == COMMIT_MSG_CLEANUP_ALL) 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); + if (whence == FROM_COMMIT) + 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); |