diff options
Diffstat (limited to 'configLookup.go')
| -rw-r--r-- | configLookup.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/configLookup.go b/configLookup.go index 9a61c2e..8715f40 100644 --- a/configLookup.go +++ b/configLookup.go @@ -11,6 +11,8 @@ package forgepb IsPrivate(repo) // repo can't be published to the pkg.go.dev system DebName() // for 'zookeeper' returns 'zookeeper-go' + + This code is practical, not perfect */ import ( @@ -227,3 +229,34 @@ func (fc *ForgeConfigs) IsWritable(thing string) bool { return match.Writable } + +// allows custom user branch names in the forge config +func (fc *ForgeConfigs) FindUserBranch(thing string) string { + var match *ForgeConfig + + all := fc.SortByGoPath() // get the list of repos + for all.Scan() { + r := all.Next() + if r.GoPath == thing { + if r.UserBranchName != "" { + return r.UserBranchName + } + } + base := filepath.Base(r.GoPath) + if base == thing { + if r.UserBranchName != "" { + return r.UserBranchName + } + } + if r.Directory { + if strings.HasPrefix(thing, r.GoPath) { + match = r + } + } + } + if match == nil { + return "" + } + + return match.UserBranchName +} |
