summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fi-prune-empty/main.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/fi-prune-empty/main.go b/fi-prune-empty/main.go
index 7c1ea5d..fb25794 100644
--- a/fi-prune-empty/main.go
+++ b/fi-prune-empty/main.go
@@ -149,11 +149,19 @@ func (h *PruneEmpty) subsumedBy(c string, commits []string) bool {
}
return false
}
+func inArray(needle string, haystack []string) bool {
+ for _, straw := range haystack {
+ if straw == needle {
+ return true
+ }
+ }
+ return false
+}
func (h *PruneEmpty) pruneParents(commits []string) []string {
var ret []string
for _, c := range commits {
c = h.fixupMark(c)
- if c != "" && !h.subsumedBy(c, commits) {
+ if c != "" && !h.subsumedBy(c, commits) && !inArray(c, ret) {
ret = append(ret, c)
}
}