aboutsummaryrefslogtreecommitdiff
path: root/mesalib/bin/extract_git_sha1
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-05-06 06:03:05 +0000
committermarha <marha@users.sourceforge.net>2011-05-06 06:03:05 +0000
commit151019725213fc50a8aa4db8c4524387fea8f476 (patch)
tree779a396c0c19adedb807e86566bea9e9045a3e7e /mesalib/bin/extract_git_sha1
parentd40f0a49c88fc7b5162a9d8f7b64b571094e8593 (diff)
downloadvcxsrv-151019725213fc50a8aa4db8c4524387fea8f476.tar.gz
vcxsrv-151019725213fc50a8aa4db8c4524387fea8f476.tar.bz2
vcxsrv-151019725213fc50a8aa4db8c4524387fea8f476.zip
glproto mesa git update 6 May 2011
Diffstat (limited to 'mesalib/bin/extract_git_sha1')
-rw-r--r--mesalib/bin/extract_git_sha130
1 files changed, 20 insertions, 10 deletions
diff --git a/mesalib/bin/extract_git_sha1 b/mesalib/bin/extract_git_sha1
index cf3006f8f..828387016 100644
--- a/mesalib/bin/extract_git_sha1
+++ b/mesalib/bin/extract_git_sha1
@@ -1,10 +1,20 @@
-#!/bin/sh
-touch src/mesa/main/git_sha1.h
-if which git > /dev/null; then
- # Extract the 7-digit "short" SHA1 for the current HEAD, convert
- # it to a string, and wrap it in a #define. This is used in
- # src/mesa/main/version.c to put the GIT SHA1 in the GL_VERSION string.
- git log -n 1 --oneline |\
- sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
- > src/mesa/main/git_sha1.h
-fi
+#!/bin/sh
+if [ ! -f src/mesa/main/git_sha1.h ]; then
+ touch src/mesa/main/git_sha1.h
+fi
+
+if [ ! -d .git ]; then
+ exit
+fi
+
+if which git > /dev/null; then
+ # Extract the 7-digit "short" SHA1 for the current HEAD, convert
+ # it to a string, and wrap it in a #define. This is used in
+ # src/mesa/main/version.c to put the GIT SHA1 in the GL_VERSION string.
+ git log -n 1 --oneline |\
+ sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
+ > src/mesa/main/git_sha1.h.tmp
+ if ! cmp -s src/mesa/main/git_sha1.h.tmp src/mesa/main/git_sha1.h; then
+ mv src/mesa/main/git_sha1.h.tmp src/mesa/main/git_sha1.h
+ fi
+fi