Make updating of version.txt more robust
Do not run if we are not in a git repo Fail and leave unchanged if git reports an error
Philip Whineray committed
Apr 4, 2016 at 23:01 UTC
2d24458219f9c307c4b6310abf0d53d79e98de0d
1 file changed
+9
-2
web/Makefile.am
+9
-2
@@ -91,7 +91,14 @@ dist_webimages_DATA = \
91
$(NULL)
92
93
version.txt:
94
- git log -n 1 | grep ^commit\ | cut -d " " -f 2 > version.txt.tmp
95
- mv version.txt.tmp version.txt
94
+ if test -d ../.git; then \
95
+ if git log -n 1 > v.tmp; then \
96
+ grep ^commit\ v.tmp | cut -d " " -f2 > version.txt; \
97
+ rm -f v.tmp; \
98
+ else \
99
+ rm -f v.tmp; \
100
+ false; \
101
+ fi; \
102
+ fi
103
104
.PHONY: version.txt