diff options
author | Seth Tisue <seth@tisue.net> | 2016-10-05 11:35:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-05 11:35:53 -0500 |
commit | 9d3f0777ff883a7c59da3fa7fee156890f51701e (patch) | |
tree | 571d67a2b815db2c7b32c36160629dabfa7dba48 /tools | |
parent | 388053544829c53c95cb6f9bf24ac366e950bac0 (diff) | |
parent | fb53465ca7df23aa996f4bd3c03367f98f37d283 (diff) | |
download | scala-9d3f0777ff883a7c59da3fa7fee156890f51701e.tar.gz scala-9d3f0777ff883a7c59da3fa7fee156890f51701e.tar.bz2 scala-9d3f0777ff883a7c59da3fa7fee156890f51701e.zip |
Merge pull request #5416 from SethTisue/merge-2.12.0-to-2.12.x-sep-24
merge 2.12.0 onto 2.12.x [ci: last-only]
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/get-scala-commit-date | 9 | ||||
-rwxr-xr-x | tools/get-scala-commit-sha | 14 |
2 files changed, 16 insertions, 7 deletions
diff --git a/tools/get-scala-commit-date b/tools/get-scala-commit-date index b2e4e10770..6511ed98ca 100755 --- a/tools/get-scala-commit-date +++ b/tools/get-scala-commit-date @@ -10,8 +10,13 @@ [[ $# -eq 0 ]] || cd "$1" -lastcommitdate=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 1) -lastcommithours=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 2) +if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then + lastcommitdate=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 1) + lastcommithours=$(git log --format="%ci" HEAD | head -n 1 | cut -d ' ' -f 2) +else + lastcommitdate=$(date +%Y-%m-%d) + lastcommithours=$(date +%H:%M:%S) +fi # 20120324 echo "${lastcommitdate//-/}-${lastcommithours//:/}" 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" |