Skip to content

Commit

Permalink
Fix branch could be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlueF committed Dec 10, 2024
1 parent 51f1274 commit bb9fc87
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/versioning.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fun Project.gitVersion(): String {
val commits = runCommand("git rev-list --count $lastTag..HEAD", "0")
val branch = runCommand("git branch --show-current", "master")
val gitVersion = lastVersion +
(if (branch == "master") "" else "-${branch.replace('/', '.')}") +
(if (branch == "master" || branch.isEmpty()) "" else "-${branch.replace('/', '.')}") +
(if (commits == "0") "" else "-$commits") +
(if (gitClean()) "" else "-dirty")

Expand Down

0 comments on commit bb9fc87

Please sign in to comment.