From 387f69631bacb449372406ea49af3b42f43fdb46 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 30 Jan 2025 02:24:47 -0600 Subject: trying to fix user create branch --- checkout.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'checkout.go') diff --git a/checkout.go b/checkout.go index 2b0e3f2..2180c22 100644 --- a/checkout.go +++ b/checkout.go @@ -1,7 +1,6 @@ package gitpb import ( - "fmt" "path/filepath" "go.wit.com/log" @@ -28,7 +27,7 @@ func (repo *Repo) CheckoutDevel() bool { func (repo *Repo) CheckoutUser() error { bName := repo.GetUserBranchName() // log.Info("attempting checkout user", repo.GetGoPath(), bName) - err := repo.checkoutBranchNew(bName) + err := repo.createUserBranchNew(bName) if err != nil { log.Info("attempting checkout user error", repo.GetGoPath(), bName, err) } @@ -68,7 +67,7 @@ func (repo *Repo) checkoutBranch(bName string) bool { return true } -func (repo *Repo) checkoutBranchNew(branch string) error { +func (repo *Repo) createUserBranchNew(branch string) error { if branch == "" || branch == "uerr" { log.Info("forge.gitpb logic err. branch name was:", branch) return nil @@ -101,7 +100,14 @@ func (repo *Repo) checkoutBranchNew(branch string) error { } if repo.GetCurrentBranchName() != repo.GetDevelBranchName() { - return fmt.Errorf("repo must be on devel branch %s", repo.GetGoPath()) + repo.CheckoutDevel() + } + repo.Reload() + + if repo.GetCurrentBranchName() != repo.GetDevelBranchName() { + log.Info("create user branch will probably fail", repo.GetGoPath()) + // TODO: FIX THIS + // return fmt.Errorf("repo must be on devel branch %s", repo.GetGoPath()) } // log.Info("forge.gitpb try to create", branch, repo.GetGoPath()) -- cgit v1.2.3