detect more devel branch problems

This commit is contained in:
Jeff Carr 2025-02-09 16:48:45 -06:00
parent bb54c065ad
commit 9cc9b9bc87
2 changed files with 18 additions and 0 deletions

View File

@ -40,6 +40,10 @@ func (repo *Repo) ExistsUserBranch() bool {
// todo: actually use .git/config // todo: actually use .git/config
return true return true
} }
if repo.Exists(filepath.Join(".git/refs/remote/origin", branchname)) {
// todo: actually use .git/config
return true
}
return false return false
} }
@ -53,6 +57,10 @@ func (repo *Repo) ExistsDevelBranch() bool {
// todo: actually use .git/config // todo: actually use .git/config
return true return true
} }
if repo.Exists(filepath.Join(".git/refs/remote/origin", branchname)) {
// todo: actually use .git/config
return true
}
return false return false
} }

View File

@ -34,6 +34,16 @@ func (repo *Repo) setRepoState() {
} }
} }
if repo.GetDevelVersion() != repo.GetMasterVersion() { 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()) b1 := repo.countDiffObjects(repo.GetMasterBranchName(), repo.GetDevelBranchName())
if b1 == 0 { if b1 == 0 {
repo.State = "merge to main" repo.State = "merge to main"