From b48241106bfadeaae12a8558d8913747881edf4f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 5 Oct 2025 08:13:34 -0500 Subject: ? --- repo.new.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/repo.new.go b/repo.new.go index 48c588b..65aa251 100644 --- a/repo.new.go +++ b/repo.new.go @@ -4,6 +4,7 @@ import ( "bytes" "errors" "fmt" + "os" "os/exec" "path/filepath" "strings" @@ -116,6 +117,12 @@ func NewRepo(fullpath string) (*Repo, error) { // everything happens in here repo.ReloadForce() repo.ValidateUTF8() + if repo.Namespace == "" { + wd, _ := os.Getwd() + repo.Namespace = wd + } + + // fall back to URL? if repo.Namespace == "" { giturl := repo.GetURL() if giturl == "" { @@ -123,13 +130,10 @@ func NewRepo(fullpath string) (*Repo, error) { return &repo, nil } // log.Info("GET Namespace from URL", giturl) - tmpURL, err := ParseGitURL(giturl) - if err != nil { - log.Info(repo.FullPath, "URL can not be parsed for namespace") - return &repo, nil + if tmpURL, err := ParseGitURL(giturl); err == nil { + // log.Info(repo.FullPath, "namespace might be:", tmpURL.Hostname(), tmpURL.Path) + repo.Namespace = filepath.Join(tmpURL.Hostname(), tmpURL.Path) } - // log.Info(repo.FullPath, "namespace might be:", tmpURL.Hostname(), tmpURL.Path) - repo.Namespace = filepath.Join(tmpURL.Hostname(), tmpURL.Path) } return &repo, nil } -- cgit v1.2.3