Fix Excessive Applies

This Patch Does Not Apply To The Current Repository
Sarah@auth.lopeos.org submitted a patch request Feb 15, 2025 23:07
  • Title: Change order of CheckApplied/CheckApply
  • Author: Sarah Jamie Lewis <sarah@openprivacy.ca>

repo/requests.go

@@ -255,15 +255,15 @@ func (rm *RequestManager) LoadIssues(logpath string, loadfn func(hash string) (*
  								patchSummary.Body = template.HTML(doc.String())

              								issue.PatchInfo = patchSummary

              

            -								if _, err := rm.patchHandler.CheckApply(rm.RequestIssueElement(le.Hash, issue.PatchRef)); err != nil {

            -									if _, err := rm.patchHandler.CheckApplied(rm.RequestIssueElement(le.Hash, issue.PatchRef)); err != nil {

            +								if _, err := rm.patchHandler.CheckApplied(rm.RequestIssueElement(le.Hash, issue.PatchRef)); err != nil {

            +									warningCallback(INFO, "This Patch Has Been Applied")

            +								} else {

            +									if _, err := rm.patchHandler.CheckApply(rm.RequestIssueElement(le.Hash, issue.PatchRef)); err != nil {

              										warningCallback(WARN, "This Patch Does Not Apply To The Current Repository")

              									} else {

            -										warningCallback(INFO, "This Patch Has Been Applied")

            +										warningCallback(INFO, "This Patch Can Be Applied To The Current Repository")

            +										issue.PatchInfo.CanBeApplied = true

              									}

            -								} else {

            -									warningCallback(INFO, "This Patch Can Be Applied To The Current Repository")

            -									issue.PatchInfo.CanBeApplied = true

              								}

              

              							}