summaryrefslogtreecommitdiff
path: root/handleRepos.go
diff options
context:
space:
mode:
Diffstat (limited to 'handleRepos.go')
-rw-r--r--handleRepos.go23
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