last commit for the day

This commit is contained in:
Jeff Carr 2025-01-29 01:12:32 -06:00
parent 829b6ba55f
commit 6b8ef6fc60
1 changed files with 25 additions and 0 deletions

View File

@ -6,9 +6,34 @@ import (
// returns true if 'git pull' will work // returns true if 'git pull' will work
func (repo *Repo) IsBranchRemote(branchname string) bool { func (repo *Repo) IsBranchRemote(branchname string) bool {
if branchname == "" {
return false
}
if repo.Exists(filepath.Join(".git/refs/remotes/origin", branchname)) { if repo.Exists(filepath.Join(".git/refs/remotes/origin", branchname)) {
// todo: actually use .git/config // todo: actually use .git/config
return true return true
} }
return false return false
} }
// returns true if 'git pull' will work
func (repo *Repo) ExistsUserBranchRemote() bool {
branchname := repo.GetUserBranchName()
if repo.IsBranchRemote(branchname) {
return true
}
return false
}
// returns true if the user branch exists
func (repo *Repo) ExistsUserBranch() bool {
if repo.GetUserBranchName() == "" {
return false
}
branchname := repo.GetUserBranchName()
if repo.Exists(filepath.Join(".git/refs/heads", branchname)) {
// todo: actually use .git/config
return true
}
return false
}