diff options
author | Denton Liu <liu.denton@gmail.com> | 2019-04-17 11:23:28 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-18 13:49:29 +0900 |
commit | 1055997e2fc707a15baf232df2ac481055c14321 (patch) | |
tree | 4d32fd986b4c02811266f3db3d087858afcd4a53 /builtin/merge.c | |
parent | d540b70c85ccd08507348785fd210ef8317a864d (diff) | |
download | git-1055997e2fc707a15baf232df2ac481055c14321.tar.gz |
merge: add scissors line on merge conflict
This fixes a bug where the scissors line is placed after the Conflicts:
section, in the case where a merge conflict occurs and
commit.cleanup = scissors.
Next, if commit.cleanup = scissors is specified, don't produce a
scissors line in commit if one already exists in the MERGE_MSG file.
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r-- | builtin/merge.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/builtin/merge.c b/builtin/merge.c index e1f7b7342d..03b9f7230a 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -920,6 +920,20 @@ static int suggest_conflicts(void) filename = git_path_merge_msg(the_repository); fp = xfopen(filename, "a"); + /* + * We can't use cleanup_mode because if we're not using the editor, + * get_cleanup_mode will return COMMIT_MSG_CLEANUP_SPACE instead, even + * though the message is meant to be processed later by git-commit. + * Thus, we will get the cleanup mode which is returned when we _are_ + * using an editor. + */ + if (get_cleanup_mode(cleanup_arg, 1) == COMMIT_MSG_CLEANUP_SCISSORS) { + fputc('\n', fp); + wt_status_add_cut_line(fp); + /* comments out the newline from append_conflicts_hint */ + fputc(comment_line_char, fp); + } + append_conflicts_hint(&the_index, &msgbuf); fputs(msgbuf.buf, fp); strbuf_release(&msgbuf); |