Signed-off-by: Sunil Kata <katasu...@gmail.com>
---
 Documentation/git-merge.txt | 8 +++++++-
 builtin/merge.c             | 8 +++++++-
 rerere.h                    | 2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 273a100..6c60286 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -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.
diff --git a/builtin/merge.c b/builtin/merge.c
index 85c54dc..7142567 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -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;
diff --git a/rerere.h b/rerere.h
index 2956c2e..4b36570 100644
--- a/rerere.h
+++ b/rerere.h
@@ -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
-- 
2.3.2 (Apple Git-55)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to