From 829b6ba55f319ae7a0f7dcd415e196768c796b16 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 28 Jan 2025 21:04:25 -0600 Subject: [PATCH] add IsBranchRemote() --- branches.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 branches.go diff --git a/branches.go b/branches.go new file mode 100644 index 0000000..7d68e40 --- /dev/null +++ b/branches.go @@ -0,0 +1,14 @@ +package gitpb + +import ( + "path/filepath" +) + +// returns true if 'git pull' will work +func (repo *Repo) IsBranchRemote(branchname string) bool { + if repo.Exists(filepath.Join(".git/refs/remotes/origin", branchname)) { + // todo: actually use .git/config + return true + } + return false +}