]> git.kaiwu.me - haproxy.git/commitdiff
[BUILD] report commit date and not author's date as build date
authorWilly Tarreau <w@1wt.eu>
Tue, 14 Jul 2009 11:24:16 +0000 (13:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 Jul 2009 20:01:41 +0000 (22:01 +0200)
By default, when building from a git tree, haproxy's release date is
set to the last commit's date. But it was the wrong date which was
used, the initial patch's date, which can cause time jumps in the
past when an old patch gets merged. What we want is the commit date,
which reflects the correct code history.
(cherry picked from commit 446024e7fb5faef86cd6e2c0aba3c4524ad77705)
(cherry picked from commit 3157b9bde997669b4cce627cb4f3b0eed1760e6b)

Makefile

index 5995b49e2f4aa6a5a1a221c9106ac82db3bae97d..8f0262c88aa2b6869bccb3b5c35e2420e082cd25 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -257,8 +257,8 @@ ifeq ($(IGNOREGIT),)
 VERSION := $(shell [ -d .git/. ] && ref=`(git-describe --tags) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
 ifneq ($(VERSION),)
 # OK git is there and works.
-SUBVERS := $(shell comms=`git-log --no-merges v$(VERSION).. 2>/dev/null |grep -c ^commit `; [ $$comms -gt 0 ] && echo "-$$comms" )
-VERDATE := $(shell date +%Y/%m/%d -d "`git-log HEAD^.. 2>/dev/null | grep -m 1 ^Date: | cut -f2- -d: | cut -f1 -d+`" )
+SUBVERS := $(shell comms=`git log --no-merges v$(VERSION).. 2>/dev/null |grep -c ^commit `; [ $$comms -gt 0 ] && echo "-$$comms" )
+VERDATE := $(shell date +%Y/%m/%d -d "`git log --pretty=fuller HEAD^.. 2>/dev/null | sed -ne '/^CommitDate:/{s/\(^[^ ]*:\)\|\( [-+].*\)//gp;q}'`" )
 endif
 endif