Browse Source

fix: git dir for Grgit

develop
Ezerous 3 months ago
parent
commit
069a36984e
  1. 16
      app/gradle/grgit.gradle

16
app/gradle/grgit.gradle

@ -10,9 +10,13 @@ buildscript {
} }
} }
static def getCurrentBranch() { def getGrgit() {
return Grgit.open(currentDir: project.rootDir)
}
def getCurrentBranch() {
try { try {
def grgit = Grgit.open() def grgit = getGrgit()
def currentBranch = grgit.branch.getCurrent().name def currentBranch = grgit.branch.getCurrent().name
grgit.close() grgit.close()
return currentBranch return currentBranch
@ -21,9 +25,9 @@ static def getCurrentBranch() {
} }
} }
static def getCommitHash() { def getCommitHash() {
try { try {
def grgit = Grgit.open() def grgit = getGrgit()
def commitHash = grgit.head().id def commitHash = grgit.head().id
grgit.close() grgit.close()
return commitHash return commitHash
@ -33,9 +37,9 @@ static def getCommitHash() {
} }
//Will return true if there are no uncommitted changes //Will return true if there are no uncommitted changes
static def isClean() { def isClean() {
try { try {
def grgit = Grgit.open() def grgit = getGrgit()
def isClean = grgit.status().isClean() def isClean = grgit.status().isClean()
grgit.close() grgit.close()
return isClean return isClean

Loading…
Cancel
Save