git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Sunil Kata <katasunil@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] rerere-autocommit option is added to facilitate auto-merge when rerere resolves all the conflicts automatically.
Date: Tue, 14 Jul 2015 16:07:08 +0530	[thread overview]
Message-ID: <1436870228-54075-1-git-send-email-katasunil@gmail.com> (raw)

Signed-off-by: Sunil Kata <katasunil@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)

             reply	other threads:[~2015-07-14 10:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 10:37 Sunil Kata [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-07-14 10:34 [PATCH] rerere-autocommit option is added to facilitate auto-merge when rerere resolves all the conflicts automatically Sunil Kata
2015-07-14 10:28 Sunil Kata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436870228-54075-1-git-send-email-katasunil@gmail.com \
    --to=katasunil@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).