rerere-autocommit option is added to facilitate auto-merge when rerere resolves all the conflicts automatically.
PATCH 1/1 rerere-autocommit option is added to facilitate auto-merge when rerere resolves all the conflicts automatically.
Signed-off-by Sunil Kata <[email protected]>
--- Documentation/git-merge.txt | 8 +++++++- builtin/merge.c | 8 +++++++- rerere.h | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-)
Documentation/git-merge.txt +7 -1
@@ -11,7 +11,8 @@ SYNOPSIS [verse] 'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit] [-s <strategy>] [-X <strategy-option>] [-S[<key-id>]] - [--[no-]rerere-autoupdate] [-m <msg>] [<commit>...] + [--[no-]rerere-autoupdate] [--rerere-autocommit] + [-m <msg>] [<commit>...] 'git merge' <msg> HEAD <commit>... 'git merge' --abort
@@ -84,6 +85,11 @@ invocations. Allow the rerere mechanism to update the index with the result of auto-conflict resolution if possible. +--rerere-autocommit:: + Allow the rerere mechanism to auto merge after updating + the index with the result of auto-conflict resolution + if possible + --abort:: Abort the current conflict resolution process, and try to reconstruct the pre-merge state.
builtin/merge.c +7 -1
@@ -63,6 +63,7 @@ static char *branch_mergeoptions;static int option_renormalize;static int verbosity;static int allow_rerere_auto; +static int allow_rerere_commit;static int abort_current_merge;static int show_progress =-1 ;static int default_to_upstream =1 ;
@@ -209,6 +210,7 @@ static struct option builtin_merge_options[] = {N_ ("abort if fast-forward is not possible" ), PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, FF_ONLY },OPT_RERERE_AUTOUPDATE (&allow_rerere_auto), +OPT_RERERE_AUTOCOMMIT (&allow_rerere_commit),OPT_BOOL (0 ,"verify-signatures" , &verify_signatures,N_ ("Verify that the named commit has a valid GPG signature" )), OPT_CALLBACK('s', "strategy", &use_strategies, N_("strategy"),
@@ -1553,6 +1555,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)* handle the given merge at all. */ if (ret ==1 ) { +if (allow_rerere_commit) { +rerere (RERERE_AUTOUPDATE ); + goto automerge; + }int cnt =evaluate_result ();if (best_cnt <=0 || cnt <= best_cnt) {
@@ -1565,7 +1571,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)else continue ; } - +automerge:/* Automerge succeeded. */ write_tree_trivial (result_tree); automerge_was_ok =1 ;
rerere.h +2 -0
@@ -25,5 +25,7 @@ extern void rerere_gc(struct string_list *);#define OPT_RERERE_AUTOUPDATE (v) OPT_UYN(0, "rerere-autoupdate", (v), \ N_("update the index with reused conflict resolution if possible")) +#define OPT_RERERE_AUTOCOMMIT (v) OPT_BOOL(0 , "rerere-autocommit", (v), \ + N_("autocommit with reused conflict resolution if possible"))#endif
Signature · 1 line
2.3.2 (Apple Git-55)