git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gisle Aas <gisle@aas.no>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] More precise description of 'git describe --abbrev'
Date: Fri, 30 Oct 2009 20:27:02 +0100	[thread overview]
Message-ID: <b48ea8a00910301227l4714eca9l767afd036938f494@mail.gmail.com> (raw)
In-Reply-To: <7viqdwlnam.fsf@alter.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

On Fri, Oct 30, 2009 at 20:00, Junio C Hamano <gitster@pobox.com> wrote:
> Adding an explanation like this so that nobody will be tempted to "fix"
> the example would be the best, I think.

Updated patch attached.

>
>     [torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
>     tags/v1.0.0-21-g975b
>
>     Note that the suffix you get if you type this command today may be
>     longer than what Linus saw above when he ran this command, as your
>     git repository may have new commits whose object names begin with
>     975b that did not exist back then, and "-g975b" suffix alone is not
>     sufficient to disambiguate these commits.
>
>

[-- Attachment #2: 0001-More-precise-description-of-git-describe-abbrev.patch --]
[-- Type: application/octet-stream, Size: 2430 bytes --]

From 5f6b405fa24861ae89207d334ea2e11f383a7e4e Mon Sep 17 00:00:00 2001
From: Gisle Aas <gisle@aas.no>
Date: Thu, 29 Oct 2009 22:29:35 +0100
Subject: [PATCH] More precise description of 'git describe --abbrev'

Also adds a note about why the output in the examples might give
different output today.

Signed-off-by: Gisle Aas <gisle@aas.no>
---
 Documentation/git-describe.txt |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index b231dbb..f8d91b1 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -44,7 +44,9 @@ OPTIONS
 
 --abbrev=<n>::
 	Instead of using the default 7 hexadecimal digits as the
-	abbreviated object name, use <n> digits.
+	abbreviated object name, use <n> digits or as many digits
+	are needed to form a unique object name.  An <n> of 0
+	will suppress long format, only showing the closest tag.
 
 --candidates=<n>::
 	Instead of considering only the 10 most recent tags as
@@ -68,8 +70,8 @@ OPTIONS
 	This is useful when you want to see parts of the commit object name
 	in "describe" output, even when the commit in question happens to be
 	a tagged version.  Instead of just emitting the tag name, it will
-	describe such a commit as v1.2-0-deadbeef (0th commit since tag v1.2
-	that points at object deadbeef....).
+	describe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2
+	that points at object deadbee....).
 
 --match <pattern>::
 	Only consider tags matching the given pattern (can be used to avoid
@@ -108,7 +110,7 @@ the output shows the reference path as well:
 	[torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
 	tags/v1.0.0-21-g975b
 
-	[torvalds@g5 git]$ git describe --all HEAD^
+	[torvalds@g5 git]$ git describe --all --abbrev=4 HEAD^
 	heads/lt/describe-7-g975b
 
 With --abbrev set to 0, the command can be used to find the
@@ -117,6 +119,13 @@ closest tagname without any suffix:
 	[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
 	tags/v1.0.0
 
+Note that the suffix you get if you type these commands today may be
+longer than what Linus saw above when he ran this command, as your
+git repository may have new commits whose object names begin with
+975b that did not exist back then, and "-g975b" suffix alone is not
+sufficient to disambiguate these commits.
+
+
 SEARCH STRATEGY
 ---------------
 
-- 
1.6.2.95.g934f7


  reply	other threads:[~2009-10-30 19:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 21:38 [PATCH] More precise description of 'git describe --abbrev' Gisle Aas
2009-10-29 22:47 ` Junio C Hamano
2009-10-30  8:01   ` Gisle Aas
2009-10-30 19:00     ` Junio C Hamano
2009-10-30 19:27       ` Gisle Aas [this message]
2009-10-30 20:18 ` Andreas Schwab
2009-10-30 21:53   ` Junio C Hamano
2009-11-04 22:04     ` Gisle Aas

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=b48ea8a00910301227l4714eca9l767afd036938f494@mail.gmail.com \
    --to=gisle@aas.no \
    --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).