Skip to content

Commit 33f9c9e

Browse files
committed
filterGroupValue: take a *RefGroupBuilder as argument
1 parent dc63571 commit 33f9c9e

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

internal/refopts/filter_group_value.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@ import (
2121
// contains a pointer to a `refGroup` and uses it (including its
2222
// `parent` and `subgroups` to figure out what should be allowed.
2323
type filterGroupValue struct {
24-
filter *git.ReferenceFilter
25-
groups map[sizes.RefGroupSymbol]*refGroup
24+
rgb *RefGroupBuilder
2625
}
2726

2827
func (v *filterGroupValue) Set(symbolString string) error {
2928
symbol := sizes.RefGroupSymbol(symbolString)
3029

31-
refGroup, ok := v.groups[symbol]
30+
refGroup, ok := v.rgb.groups[symbol]
3231

3332
if !ok || symbol == "" {
3433
return fmt.Errorf("refgroup '%s' is not defined", symbol)
3534
}
3635

37-
*v.filter = git.Include.Combine(*v.filter, refGroupFilter{refGroup})
36+
v.rgb.topLevelGroup.filter = git.Include.Combine(
37+
v.rgb.topLevelGroup.filter, refGroupFilter{refGroup},
38+
)
3839

3940
return nil
4041
}

internal/refopts/ref_group_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func (rgb *RefGroupBuilder) AddRefopts(flags *pflag.FlagSet) {
221221
flag.NoOptDefVal = "true"
222222

223223
flag = flags.VarPF(
224-
&filterGroupValue{tlf, rgb.groups}, "refgroup", "",
224+
&filterGroupValue{rgb}, "refgroup", "",
225225
"process references in refgroup defined by gitconfig",
226226
)
227227

0 commit comments

Comments
 (0)