All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Thomas Glanzmann <thomas@glanzmann.de>
Cc: "Brian Gernhardt" <benji@silverinsanity.com>,
	"Junio C Hamano" <junkio@cox.net>,
	"René Scharfe" <rene.scharfe@lsrfire.ath.cx>,
	"Frank Lichtenheld" <frank@lichtenheld.de>,
	"Johan Herland" <johan@herland.net>,
	git@vger.kernel.org,
	"Michael Gernoth" <simigern@cip.informatik.uni-erlangen.de>
Subject: Re: Commit ID in exported Tar Ball
Date: Mon, 21 May 2007 02:29:53 -0400	[thread overview]
Message-ID: <20070521062953.GL3141@spearce.org> (raw)
In-Reply-To: <20070520163026.GA7387@cip.informatik.uni-erlangen.de>

Thomas Glanzmann <thomas@glanzmann.de> wrote:
> so this output is useless if you don't have tagged the commit which
> isn't the case. But thanks for the awareness.

Thanks for not quoting Brian's reply.  Because I had to go and
quote it manually, so I can say its *NOT* useless...

> Brian Gernhardt <benji@silverinsanity.com> wrote:
> > For version information it is far more useful to use --tags or no
> > options (annotated tags only) instead of --all.
> > 
> > # On git.git's master this morning:
> > $ git describe HEAD
> > v1.5.2

Here whatever HEAD's commit is is exactly the commit that the tag
v1.5.2 points at.  This commit is definately v1.5.2.

> > $ git describe HEAD^^
> > v1.5.2-rc3-97-g03f6db0

Here whatever commit is 2 commits earlier than HEAD is 97 commits
*after* v1.5.2-rc3 was tagged.  That's a good deal of information
right there.  I know its v1.5.2-rc3 plus a bunch of additional
commits (97 to be exact).  Add another commit and that 97 will
go to 98.  Wow, look, an automatic version counter!  No user
intervention required!

Sometimes I don't even bother tagging git-gui fixes, for exactly
that reason.  The output of git-describe is giving me a count along
my maint branch, or my master branch.

Now that g03f6db0 suffix is also very useful, it means its the
commit whose SHA- starts with 03f6db0.  That abbreviated SHA-1
is unique at the time that git-describe ran.  At 8 hex digits it
will probably also stay unique for quite some time, even in large
projects like the kernel.

And even if that isn't unique later on, I doubt there will be another
commit with the same leading hex digits that is also 97 commits
after v1.5.2, as counted by `git-rev-list v1.5.2..$it | wc -l`.
So even in the case of a later duplicate, we can get back a full
SHA-1.

And did you know that Git knows how to parse those, and can checkout
that commit?

  $ git checkout v1.5.2-rc3-97-g03f6db0
  Note: moving to "v1.5.2-rc3-97-g03f6db0" which isn't a local branch
  If you want to create a new branch from this checkout, you may do so
  (now or later) by using -b with the checkout command again. Example:
    git checkout -b <new_branch_name>
  HEAD is now at 03f6db0... Merge branch 'maint' to synchronize with 1.5.1.6

Wow.  Magic!  Not useless!

-- 
Shawn.

  parent reply	other threads:[~2007-05-21  6:30 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 16:38 Commit ID in exported Tar Ball Thomas Glanzmann
2007-05-17 16:57 ` Johan Herland
2007-05-17 17:11   ` Frank Lichtenheld
2007-05-17 17:14     ` Thomas Glanzmann
2007-05-17 17:28     ` Johan Herland
2007-05-18 22:09       ` [PATCH] git-archive: convert archive entries like checkouts do René Scharfe
2007-05-18 22:27         ` Daniel Barkalow
2007-05-18 22:58           ` René Scharfe
2007-05-19 20:22     ` Commit ID in exported Tar Ball René Scharfe
2007-05-19 21:00       ` Junio C Hamano
2007-05-19 21:39         ` A Large Angry SCM
2007-05-20  0:15         ` René Scharfe
2007-05-20 11:20           ` René Scharfe
2007-05-20  3:57         ` Shawn O. Pearce
2007-05-20 11:20           ` René Scharfe
2007-05-21  6:02             ` Shawn O. Pearce
2007-05-21 12:09               ` Petr Baudis
2007-05-21 19:54               ` René Scharfe
2007-05-22 22:26                 ` René Scharfe
2007-05-22 22:54                   ` Junio C Hamano
2007-05-22 23:44                     ` René Scharfe
2007-05-23  5:22                       ` Shawn O. Pearce
2007-05-20 11:20           ` René Scharfe
2007-05-20 16:10           ` Thomas Glanzmann
2007-05-20 16:28             ` Brian Gernhardt
2007-05-20 16:30               ` Thomas Glanzmann
2007-05-21  6:19                 ` Peter Baumann
2007-05-21  6:24                   ` Thomas Glanzmann
2007-05-21  6:29                 ` Shawn O. Pearce [this message]
2007-05-21  6:37                   ` Thomas Glanzmann
2007-05-21  6:53                     ` Shawn O. Pearce
2007-05-21  7:00                       ` Thomas Glanzmann
2007-05-21  6:56                     ` Brian Gernhardt
2007-05-21  7:02                       ` Thomas Glanzmann
2007-05-17 17:48   ` Frank Lichtenheld
2007-05-17 18:05     ` Johan Herland
2007-05-17 17:02 ` Kristian Høgsberg
2007-05-17 17:13   ` Thomas Glanzmann

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=20070521062953.GL3141@spearce.org \
    --to=spearce@spearce.org \
    --cc=benji@silverinsanity.com \
    --cc=frank@lichtenheld.de \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    --cc=junkio@cox.net \
    --cc=rene.scharfe@lsrfire.ath.cx \
    --cc=simigern@cip.informatik.uni-erlangen.de \
    --cc=thomas@glanzmann.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.