manual git merge

This commit is contained in:
Jeff Carr 2025-07-07 19:02:32 -05:00
parent cba9b43064
commit e57f48e649
4 changed files with 41 additions and 9 deletions

View File

@ -50,7 +50,7 @@ prod: build
make stop
cp forged /usr/bin/forged
make start
make log
journalctl -n 10 -xeu forged.service
goimports:
reset

View File

@ -205,3 +205,35 @@ func lookupRepos(msg []byte) (*gitpb.Repos, error) {
}
return newpb, nil
}
/* save the git.pb files
+ if repo.Namespace == "" {
+ log.Infof("repo: ERROR. no namespace. %s\n", repo.FullPath)
+ continue
+ }
+
+ repopath := filepath.Join("/home/forge", repo.Namespace)
+ if !shell.IsDir(repopath) {
+ if err := os.MkdirAll(repopath, os.ModePerm); err != nil {
+ log.Warn("mkdir fail", repo.Namespace, err)
+ continue
+ }
+ }
+
+ filename := filepath.Join(repopath, "git.pb")
+ if !shell.Exists(filename) {
+ data, err := repo.Marshal()
+ if err != nil {
+ log.Info("patchsets.Marshal() to wire failed", err)
+ continue
+ }
+ gitpbf, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
+ defer gitpbf.Close()
+ if err != nil {
+ log.Info("filename open error:", filename, err)
+ continue
+ }
+ gitpbf.Write(data)
+ }
+
+ log.Infof("repo path: %s\n", repopath)
*/

14
http.go
View File

@ -49,14 +49,14 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if err != nil {
return
}
// marshal the protobuf to xfer over the socket
data, err := found.Marshal()
if err != nil {
log.Info("repos.Marshal() to wire failed", err)
return
}
w.Write(data)
/*
for repo := range repos.IterAll() {
repo.Namespace += "good"
log.Infof("repo:%s,%s\n", repo.Namespace, repo.FullPath)
}
*/
found.SendPB(w)
return
}

View File

@ -30,7 +30,7 @@ func main() {
http.HandleFunc("/", okHandler)
// go https() // use caddy instead
p := fmt.Sprintf(":%d", argv.Port)
log.Println("HOSTNAME set to:", HOSTNAME)
log.Println(argv.Version(), "HOSTNAME set to:", HOSTNAME)
log.Println("Running on port", "http://localhost"+p)
log.Println("Running on port", "http://localhost"+p+"/ipv6.png")
err := http.ListenAndServe(p, nil)