Merge branch 'nd/merge-quit'
authorJunio C Hamano <gitster@pobox.com>
Thu, 13 Jun 2019 20:19:41 +0000 (13:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 Jun 2019 20:19:41 +0000 (13:19 -0700)
"git merge" learned "--quit" option that cleans up the in-progress
merge while leaving the working tree and the index still in a mess.

* nd/merge-quit:
  merge: add --quit
  merge: remove drop_save() in favor of remove_merge_branch_state()

1  2 
Documentation/git-merge.txt
branch.c
branch.h
builtin/merge.c
t/t7600-merge.sh

Simple merge
diff --cc branch.c
+++ b/branch.c
@@@ -345,7 -343,14 +344,13 @@@ void remove_merge_branch_state(struct r
        unlink(git_path_merge_rr(r));
        unlink(git_path_merge_msg(r));
        unlink(git_path_merge_mode(r));
 -      unlink(git_path_cherry_pick_head(r));
 -      unlink(git_path_revert_head(r));
+ }
+ void remove_branch_state(struct repository *r)
+ {
++      sequencer_post_commit_cleanup(r);
        unlink(git_path_squash_msg(r));
+       remove_merge_branch_state(r);
  }
  
  void die_if_checked_out(const char *branch, int ignore_current_worktree)
diff --cc branch.h
+++ b/branch.h
@@@ -58,8 -58,14 +58,14 @@@ int validate_branchname(const char *nam
   * Return 1 if the named branch already exists; return 0 otherwise.
   * Fill ref with the full refname for the branch.
   */
 -extern int validate_new_branchname(const char *name, struct strbuf *ref, int force);
 +int validate_new_branchname(const char *name, struct strbuf *ref, int force);
  
+ /*
+  * Remove information about the merge state on the current
+  * branch. (E.g., MERGE_HEAD)
+  */
+ void remove_merge_branch_state(struct repository *r);
  /*
   * Remove information about the state of working on the current
   * branch. (E.g., MERGE_HEAD)
diff --cc builtin/merge.c
@@@ -37,8 -37,8 +37,9 @@@
  #include "packfile.h"
  #include "tag.h"
  #include "alias.h"
+ #include "branch.h"
  #include "commit-reach.h"
 +#include "wt-status.h"
  
  #define DEFAULT_TWOHEAD (1<<0)
  #define DEFAULT_OCTOPUS (1<<1)
Simple merge