summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-29 01:12:32 -0600
committerJeff Carr <[email protected]>2025-01-29 12:22:03 -0600
commit6b8ef6fc60a6ce7540e2def69d118c8baf8cf0cb (patch)
tree386f2bd6be057f662dc189284a0ca08d8aee8c69
parent829b6ba55f319ae7a0f7dcd415e196768c796b16 (diff)
last commit for the day
-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
+}