summaryrefslogtreecommitdiff
path: root/tools/get-scala-commit-sha
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2016-09-28 13:07:11 -0700
committerSeth Tisue <seth@tisue.net>2016-09-28 13:07:11 -0700
commita3008d5ff4871a6f4b86b48197f01027ffee4245 (patch)
treee770873fcc443ee168cf244b8b09b87fb8d3f6de /tools/get-scala-commit-sha
parent39b236b482202c8f3decc501e779e67f0414999a (diff)
parent5757e047a70504991a176aeb2fd8b829d9e9b093 (diff)
downloadscala-a3008d5ff4871a6f4b86b48197f01027ffee4245.tar.gz
scala-a3008d5ff4871a6f4b86b48197f01027ffee4245.tar.bz2
scala-a3008d5ff4871a6f4b86b48197f01027ffee4245.zip
Merge remote-tracking branch 'origin/2.12.0' into merge-2.12.0-to-2.12.x-sep-24
Diffstat (limited to 'tools/get-scala-commit-sha')
-rwxr-xr-xtools/get-scala-commit-sha14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/get-scala-commit-sha b/tools/get-scala-commit-sha
index eab90a4215..18289c7ca8 100755
--- a/tools/get-scala-commit-sha
+++ b/tools/get-scala-commit-sha
@@ -10,9 +10,13 @@
[[ $# -eq 0 ]] || cd "$1"
-# printf %016s is not portable for 0-padding, has to be a digit.
-# so we're stuck disassembling it.
-hash=$(git log -1 --format="%H" HEAD)
-hash=${hash#g}
-hash=${hash:0:10}
+if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
+ # printf %016s is not portable for 0-padding, has to be a digit.
+ # so we're stuck disassembling it.
+ hash=$(git log -1 --format="%H" HEAD)
+ hash=${hash#g}
+ hash=${hash:0:10}
+else
+ hash="unknown"
+fi
echo "$hash"