summaryrefslogtreecommitdiff
path: root/repoNew.go
diff options
context:
space:
mode:
Diffstat (limited to 'repoNew.go')
-rw-r--r--repoNew.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/repoNew.go b/repoNew.go
index 45e9db5..a089ab7 100644
--- a/repoNew.go
+++ b/repoNew.go
@@ -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)