Why does git-describe prefix the commit ID with the letter 'g'? -
typical output of git-describe
looks like
some-tag-32-gf31f980
where some-tag
tag name, 32
means described commit 32 commits after commit tag, , gf31f980
means commit id uniquely abbreviated f31f980
.
my question g
in gf31f980
. why there? first thought inserted disambiguate parsing of output of git-describe
. can't think of case in helps have it. example, 32
component might omitted, , there no way know output above describes commit 32 commits after tag some-tag
, rather commit at tag some-tag-32
. g
doesn't this.
a regex match extract commit id can search /-g([0-9a-f]+)$/
. there no easy way simplify this; can't /-g(.*)$/
example because might erroneously match g
in tag name. without g
still /-([0-9a-f]+)$/
, g
isn't helping there. non-regex parsing processes behave similarly.
the g
generated explicitly; relevant source code (around line 240 of builtin/describe.c
) is:
static void show_suffix(int depth, const unsigned char *sha1) { printf("-%d-g%s", depth, find_unique_abbrev(sha1, abbrev)); }
it's hard search information this, because relevant term, g
, stopword.
what's g
for?
jesse luehrs pointed out on twitter question answered in git-describe
man page:
the "g" prefix stands "git" , used allow describing version of software depending on scm software managed with.
Comments
Post a Comment