diff options
| author | Jeff Carr <[email protected]> | 2025-02-09 16:48:45 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-09 16:48:45 -0600 |
| commit | 9cc9b9bc8733a02e5e9de88a7a3ffb6672aa345c (patch) | |
| tree | 4e791ecf7a8209b9ad3799ff4f9b93f692c4d920 | |
| parent | bb54c065adc7734c533a54c819ada8591e9a0a9c (diff) | |
detect more devel branch problems
| -rw-r--r-- | branches.go | 8 | ||||
| -rw-r--r-- | reloadRepoState.go | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/branches.go b/branches.go index e6d0570..192e4e3 100644 --- a/branches.go +++ b/branches.go @@ -40,6 +40,10 @@ func (repo *Repo) ExistsUserBranch() bool { // todo: actually use .git/config return true } + if repo.Exists(filepath.Join(".git/refs/remote/origin", branchname)) { + // todo: actually use .git/config + return true + } return false } @@ -53,6 +57,10 @@ func (repo *Repo) ExistsDevelBranch() bool { // todo: actually use .git/config return true } + if repo.Exists(filepath.Join(".git/refs/remote/origin", branchname)) { + // todo: actually use .git/config + return true + } return false } diff --git a/reloadRepoState.go b/reloadRepoState.go index b6cb20a..a946e2d 100644 --- a/reloadRepoState.go +++ b/reloadRepoState.go @@ -34,6 +34,16 @@ func (repo *Repo) setRepoState() { } } if repo.GetDevelVersion() != repo.GetMasterVersion() { + if !repo.ExistsDevelBranch() { + // there is no devel branch. you are safe to proceed + repo.State = "no devel branch" + return + } + if !repo.IsLocalBranch(repo.GetDevelBranchName()) { + // the remote devel branch exists but is not checked out + repo.State = "devel not checked out" + return + } b1 := repo.countDiffObjects(repo.GetMasterBranchName(), repo.GetDevelBranchName()) if b1 == 0 { repo.State = "merge to main" |
