Re: Commit ID in exported Tar Ball

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Glanzmann <thomas@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux