Improve branch existence check

This commit is contained in:
Donny Xia
2020-05-19 11:00:00 -07:00
parent 68d6b9add6
commit 1dced55f60

View File

@@ -376,7 +376,13 @@ func checkBranchExistence(path, name string) bool {
if err != nil {
logFatal(string(stdoutStderr))
}
return strings.Contains(string(stdoutStderr), name)
branches := strings.Split(string(stdoutStderr), "\n")
for _, branch := range branches {
if strings.Trim(branch, " ") == "remotes/"+name {
return true
}
}
return false
}
func newBranch(path, name string) {