Skip to content

Commit

Permalink
Make -Prelease.overriddenBranchName work in non-detached state (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeath authored Feb 24, 2025
1 parent fcf088b commit 67a9818
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ private String branchNameFromGit() {
.map(Repository::shortenRefName)
.orElse(null);

if ("HEAD".equals(branchName) && properties.getOverriddenBranchName() != null && !properties.getOverriddenBranchName().isEmpty()) {
if (properties.getOverriddenBranchName() != null && !properties.getOverriddenBranchName().isEmpty()) {
branchName = Repository.shortenRefName(properties.getOverriddenBranchName());
}
return branchName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class GitRepositoryTest extends Specification {
position.branch == 'feature/overridden-branch-name'
}

def "should ignore overriddenBranchName when not in detached state"() {
def "should not ignore overriddenBranchName when not in detached state"() {
given:
File repositoryDir = File.createTempDir('axion-release', 'tmp')
def scmProperties = scmProperties(repositoryDir)
Expand All @@ -384,7 +384,7 @@ class GitRepositoryTest extends Specification {
ScmPosition position = repository.currentPosition()

then:
position.branch == 'some-branch'
position.branch == 'feature/overridden-branch-name'
}

def "should push changes and tag to remote"() {
Expand Down

0 comments on commit 67a9818

Please sign in to comment.