sequencer.c: save and restore cleanup mode
[gitweb.git] / builtin / merge.c
index e1f7b7342ddbe50b78e128e681f6a6a2fe672420..03b9f7230a1ade2e11a3a44bd7635fabe4ce2fd1 100644 (file)
@@ -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);