add common patch functions between forge & forged

This commit is contained in:
Jeff Carr 2025-08-28 19:15:48 -05:00
parent 22f823bebe
commit b55add4b47
2 changed files with 5 additions and 2 deletions

View File

@ -44,7 +44,6 @@ func findAutoPatchset() *forgepb.Patchset {
// adds submitted patches not specifically assigned to a patchset
// to the generic patchset called "forge auto commit"
func addRandomPatch(patch *forgepb.Patch) error {
// ignore patch if it's already here
if findPatch(patch) {
log.Info("already found patch", patch.CommitHash, patch.Namespace)
@ -62,6 +61,7 @@ func addRandomPatch(patch *forgepb.Patch) error {
return nil
}
/*
// adds a patchset or just the patches
func addPatchset(filename string, pb *forgepb.Patchset) {
// if the name of the patchset is "forge auto commit"
@ -102,6 +102,7 @@ func addPatchset(filename string, pb *forgepb.Patchset) {
me.forge.Patchsets.Patchsets = append(me.forge.Patchsets.Patchsets, newpb)
}
}
*/
func mergePatchsets() {
dirname := filepath.Join(LIBDIR, "patchset/")
@ -128,7 +129,7 @@ func mergePatchsets() {
fmt.Println(entry.Name(), err)
continue
}
addPatchset(entry.Name(), p)
me.forge.AddPatchset(p)
}
}
}

View File

@ -121,6 +121,8 @@ func savePatchset(w http.ResponseWriter, msg []byte) error {
regfile.Write(msg)
regfile.Close()
me.forge.AddPatchset(m)
response := forgepb.NewPatches() // this sets the proper handshake protobuf UUID
all := m.Patches.SortByFilename()
for all.Scan() {