From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Subject: [PATCH 2/2] describe: document and test --first-parent
Date: Tue, 11 Sep 2012 15:51:52 +0200 [thread overview]
Message-ID: <a0f0cf4e9cf41577d01d728007250f78e18a9ac0.1347370970.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <cover.1347370970.git.git@drmicha.warpmail.net>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Documentation/git-describe.txt | 16 +++++++++++++++-
t/t6120-describe.sh | 7 +++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index 72d6bb6..9fb5c84 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -84,6 +84,10 @@ OPTIONS
Only consider tags matching the given pattern (can be used to avoid
leaking private tags made from the repository).
+--first-parent::
+ Only consider tags which can be reached from '<committish>' by a first
+ parent walk, i.e. only those which are not on side branches.
+
--always::
Show uniquely abbreviated commit object as fallback.
@@ -129,6 +133,14 @@ closest tagname without any suffix:
[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
tags/v1.0.0
+With --first-parent, tags on side branches are not considered:
+
+ $ git describe v1.1.0^
+ v1.0.7-44-ge77f489
+
+ $ git describe --first-parent v1.1.0^
+ v1.0.0-41-ge77f489
+
Note that the suffix you get if you type these commands today may be
longer than what Linus saw above when he ran these commands, as your
git repository may have new commits whose object names begin with
@@ -148,7 +160,9 @@ is found, its name will be output and searching will stop.
If an exact match was not found, 'git describe' will walk back
through the commit history to locate an ancestor commit which
has been tagged. The ancestor's tag will be output along with an
-abbreviation of the input committish's SHA1.
+abbreviation of the input committish's SHA1. With '--first-parent',
+'git describe' will walk the history only along the first parent
+of each commit.
If multiple tags were found during the walk then the tag which
has the fewest commits different from the input committish will be
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index f67aa6f..2524236 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -103,6 +103,13 @@ check_describe c-* --tags HEAD^^2
check_describe B --tags HEAD^^2^
check_describe e --tags HEAD^^^
+check_describe R-* --first-parent HEAD
+check_describe R-* --first-parent HEAD^
+check_describe R-* --first-parent HEAD^^
+check_describe B-* --first-parent HEAD^^2
+check_describe B --first-parent HEAD^^2^
+check_describe R-* --first-parent HEAD^^^
+
check_describe heads/master --all HEAD
check_describe tags/c-* --all HEAD^
check_describe tags/e --all HEAD^^^
--
1.7.12.463.gbd9d638
next prev parent reply other threads:[~2012-09-11 13:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 13:51 [PATCH 0/2] git describe --first-parent Michael J Gruber
2012-09-11 13:51 ` [PATCH 1/2] git-describe: introduce --first-parent Michael J Gruber
2012-09-11 16:41 ` Junio C Hamano
2012-09-11 13:51 ` Michael J Gruber [this message]
2012-09-11 17:20 ` [PATCH 2/2] describe: document and test --first-parent Junio C Hamano
2012-09-11 16:10 ` [PATCH 0/2] git describe --first-parent Junio C Hamano
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=a0f0cf4e9cf41577d01d728007250f78e18a9ac0.1347370970.git.git@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--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.
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).