[PATCH 6/7 v3] merge-base: add "--bisect-replace" option to use fixed up revs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
---
 Documentation/git-merge-base.txt |    6 +++++-
 builtin-merge-base.c             |    8 +++++++-
 t/t6035-bisect-replace.sh        |    7 +++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index 2f0c525..af174f7 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -8,7 +8,7 @@ git-merge-base - Find as good common ancestors as possible for a merge
 
 SYNOPSIS
 --------
-'git merge-base' [--all] <commit> <commit>...
+'git merge-base' [--all] [--bisect-replace] <commit> <commit>...
 
 DESCRIPTION
 -----------
@@ -32,6 +32,10 @@ OPTIONS
 --all::
 	Output all merge bases for the commits, instead of just one.
 
+--bisect-replace::
+	Use fixed up history from "bisect-replace-*" branches when
+	computing merge bases.
+
 DISCUSSION
 ----------
 
diff --git a/builtin-merge-base.c b/builtin-merge-base.c
index 03fc1c2..31c0015 100644
--- a/builtin-merge-base.c
+++ b/builtin-merge-base.c
@@ -46,9 +46,13 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
 	struct commit **rev;
 	int rev_nr = 0;
 	int show_all = 0;
+	int bisect_replace = 0;
 
 	struct option options[] = {
-		OPT_BOOLEAN('a', "all", &show_all, "outputs all common ancestors"),
+		OPT_BOOLEAN('a', "all", &show_all,
+			    "outputs all common ancestors"),
+		OPT_BOOLEAN(0, "bisect-replace", &bisect_replace,
+			    "use revs from 'bisect-replace-*' branches"),
 		OPT_END()
 	};
 
@@ -56,6 +60,8 @@ int cmd_merge_base(int argc, const char **argv, const char *prefix)
 	argc = parse_options(argc, argv, options, merge_base_usage, 0);
 	if (argc < 2)
 		usage_with_options(merge_base_usage, options);
+	if (bisect_replace)
+		bisect_replace_all();
 	rev = xmalloc(argc * sizeof(*rev));
 	while (argc-- > 0)
 		rev[rev_nr++] = get_commit_reference(*argv++);
diff --git a/t/t6035-bisect-replace.sh b/t/t6035-bisect-replace.sh
index bc07206..8fe7cc5 100755
--- a/t/t6035-bisect-replace.sh
+++ b/t/t6035-bisect-replace.sh
@@ -137,6 +137,13 @@ test_expect_success '"git rev-list --bisect-replace" works' '
      test_cmp rev_list.expect rev_list.output
 '
 
+test_expect_success '"git merge-base --bisect-replace" works' '
+     hash=$(git merge-base --all --bisect-replace $HASH7 $HASHFIX3) &&
+     test "$hash" = "$HASHFIX3" &&
+     hash=$(git merge-base --all --bisect-replace $HASH7 $HASH3) &&
+     test "$hash" = "$HASH1"
+'
+
 #
 #
 test_done
-- 
1.6.0.3.619.g9a6a

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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux