blob: a2635d780d2b22e844b1f3a9b114896f2208ba77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package gitpb
import (
"path/filepath"
)
// 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
}
// returns true if the devel branch exists
func (repo *Repo) ExistsDevelBranch() bool {
if repo.GetDevelBranchName() == "" {
return false
}
branchname := repo.GetDevelBranchName()
if repo.Exists(filepath.Join(".git/refs/heads", branchname)) {
// todo: actually use .git/config
return true
}
return false
}
|