From c5d2f294c46ea64313aa27479155dd78739c567a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 26 Sep 2025 03:10:00 -0500 Subject: attempt to detect this correctly --- doClean.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doClean.go b/doClean.go index fba6ab0..8ad3042 100644 --- a/doClean.go +++ b/doClean.go @@ -272,6 +272,8 @@ func checkRemoteBranches(repo *gitpb.Repo) error { } func checkPatchIds(repo *gitpb.Repo, b1 string, b2 string) error { + var safe bool = true + var baderr error ids := make(map[string]string) s1 := fmt.Sprintf("%s..%s", b1, b2) s2 := fmt.Sprintf("%s..%s", b2, b1) @@ -281,6 +283,8 @@ func checkPatchIds(repo *gitpb.Repo, b1 string, b2 string) error { for _, hash := range stats.Stdout { patchId, err := repo.FindPatchId(hash) if err != nil { + baderr = err + safe = false continue } ids[patchId] = hash @@ -293,11 +297,15 @@ func checkPatchIds(repo *gitpb.Repo, b1 string, b2 string) error { for _, hash := range stats.Stdout { patchId, err := repo.FindPatchId(hash) if err != nil { + baderr = err + safe = false continue } if val, ok := ids[patchId]; ok { log.Info(patchId, hash, "already here as", val) } else { + log.Info(hash, "this probably means this branch is not safe to delete") + safe = false ids[patchId] = hash } } @@ -306,5 +314,8 @@ func checkPatchIds(repo *gitpb.Repo, b1 string, b2 string) error { log.Info(key, val) } - return nil + if !safe { + log.Info("branch is probably not safe to delete", b1, b2, baderr) + } + return baderr } -- cgit v1.2.3