]> arthur.barton.de Git - netdata.git/commitdiff
Make updating of version.txt more robust
authorPhilip Whineray <phil@firehol.org>
Mon, 4 Apr 2016 22:01:21 +0000 (23:01 +0100)
committerPhilip Whineray <phil@firehol.org>
Mon, 4 Apr 2016 22:01:21 +0000 (23:01 +0100)
Do not run if we are not in a git repo
Fail and leave unchanged if git reports an error

web/Makefile.am

index a437f50af2c1d25f2652cbb0f72bd98f5566e349..f0e5bd9c9ab29edc03044b2fdf5df9a68d70f11b 100644 (file)
@@ -91,7 +91,14 @@ dist_webimages_DATA = \
         $(NULL)
 
 version.txt:
-       git log -n 1 | grep ^commit\ | cut -d " " -f 2 > version.txt.tmp
-       mv version.txt.tmp version.txt
+       if test -d ../.git; then \
+               if git log -n 1 > v.tmp; then \
+                       grep ^commit\  v.tmp | cut -d " " -f2 > version.txt; \
+                       rm -f v.tmp; \
+               else \
+                       rm -f v.tmp; \
+                       false; \
+               fi; \
+       fi
 
 .PHONY: version.txt