From 30f66745e72e911f5fb95a71d122f69065ddb1aa Mon Sep 17 00:00:00 2001 From: Bob van Rooij Date: Mon, 11 Dec 2023 13:31:32 +0100 Subject: [PATCH] set rootDir as working dir for git execs --- .../nebula/plugin/release/git/command/GitReadCommand.groovy | 2 ++ .../plugin/release/git/command/GitWriteCommandsUtil.groovy | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/groovy/nebula/plugin/release/git/command/GitReadCommand.groovy b/src/main/groovy/nebula/plugin/release/git/command/GitReadCommand.groovy index 7289fb4c..d5834b98 100644 --- a/src/main/groovy/nebula/plugin/release/git/command/GitReadCommand.groovy +++ b/src/main/groovy/nebula/plugin/release/git/command/GitReadCommand.groovy @@ -26,6 +26,7 @@ abstract class GitReadCommand implements ValueSource commandLineArgs = ["git", "--git-dir=${rootDir.absolutePath}/.git".toString(), "--work-tree=${rootDir.absolutePath}".toString()] commandLineArgs.addAll(args) execOperations.exec { + it.setWorkingDir(rootDir.absolutePath) it.setCommandLine(commandLineArgs) it.standardOutput = output it.errorOutput = error @@ -45,6 +46,7 @@ abstract class GitReadCommand implements ValueSource commandLineArgs = ["git", "--git-dir=${rootDir.absolutePath}/.git".toString(), "--work-tree=${rootDir.absolutePath}".toString()] commandLineArgs.addAll(args) execOperations.exec { + it.setWorkingDir(rootDir.absolutePath) it.setCommandLine(commandLineArgs) it.standardOutput = output it.errorOutput = error diff --git a/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy b/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy index 00ce6ebc..d956b480 100644 --- a/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy +++ b/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy @@ -76,6 +76,7 @@ class GitWriteCommandsUtil implements Serializable { List commandLineArgs = ["git", "--git-dir=${rootDir.absolutePath}/.git".toString(), "--work-tree=${rootDir.absolutePath}".toString()] commandLineArgs.addAll(args) execOperations.exec { + it.setWorkingDir(rootDir.absolutePath) it.ignoreExitValue = true it.setCommandLine(commandLineArgs) it.standardOutput = output