From 0cb16d43ce353025a02a6a0a38fb4169c995a047 Mon Sep 17 00:00:00 2001 From: Marcus Holl Date: Tue, 21 Aug 2018 08:23:05 +0200 Subject: [PATCH] artifactSetVersion: use gitUtils#insideWorkTree rather than checking for existing .git folder. An existing .git folder is a necessarry, but not a sufficient condition here. Adapting the test is not necessary. The gitUtil itself is not mocked, but the underlying sh calls are already mocked accordingly. --- vars/artifactSetVersion.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/artifactSetVersion.groovy b/vars/artifactSetVersion.groovy index 43baa194f..b4ca3ede1 100644 --- a/vars/artifactSetVersion.groovy +++ b/vars/artifactSetVersion.groovy @@ -31,7 +31,7 @@ def call(Map parameters = [:], Closure body = null) { def gitUtils = parameters.juStabGitUtils ?: new GitUtils() - if (fileExists('.git')) { + if (gitUtils.insideWorkTree()) { if (sh(returnStatus: true, script: 'git diff --quiet HEAD') != 0) error "[${STEP_NAME}] Files in the workspace have been changed previously - aborting ${STEP_NAME}" }