diff options
| author | root <[email protected]> | 2025-10-02 13:02:39 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-02 15:17:10 -0500 |
| commit | 572937b9f70943dfee8c7bc6967e54b762b4e7bf (patch) | |
| tree | f9e6b42b9ea139bc0d2d03b91dc2e41919972ae1 /handleRepos.go | |
| parent | 8d311c65a7583b0da58d2c9870301acdf93ccb0d (diff) | |
allow URL updates
Diffstat (limited to 'handleRepos.go')
| -rw-r--r-- | handleRepos.go | 23 |
1 files changed, 23 insertions, 0 deletions
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 |
