From 069a36984e781b279b44537222d3f05072bf667d Mon Sep 17 00:00:00 2001 From: Ezerous Date: Tue, 17 Sep 2024 15:16:09 +0300 Subject: [PATCH] fix: git dir for Grgit --- app/gradle/grgit.gradle | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/gradle/grgit.gradle b/app/gradle/grgit.gradle index 53ae4204..5badd1f7 100644 --- a/app/gradle/grgit.gradle +++ b/app/gradle/grgit.gradle @@ -10,9 +10,13 @@ buildscript { } } -static def getCurrentBranch() { +def getGrgit() { + return Grgit.open(currentDir: project.rootDir) +} + +def getCurrentBranch() { try { - def grgit = Grgit.open() + def grgit = getGrgit() def currentBranch = grgit.branch.getCurrent().name grgit.close() return currentBranch @@ -21,9 +25,9 @@ static def getCurrentBranch() { } } -static def getCommitHash() { +def getCommitHash() { try { - def grgit = Grgit.open() + def grgit = getGrgit() def commitHash = grgit.head().id grgit.close() return commitHash @@ -33,9 +37,9 @@ static def getCommitHash() { } //Will return true if there are no uncommitted changes -static def isClean() { +def isClean() { try { - def grgit = Grgit.open() + def grgit = getGrgit() def isClean = grgit.status().isClean() grgit.close() return isClean