From e395456c536b2458563d5e872a73e8667cc08659 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 11 Sep 2025 13:40:48 -0500 Subject: [PATCH] cleaning up .git/config parsing --- gitTag.proto | 1 - reloadGitConfig.go => reloadParseGitConfig.go | 0 repo.new.go | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) rename reloadGitConfig.go => reloadParseGitConfig.go (100%) diff --git a/gitTag.proto b/gitTag.proto index eb04274..8c84f2b 100644 --- a/gitTag.proto +++ b/gitTag.proto @@ -15,7 +15,6 @@ message GitBranch { // `autogenpb:nomutex` string name = 3; // the branch name from the config file } -// readGitConfig reads and parses the .git/config file message GitConfig { // `autogenpb:nomutex` map core = 1; // map[origin] = "https:/git.wit.org/gui/gadgets" map remotes = 2; // map[origin] = "https:/git.wit.org/gui/gadgets" diff --git a/reloadGitConfig.go b/reloadParseGitConfig.go similarity index 100% rename from reloadGitConfig.go rename to reloadParseGitConfig.go diff --git a/repo.new.go b/repo.new.go index 453fa0a..c48fde7 100644 --- a/repo.new.go +++ b/repo.new.go @@ -100,3 +100,19 @@ func (all *Repos) NewRepo(fullpath string, namespace string) (*Repo, error) { // todo: use Repos.Lock() return nil, errors.New("gitpb.NewRepo() append failed " + fullpath) } + +func NewRepo(fullpath string) (*Repo, error) { + // add a new one here + newr := Repo{ + FullPath: fullpath, + } + newr.Times = new(GitTimes) + + // everything happens in here + newr.Reload() + newr.ValidateUTF8() + if newr.Namespace == "" { + log.Info("GET Namespace from URL", newr.GetURL()) + } + return &newr, nil +}