]> arthur.barton.de Git - netdata.git/commitdiff
Merge pull request #243 from glensc/commithash
authorCosta Tsaousis <costa@tsaousis.gr>
Sat, 16 Apr 2016 02:43:29 +0000 (05:43 +0300)
committerCosta Tsaousis <costa@tsaousis.gr>
Sat, 16 Apr 2016 02:43:29 +0000 (05:43 +0300)
simplify obtaining commit hash

web/Makefile.am

index a82dcf2f717a0367cf9d0af2e71160f1057da71e..1b6b918be97052567cdec7501ce86a6c602ba512 100644 (file)
@@ -92,15 +92,9 @@ dist_webimages_DATA = \
 
 version.txt:
        if test -d "$(top_srcdir)/.git"; then \
-               if git --git-dir="$(top_srcdir)/.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; \
-                       echo "0" > version.txt; \
-               fi; \
-       else \
-               echo "0" > version.txt; \
-       fi
+               git --git-dir="$(top_srcdir)/.git" log -n 1 --format=%H; \
+       fi > $@.tmp
+       test -s $@.tmp || echo 0 > $@.tmp
+       mv $@.tmp $@
 
 .PHONY: version.txt