]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: report commit ID in git versions as well
authorWilly Tarreau <w@1wt.eu>
Wed, 16 Jul 2014 09:38:52 +0000 (11:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Jul 2014 09:38:52 +0000 (11:38 +0200)
Currently, the commit ID appears in the sub-version in snapshots, but
when people use the git repository, we only have the commits count,
and not the last commit ID, which requires to count commits when
troubleshooting. This change ensures that unreleased versions also
report the commit ID before the commit number, such as :

      1.6-dev0-bbfd1a-50

Tagged versions will not have this, since the post-release commit count
is zero.

Makefile

index 707037be1464474b86f9eb263adc349bd4c8a915..0d1d13a2e2065b2dc571e03cec2959ab9bd7fa85 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -363,7 +363,7 @@ ifeq ($(IGNOREGIT),)
 VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*' --abbrev=0) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
 ifneq ($(VERSION),)
 # OK git is there and works.
-SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -dc '0-9'`; [ $$comms -gt 0 ] && echo "-$$comms")
+SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -dc '0-9'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms")
 VERDATE := $(shell git log -1 --pretty=format:%ci | cut -f1 -d' ' | tr '-' '/')
 endif
 endif