summaryrefslogtreecommitdiff
blob: bb8f107312f903d8e2b2848bec5c707e65ac6bf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/support/git-rev.sh b/support/git-rev.sh
index 5dce3d0..4aadae6 100755
--- a/support/git-rev.sh
+++ b/support/git-rev.sh
@@ -1,5 +1,8 @@
 #!/bin/sh
 
 ## cmake doesn't read the variable when it doesn't end with a newline, and I haven't figured out how to have it add a newline directly...
-echo -n "`git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h"`\n"
-
+if [ -d .git ]; then
+  echo "`git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h"`"
+else
+  echo "<unknown>"
+fi