Fix branch could be empty

This commit is contained in:
Lukas Rieger (Blue) 2024-12-11 00:05:41 +01:00
parent 51f12741c9
commit bb9fc876c1
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
2 changed files with 2 additions and 2 deletions

2
api

@ -1 +1 @@
Subproject commit 67a7352c672d054b9e6cd0e996a4fa92ba0c237e
Subproject commit 5dc74e299c5553627d33e0ad734f992c01bf2141

View File

@ -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")