last commit for the day
This commit is contained in:
parent
829b6ba55f
commit
6b8ef6fc60
25
branches.go
25
branches.go
|
@ -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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue