diff options
| author | Jeff Carr <[email protected]> | 2025-01-05 19:45:29 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-05 19:45:29 -0600 |
| commit | 6cbd7e67af54a9854740aeab288bc9e447569337 (patch) | |
| tree | 2775ad43933b2d36efd45f55f0d402ddc03b7b4d /configLookup.go | |
| parent | 7e5db53e9d3868472e98b531799e56836298be14 (diff) | |
attempt custom branch namesv0.0.43
Diffstat (limited to 'configLookup.go')
| -rw-r--r-- | configLookup.go | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/configLookup.go b/configLookup.go index 8715f40..e829091 100644 --- a/configLookup.go +++ b/configLookup.go @@ -260,3 +260,65 @@ func (fc *ForgeConfigs) FindUserBranch(thing string) string { return match.UserBranchName } + +// allows custom devel branch names in the forge config +func (fc *ForgeConfigs) FindDevelBranch(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.DevelBranchName != "" { + return r.DevelBranchName + } + } + base := filepath.Base(r.GoPath) + if base == thing { + if r.DevelBranchName != "" { + return r.DevelBranchName + } + } + if r.Directory { + if strings.HasPrefix(thing, r.GoPath) { + match = r + } + } + } + if match == nil { + return "" + } + + return match.DevelBranchName +} + +// allows custom devel branch names in the forge config +func (fc *ForgeConfigs) FindMasterBranch(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.MasterBranchName != "" { + return r.MasterBranchName + } + } + base := filepath.Base(r.GoPath) + if base == thing { + if r.MasterBranchName != "" { + return r.MasterBranchName + } + } + if r.Directory { + if strings.HasPrefix(thing, r.GoPath) { + match = r + } + } + } + if match == nil { + return "" + } + + return match.MasterBranchName +} |
