From 5bc67fc3bbf437c7cddbe9fb0d77b723124f21ed Mon Sep 17 00:00:00 2001 From: Roberto Perez Alcolea Date: Thu, 15 Feb 2024 15:57:05 -0800 Subject: [PATCH] GitReadOnlyCommandUtil: verifyUserGitConfig should not load all properties at once --- .../git/command/GitReadOnlyCommandUtil.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/groovy/nebula/plugin/release/git/command/GitReadOnlyCommandUtil.groovy b/src/main/groovy/nebula/plugin/release/git/command/GitReadOnlyCommandUtil.groovy index 62bab52..85a9d78 100644 --- a/src/main/groovy/nebula/plugin/release/git/command/GitReadOnlyCommandUtil.groovy +++ b/src/main/groovy/nebula/plugin/release/git/command/GitReadOnlyCommandUtil.groovy @@ -81,12 +81,24 @@ class GitReadOnlyCommandUtil implements Serializable { private void verifyUserGitConfig() { String username = getGitConfig('user.name') String email = getGitConfig('user.email') + if(username && email) { + return + } String globalUsername = getGitConfig('--global', 'user.name') String globalEmail = getGitConfig('--global', 'user.email') + if(globalUsername && globalEmail) { + return + } String systemUsername = getGitConfig('--system', 'user.name') String systemEmail = getGitConfig('--system', 'user.email') + if(systemUsername && systemEmail) { + return + } String localUsername = getGitConfig('--local', 'user.name') String localEmail = getGitConfig('--local', 'user.email') + if(localUsername && localEmail) { + return + } String usernameFromLog = usernameFromLogProvider.isPresent() ? usernameFromLogProvider.get() : null if(!username && !globalUsername && !localUsername && !systemUsername && usernameFromLog) { throw new GradleException("Git user.name is not set. Please configure git user.name globally, locally or system wide. You can learn more in https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup")