diff options
Diffstat (limited to 'repoNew.go')
| -rw-r--r-- | repoNew.go | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -143,6 +143,28 @@ func (f *Forge) FindByGoPath(gopath string) *gitpb.Repo { return f.Repos.FindByFullPath(fullpath) } +// tries any parent +func (f *Forge) FindAnyPath(dir string) *gitpb.Repo { + dir = filepath.Clean(dir) + repo := f.Repos.FindByFullPath(dir) + if repo != nil { + log.Info("FindAnyPath() worked = ", dir) + return repo + } + if dir == "" { + return nil + } + if dir == "/" { + return nil + } + basedir, newdir := filepath.Split(dir) + if newdir == "" { + // is this correct? not sure what stupid windows does + return nil + } + return f.FindAnyPath(basedir) +} + func (f *Forge) DeleteByGoPath(gopath string) bool { fullpath := filepath.Join(f.GetGoSrc(), gopath) return f.Repos.DeleteByFullPath(fullpath) |
