Skip to content

Commit

Permalink
DescribeHeadWithTag should only read tags that use v as prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalcolea committed Dec 5, 2023
1 parent 2e001fe commit 7d369f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationTestKitSpec {
def result = runTasksAndFail('assemble', '-Prelease.useLastTag=true')

then:
result.output.contains "Current commit has a snapshot, immutableSnapshot or devSnapshot tag. 'useLastTag' requires a prerelease or final tag."
result.output.contains("Current commit has a snapshot, immutableSnapshot or devSnapshot tag. 'useLastTag' requires a prerelease or final tag.") || result.output.contains("but they were not recognized as valid versions")
!new File(projectDir, "build/libs/${moduleName}-${dev('0.1.0-dev.3+').toString()}.jar").exists()
}

Expand All @@ -757,7 +757,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationTestKitSpec {
def result = runTasksAndFail('assemble', '-Prelease.useLastTag=true')

then:
result.output.contains "Current commit has a snapshot, immutableSnapshot or devSnapshot tag. 'useLastTag' requires a prerelease or final tag."
result.output.contains("Current commit has a snapshot, immutableSnapshot or devSnapshot tag. 'useLastTag' requires a prerelease or final tag.") || result.output.contains("but they were not recognized as valid versions")
!new File(projectDir, "build/libs/${moduleName}-${dev('0.1.0-snapshot.220190705103502+').toString()}.jar").exists()
}

Expand All @@ -768,7 +768,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationTestKitSpec {
def result = runTasksAndFail('assemble', '-Prelease.useLastTag=true')

then:
result.output.contains "Current commit has a snapshot, immutableSnapshot or devSnapshot tag. 'useLastTag' requires a prerelease or final tag."
result.output.contains("Current commit has a snapshot, immutableSnapshot or devSnapshot tag. 'useLastTag' requires a prerelease or final tag.") || result.output.contains("but they were not recognized as valid versions")
!new File(projectDir, "build/libs/${moduleName}-1.2.3-SNAPSHOT.jar").exists()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ abstract class DescribeHeadWithTag extends GitReadCommand {
@Override
String obtain() {
try {
return executeGitCommand( "describe", "HEAD", "--tags", "--long")
return executeGitCommand( "describe", "HEAD", "--tags", "--long", "--match", "v*")
} catch (Exception e) {
return null
}
Expand All @@ -95,7 +95,7 @@ abstract class DescribeHeadWithTagWithExclude extends GitReadCommand {
@Override
String obtain() {
try {
return executeGitCommandWithErrorIgnore( "describe", "HEAD", "--tags", "--long", "--exclude", "*-rc.*")
return executeGitCommandWithErrorIgnore( "describe", "HEAD", "--tags", "--long", "--match", "v*", "--exclude", "*-rc.*")
} catch (Exception e) {
return null
}
Expand Down

0 comments on commit 7d369f6

Please sign in to comment.