Allowing to specify different branch in first parameter
This commit is contained in:
@@ -129,11 +129,12 @@ func main() {
|
||||
); check(e) {
|
||||
return
|
||||
}
|
||||
startArgs := 1
|
||||
br := strings.Split(GitRef, "/")
|
||||
branch := br[len(br)-1]
|
||||
startArgs := 1
|
||||
branchParam := os.Args[1]
|
||||
if major || minor {
|
||||
branch = os.Args[2]
|
||||
branchParam = os.Args[2]
|
||||
}
|
||||
var out string
|
||||
if out, e = runCmdWithOutput("git", "branch"); check(e) {
|
||||
@@ -145,17 +146,22 @@ func main() {
|
||||
if len(splitted[i]) < 2 {
|
||||
continue
|
||||
}
|
||||
if splitted[i][2:] == branch {
|
||||
if splitted[i][2:] == branchParam {
|
||||
isBranch = true
|
||||
branch = splitted[i][2:]
|
||||
break
|
||||
}
|
||||
}
|
||||
log.I.S(isBranch, branch)
|
||||
if isBranch {
|
||||
branch = branchParam
|
||||
}
|
||||
if isBranch {
|
||||
startArgs++
|
||||
}
|
||||
tag := true
|
||||
if branch == "main" {
|
||||
if branch != "main" {
|
||||
tag = false
|
||||
} else {
|
||||
switch {
|
||||
case minor:
|
||||
Minor++
|
||||
@@ -167,8 +173,6 @@ func main() {
|
||||
default:
|
||||
Patch++
|
||||
}
|
||||
} else {
|
||||
tag = false
|
||||
}
|
||||
SemVer = fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch)
|
||||
PathBase = tr.Filesystem.Root() + "/"
|
||||
|
||||
@@ -13,9 +13,9 @@ var (
|
||||
// GitRef is the gitref, as in refs/heads/branchname.
|
||||
GitRef = "refs/heads/main"
|
||||
// ParentGitCommit is the commit hash of the parent HEAD.
|
||||
ParentGitCommit = "11ff201d7096d1e1dd9c3e82b68cfc9dd22cb73e"
|
||||
ParentGitCommit = "5c72c2dabc3e5af39689ee4c9e0d0057c31de54c"
|
||||
// BuildTime stores the time when the current binary was built.
|
||||
BuildTime = "2022-12-21T14:41:05Z"
|
||||
BuildTime = "2022-12-21T14:50:51Z"
|
||||
// SemVer lists the (latest) git tag on the build.
|
||||
SemVer = "v0.0.208"
|
||||
// PathBase is the path base returned from runtime caller.
|
||||
|
||||
Reference in New Issue
Block a user