Skip to content

Commit 5dc74e2

Browse files
committed
Fix branch could be empty
1 parent 67a7352 commit 5dc74e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

buildSrc/src/main/kotlin/versioning.kt

+1-1
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)