Skip to content

Commit bb9fc87

Browse files
committed
Fix branch could be empty
1 parent 51f1274 commit bb9fc87

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

api

buildSrc/src/main/kotlin/versioning.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fun Project.gitVersion(): String {
1717
val commits = runCommand("git rev-list --count $lastTag..HEAD", "0")
1818
val branch = runCommand("git branch --show-current", "master")
1919
val gitVersion = lastVersion +
20-
(if (branch == "master") "" else "-${branch.replace('/', '.')}") +
20+
(if (branch == "master" || branch.isEmpty()) "" else "-${branch.replace('/', '.')}") +
2121
(if (commits == "0") "" else "-$commits") +
2222
(if (gitClean()) "" else "-dirty")
2323

0 commit comments

Comments
 (0)