Merge branch 'mg/killed-merge'
authorJunio C Hamano <gitster@pobox.com>
Sun, 27 Aug 2017 05:55:10 +0000 (22:55 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 27 Aug 2017 05:55:10 +0000 (22:55 -0700)
Killing "git merge --edit" before the editor returns control left
the repository in a state with MERGE_MSG but without MERGE_HEAD,
which incorrectly tells the subsequent "git commit" that there was
a squash merge in progress.  This has been fixed.

* mg/killed-merge:
  merge: save merge state earlier
  merge: split write_merge_state in two
  merge: clarify call chain
  Documentation/git-merge: explain --continue

1  2 
Documentation/git-merge.txt
builtin/merge.c

Simple merge
diff --cc builtin/merge.c
@@@ -764,10 -762,11 +765,13 @@@ static void prepare_to_commit(struct co
        struct strbuf msg = STRBUF_INIT;
        strbuf_addbuf(&msg, &merge_msg);
        strbuf_addch(&msg, '\n');
+       if (squash)
+               BUG("the control must not reach here under --squash");
        if (0 < option_edit)
                strbuf_commented_addf(&msg, _(merge_editor_comment), comment_line_char);
 +      if (signoff)
 +              append_signoff(&msg, ignore_non_trailer(msg.buf, msg.len), 0);
+       write_merge_heads(remoteheads);
        write_file_buf(git_path_merge_msg(), msg.buf, msg.len);
        if (run_commit_hook(0 < option_edit, get_index_file(), "prepare-commit-msg",
                            git_path_merge_msg(), "merge", NULL))