aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle18
1 files changed, 3 insertions, 15 deletions
diff --git a/build.gradle b/build.gradle
index fe9c877a..ef7fc0a6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -187,21 +187,9 @@ task releases(type: Copy) {
def getCheckedOutGitCommitHash() {
- def gitFolder = "$projectDir/.git/"
- def takeFromHash = 40
- /*
- * '.git/HEAD' contains either
- * in case of detached head: the currently checked out commit hash
- * otherwise: a reference to a file containing the current commit hash
- */
- def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD
- def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd
- // def isRef = head.length > 1 // ref: refs/heads/master
-
- if(isCommit) return head[0].trim().take(takeFromHash) // e5a7c79edabb
-
- def refHead = new File(gitFolder + head[1].trim()) // .git/refs/heads/master
- refHead.text.trim().take takeFromHash
+ def takeFromHash = 40
+ 'git rev-parse --verify HEAD'.execute().text.trim().take takeFromHash
+
}
/*
task docs(type: Javadoc) {