From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Couder Subject: [PATCH 6/9 v5] merge-base: add "--bisect-replace" option to use fixed up revs Date: Mon, 24 Nov 2008 22:18:00 +0100 Message-ID: <20081124221800.e1f6c407.chriscool@tuxfamily.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org, Johannes Schindelin , "H. Peter Anvin" To: Junio C Hamano X-From: git-owner@vger.kernel.org Tue Nov 25 01:51:07 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1L4m8u-0004rk-PP for gcvg-git-2@gmane.org; Tue, 25 Nov 2008 01:51:05 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753494AbYKYAtt (ORCPT ); Mon, 24 Nov 2008 19:49:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752709AbYKYAtt (ORCPT ); Mon, 24 Nov 2008 19:49:49 -0500 Received: from smtp6-g19.free.fr ([212.27.42.36]:34516 "EHLO smtp6-g19.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752471AbYKYAts (ORCPT ); Mon, 24 Nov 2008 19:49:48 -0500 Received: from smtp6-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp6-g19.free.fr (Postfix) with ESMTP id 14822704F; Tue, 25 Nov 2008 01:36:09 +0100 (CET) Received: from localhost.boubyland (gre92-7-82-243-130-161.fbx.proxad.net [82.243.130.161]) by smtp6-g19.free.fr (Postfix) with SMTP id 28643AC91; Mon, 24 Nov 2008 22:16:29 +0100 (CET) X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.11; i486-pc-linux-gnu) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Signed-off-by: Christian Couder --- 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..2a41e33 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] ... +'git merge-base' [--all] [--bisect-replace] ... 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 "refs/replace/bisect/*" refs when + computing merge bases. + DISCUSSION ---------- diff --git a/builtin-merge-base.c b/builtin-merge-base.c index 03fc1c2..6e58660 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 'refs/replace/bisect/*' refs"), 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.5.6.1.1657.g6a50