Skip to content

Commit

Permalink
contains func
Browse files Browse the repository at this point in the history
  • Loading branch information
walteh committed May 28, 2024
1 parent a36b3d3 commit e43a778
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pr_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,27 @@ func LoadExecutionFromPR(ctx context.Context, tprov TagReader, prr PRResolver) (
beforeNoRoot := len(baseCommitTags)

baseNoRoot := slices.DeleteFunc(baseCommitTags, func(t Tag) bool {
return slices.Contains(rootCommitTags, t)
return slices.ContainsFunc(rootCommitTags, func(r Tag) bool {
return r.Name == t.Name
})
})

zerolog.Ctx(ctx).Debug().
Int("before", beforeNoRoot).
Int("after", len(baseNoRoot)).
Msg("pruning base commit tags")

before := len(baseBranchTags)
before := len(headBranchTags)

headNoBase := slices.DeleteFunc(headBranchTags, func(t Tag) bool {
return slices.Contains(baseBranchTags, t)
return slices.ContainsFunc(baseBranchTags, func(b Tag) bool {
return b.Name == t.Name
})
})

zerolog.Ctx(ctx).Debug().
Int("before", before).
Int("after", len(headBranchTags)).
Int("after", len(headNoBase)).
Msg("pruning head branch tags")

ex := &ActivePRProjectState{
Expand Down

0 comments on commit e43a778

Please sign in to comment.