diff --git a/doClean.go b/doClean.go index 29154a0..8e6e024 100644 --- a/doClean.go +++ b/doClean.go @@ -272,10 +272,39 @@ func checkRemoteBranches(repo *gitpb.Repo) error { } func checkPatchIds(repo *gitpb.Repo, b1 string, b2 string) error { + ids := make(map[string]string) s1 := fmt.Sprintf("%s..%s", b1, b2) s2 := fmt.Sprintf("%s..%s", b2, b1) - repo.RunVerbose([]string{"git", "rev-list", s1}) - repo.RunVerbose([]string{"git", "rev-list", s2}) + if stats, err := repo.RunStrict([]string{"git", "rev-list", s1}); err != nil { + return err + } else { + for _, hash := range stats.Stdout { + patchId, err := repo.FindPatchId(hash) + if err != nil { + continue + } + ids[patchId] = hash + } + } + + if stats, err := repo.RunStrict([]string{"git", "rev-list", s2}); err != nil { + return err + } else { + for _, hash := range stats.Stdout { + patchId, err := repo.FindPatchId(hash) + if err != nil { + continue + } + if _, ok := ids[patchId]; ok { + log.Info("already here") + } else { + ids[patchId] = hash + } + } + } + for key, val := range ids { + log.Info(key, val) + } return nil }