From 14e7ef23b463677ded24716fc705e0f84546a9bb Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Wed, 13 Nov 2019 12:55:02 +0100 Subject: [PATCH] fix: sonarExecuteScan: safeguard unstash of git metadata (#976) * unstash .git folder only if not present, ignore missing stashes * fix: negate condition * Update sonarExecuteScan.groovy --- vars/sonarExecuteScan.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vars/sonarExecuteScan.groovy b/vars/sonarExecuteScan.groovy index b5580a27d..c879f8125 100644 --- a/vars/sonarExecuteScan.groovy +++ b/vars/sonarExecuteScan.groovy @@ -190,7 +190,9 @@ void call(Map parameters = [:]) { script: script, dockerImage: configuration.dockerImage ){ - unstash 'git' + if(!script.fileExists('.git')) { + utils.unstash('git') + } worker(configuration) } }