Skip to content

Commit 00c90df

Browse files
committed
rule: distinguish undeclared vs empty local filter
in the presence of a declared default_branch_filter, empty ([]) = locally override it and apply no filter undefined = use default_branch_filter
1 parent 963df20 commit 00c90df

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/rule.atd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type status_rule = {
6666
type prefix_rule = {
6767
?allow <json name="match"> : string list nullable;
6868
?ignore : string list nullable;
69-
~branch_filters <ocaml default="[]"> : string list;
69+
?branch_filters : string list nullable;
7070
channel_name <json name="channel"> : string;
7171
}
7272

lib/rule.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ module Prefix = struct
4444
if no filter is matched. *)
4545
let filter_by_branch ~branch ~default_branch_filters ~distinct rule =
4646
match rule.branch_filters with
47-
| _ :: _ as filters -> List.mem filters branch ~equal:String.equal
48-
| [] ->
47+
| Some (_ :: _ as filters) -> List.mem filters branch ~equal:String.equal
48+
| Some [] -> distinct
49+
| None ->
4950
match default_branch_filters with
5051
| _ :: _ as filters -> List.mem filters branch ~equal:String.equal
5152
| [] -> distinct

0 commit comments

Comments
 (0)