author | Andy Parkins <andyparkins@gmail.com> | |
Fri, 26 Jan 2007 14:28:55 +0000 (14:28 +0000) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 27 Jan 2007 06:38:52 +0000 (22:38 -0800) | ||
commit | f127404c45eff139037834a6464b68fbe1798e16 | |
tree | c6d335d5273e9e1bdd2a17b4a3ebd6e56c6468f1 | tree | snapshot |
parent | eb3204dfbb71626f83a95d2ab24569226a39c601 | commit | diff |
If abbrev is set to zero in git-describe, don't add the unique suffix
When on a non-tag commit, git-describe normally outputs descriptions of
the form
v1.0.0-g1234567890
Some scripts (for example the update hook script) might just want to
know the name of the nearest tag, so they then have to do
x=$(git-describe HEAD | sed 's/-g*//')
This is costly, but more importantly is fragile as it is relying on the
output format of git-describe, which we would then have to maintain
forever.
This patch adds support for setting the --abbrev option to zero. In
that case git-describe does as it always has, but outputs only the
nearest found tag instead of a completely unique name. This means that
scripts would not have to parse the output format and won't need
changing if the git-describe suffix is ever changed.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
When on a non-tag commit, git-describe normally outputs descriptions of
the form
v1.0.0-g1234567890
Some scripts (for example the update hook script) might just want to
know the name of the nearest tag, so they then have to do
x=$(git-describe HEAD | sed 's/-g*//')
This is costly, but more importantly is fragile as it is relying on the
output format of git-describe, which we would then have to maintain
forever.
This patch adds support for setting the --abbrev option to zero. In
that case git-describe does as it always has, but outputs only the
nearest found tag instead of a completely unique name. This means that
scripts would not have to parse the output format and won't need
changing if the git-describe suffix is ever changed.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-describe.c | diff | blob | history |