Skip to content

Commit

Permalink
revert removal of base from head (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
walteh authored May 28, 2024
1 parent a36b3d3 commit 02d3e10
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions pr_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"errors"
"slices"

"github.com/rs/zerolog"
)
Expand Down Expand Up @@ -107,33 +106,37 @@ func LoadExecutionFromPR(ctx context.Context, tprov TagReader, prr PRResolver) (
return nil, nil, err
}

beforeNoRoot := len(baseCommitTags)
// beforeNoRoot := len(baseCommitTags)

baseNoRoot := slices.DeleteFunc(baseCommitTags, func(t Tag) bool {
return slices.Contains(rootCommitTags, t)
})
// baseNoRoot := slices.DeleteFunc(baseCommitTags, func(t Tag) bool {
// 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")
// 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)
})
// headNoBase := slices.DeleteFunc(headBranchTags, func(t Tag) bool {
// return slices.ContainsFunc(baseBranchTags, func(b Tag) bool {
// return b.Name == t.Name
// })
// })

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

ex := &ActivePRProjectState{
CurrentPR: pr,
CurrentHeadCommitTags: headTags,
CurrentBaseBranchTags: baseNoRoot,
CurrentHeadBranchTags: headNoBase,
CurrentBaseBranchTags: baseBranchTags,
CurrentHeadBranchTags: headBranchTags,
CurrentBaseCommitTags: baseCommitTags,
CurrentRootBranchTags: rootBranchTags,
CurrentRootCommitTags: rootCommitTags,
Expand Down

0 comments on commit 02d3e10

Please sign in to comment.