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
index a594cc23e25458250885244f477a5d4879df2537,1db0601a1124be0dcb83c4805e37baa55bfff5b5..e70838fb872f98820a641ccaccc06fd4c0c381f7
+++ 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
index 6f38db14e9c496c55e204791e5ab0a5243186118,c90ba9d7bfa2db0588092200f98c1e0c2cc1b80f..064ee576f29764637dfdc62141973e935f8fd488
+++ 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
index e96f72af8044769df6b4ef42f0525b572b0c39e2,598d56edfeb30a1a58ea0cf8b9dbdd0e4e2ba166..5c83f89cc639c43754a1091be80c32a486c9a291
@@@ -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