summaryrefslogtreecommitdiff
path: root/branches.go
diff options
context:
space:
mode:
Diffstat (limited to 'branches.go')
-rw-r--r--branches.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/branches.go b/branches.go
index 7d68e40..085380c 100644
--- a/branches.go
+++ b/branches.go
@@ -6,9 +6,34 @@ import (
// returns true if 'git pull' will work
func (repo *Repo) IsBranchRemote(branchname string) bool {
+ if branchname == "" {
+ return false
+ }
if repo.Exists(filepath.Join(".git/refs/remotes/origin", branchname)) {
// todo: actually use .git/config
return true
}
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
+}