On 06/15/2017 08:14 AM, Eric Engestrom wrote:
On Thursday, 2017-06-15 08:06:54 -0600, Brian Paul wrote:
The SCons build has been using 10 digits of the git hash id for the
MESA_GIT_SHA1 string in git_sha1.h for about a year now. I bumped it
up after running into a case where a 7-digit hash ID was ambiguous.
This patch makes the same change for the autotools build.
The command "git log | grep "^commit" | cut -b 8-14 | sort | uniq -d"
shows there are currently 17 cases where 7 digits of hash id are
ambiguous on master (probably quite a few more if we'd consider other
branches).
Instead of using "git log -n 1 --oneline" use
"git rev-parse --short=10 HEAD" to get the HEAD hash id.
v2: use printf instead of sed, per Eric's suggestion.
And good use of the backtick, instead of $(shell), to be compatible with
non-GNU make; I would've made that mistake :)
The $(shell) approach didn't work at all for me. Not sure why.
-Brian
Reviewed-by: Eric Engestrom <eric.engest...@imgtec.com>
---
src/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index aa5f8aa..df912c4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,8 +28,8 @@ git_sha1.h.tmp:
@touch git_sha1.h.tmp
@if test -e $(top_srcdir)/.git; then \
if which git > /dev/null; then \
- git --git-dir=$(top_srcdir)/.git log -n 1 --oneline | \
- sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
+ printf '#define MESA_GIT_SHA1 "git-%s"\n' \
+ `git --git-dir=$(top_srcdir)/.git rev-parse --short=10
HEAD` \
> git_sha1.h.tmp ; \
fi \
fi
--
1.9.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev