Skip to content

Commit 67a7352

Browse files
committed
Add falback if branch command fails
1 parent 768daee commit 67a7352

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: buildSrc/src/main/kotlin/versioning.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fun Project.gitVersion(): String {
1515
val lastTag = if (runCommand("git tag", "").isEmpty()) "" else runCommand("git describe --tags --abbrev=0", "")
1616
val lastVersion = if (lastTag.isEmpty()) "0.0" else lastTag.substring(1) // remove the leading 'v'
1717
val commits = runCommand("git rev-list --count $lastTag..HEAD", "0")
18-
val branch = runCommand("git branch --show-current")
18+
val branch = runCommand("git branch --show-current", "master")
1919
val gitVersion = lastVersion +
2020
(if (branch == "master") "" else "-${branch.replace('/', '.')}") +
2121
(if (commits == "0") "" else "-$commits") +

0 commit comments

Comments
 (0)