From 572937b9f70943dfee8c7bc6967e54b762b4e7bf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 2 Oct 2025 13:02:39 -0500 Subject: allow URL updates --- handleRepos.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'handleRepos.go') diff --git a/handleRepos.go b/handleRepos.go index 20cf66c..ac28c7f 100644 --- a/handleRepos.go +++ b/handleRepos.go @@ -69,6 +69,29 @@ func checkRequest(pb *gitpb.Repos, reqPB *httppb.HttpRequest) *gitpb.Repos { // don't know about this continue } + if found.GetURL() != repo.GetURL() { + log.Infof("'%s' url %s mismatch %s\n", found.FullPath, found.GetURL(), repo.GetURL()) + } + checkPB.Append(found) + } + return checkPB +} + +func updateURLs(pb *gitpb.Repos, reqPB *httppb.HttpRequest) *gitpb.Repos { + checkPB := gitpb.NewRepos() + for repo := range pb.IterAll() { + found := me.forge.Repos.FindByNamespace(repo.Namespace) + if found == nil { + log.Infof("found == nil namespace=%s\n", repo.Namespace) + continue + } + if found.GetURL() != repo.GetURL() { + log.Infof("'%s' url %s mismatch %s\n", found.FullPath, found.GetURL(), repo.GetURL()) + cmd := []string{"git", "remote", "set-url", "origin", repo.GetURL()} + found.RunVerbose(cmd) + } else { + // log.Infof("'%s' url %s == %s\n", found.FullPath, found.GetURL(), repo.GetURL()) + } checkPB.Append(found) } return checkPB -- cgit v1.2.3