From 2e001fea491ec6d34dd5e7c012f549f4ac262ffa Mon Sep 17 00:00:00 2001 From: Roberto Perez Alcolea Date: Fri, 1 Dec 2023 07:44:29 -0800 Subject: [PATCH] GitReadCommand: fix DescribeHeadWithTagWithExclude --- .../release/git/command/GitReadCommand.groovy | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) 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 63b8fc6..36b81e7 100644 --- a/src/main/groovy/nebula/plugin/release/git/command/GitReadCommand.groovy +++ b/src/main/groovy/nebula/plugin/release/git/command/GitReadCommand.groovy @@ -27,7 +27,6 @@ abstract class GitReadCommand implements ValueSource commandLineArgs = ["git", "--git-dir=${rootDir.absolutePath}/.git".toString(), "--work-tree=${rootDir.absolutePath}".toString()] + commandLineArgs.addAll(args) + execOperations.exec { + it.setCommandLine(commandLineArgs) + it.standardOutput = output + it.errorOutput = error + } + String result = new String(output.toByteArray(), Charset.defaultCharset()) + if(result) { + return result + } + def errorMsg = new String(error.toByteArray(), Charset.defaultCharset()) + if(errorMsg) { + throw new GradleException(errorMsg) + } + } } /** @@ -74,7 +95,7 @@ abstract class DescribeHeadWithTagWithExclude extends GitReadCommand { @Override String obtain() { try { - return executeGitCommand( "describe", "HEAD", "--tags", "--long", "--exclude", "\"*-rc.*\"") + return executeGitCommandWithErrorIgnore( "describe", "HEAD", "--tags", "--long", "--exclude", "*-rc.*") } catch (Exception e) { return null }