git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 3/3] git-merge-base/git-show-branch --merge-base: Documentation and test
Date: Wed,  5 Aug 2009 09:59:20 +0200	[thread overview]
Message-ID: <1249459160-3931-4-git-send-email-git@drmicha.warpmail.net> (raw)
In-Reply-To: <1249459160-3931-3-git-send-email-git@drmicha.warpmail.net>

Currently, the documentation suggests that 'git merge-base -a' and 'git
show-branch --merge-base' are equivalent (in fact it claims that the
former cannot handle more than two revs).

Alas, the handling of more than two revs is very different. Document
this by tests and correct the documentation to reflect this.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/git-merge-base.txt  |    4 ++++
 Documentation/git-show-branch.txt |    8 +++++---
 builtin-show-branch.c             |    2 +-
 t/t6010-merge-base.sh             |    6 ++++++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index 00e4003..ce5b369 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -27,6 +27,10 @@ commits on the command line.  As the most common special case, specifying only
 two commits on the command line means computing the merge base between
 the given two commits.
 
+As a consequence, the 'merge base' is not necessarily contained in each of the
+commit arguments if more than two commits are specified. This is different
+from linkgit:git-show-branch[1] when used with the `--merge-base` option.
+
 OPTIONS
 -------
 -a::
diff --git a/Documentation/git-show-branch.txt b/Documentation/git-show-branch.txt
index 2c78c25..7343361 100644
--- a/Documentation/git-show-branch.txt
+++ b/Documentation/git-show-branch.txt
@@ -82,9 +82,11 @@ OPTIONS
 	Synonym to `--more=-1`
 
 --merge-base::
-	Instead of showing the commit list, just act like the
-	'git-merge-base -a' command, except that it can accept
-	more than two heads.
+	Instead of showing the commit list, determine possible
+	merge bases for the specified commits. All merge bases
+	will be contained in all specified commits. This is
+	different from how linkgit:git-merge-base[1] handles
+	the case of three or more commits.
 
 --independent::
 	Among the <reference>s given, display only the ones that
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 03bdea6..3510a86 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -665,7 +665,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
 		OPT_BOOLEAN(0, "sha1-name", &sha1_name,
 			    "name commits with their object names"),
 		OPT_BOOLEAN(0, "merge-base", &merge_base,
-			    "act like git merge-base -a"),
+			    "show possible merge bases"),
 		OPT_BOOLEAN(0, "independent", &independent,
 			    "show refs unreachable from any other ref"),
 		OPT_BOOLEAN(0, "topo-order", &lifo,
diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh
index 79124ec..0144d9e 100755
--- a/t/t6010-merge-base.sh
+++ b/t/t6010-merge-base.sh
@@ -149,6 +149,12 @@ test_expect_success 'merge-base A B C' '
 	test "$MM1" = "$MB"
 '
 
+test_expect_success 'merge-base A B C using show-branch' '
+	MB=$(git show-branch --merge-base MMA MMB MMC) &&
+	MMR=$(git rev-parse --verify MMR) &&
+	test "$MMR" = "$MB"
+'
+
 test_expect_success 'criss-cross merge-base for octopus-step (setup)' '
 	git reset --hard MMR &&
 	test_tick && git commit --allow-empty -m 1 && git tag CC1 &&
-- 
1.6.4.70.g9c084

      reply	other threads:[~2009-08-05  7:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05  7:59 [PATCH 0/3] git-merge-base -a vs. git-show-branch --merge-base Michael J Gruber
2009-08-05  7:59 ` [PATCH 1/3] t6010-merge-base.sh: Depict the octopus test graph Michael J Gruber
2009-08-05  7:59   ` [PATCH 2/3] git-merge-base/git-show-branch: Cleanup documentation and usage Michael J Gruber
2009-08-05  7:59     ` Michael J Gruber [this message]

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

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

  git send-email \
    --in-reply-to=1249459160-3931-4-git-send-email-git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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 NNTP newsgroup(s).