summaryrefslogtreecommitdiff
path: root/repoNew.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-18 17:59:20 -0600
committerJeff Carr <[email protected]>2024-12-18 17:59:20 -0600
commit4582a76081814fa8bc573ad003c132d41347d6f4 (patch)
treeaebee4a0424b121ac5f57dabc6e7b252ca30b773 /repoNew.go
parent24c96ccaa7270f87da0c3bc17629de74b0da334c (diff)
finally re-organize and rename Clone to GoClone()v0.0.39
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)