File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -38,20 +38,17 @@ let event_of_filename filename =
38
38
39
39
let is_main_merge_message ~msg :message ~branch (cfg : Config_t.config ) =
40
40
match cfg.main_branch_name with
41
- | Some main_branch when String. equal branch main_branch ->
41
+ | Some main_branch ->
42
42
(*
43
43
handle "Merge <main branch> into <feature branch>" commits when they are merged into main branch
44
44
we should have already seen these commits on the feature branch but for some reason they are distinct:true
45
45
*)
46
- let prefix = sprintf " Merge branch '%s' into " main_branch in
47
- let prefix2 = sprintf " Merge remote-tracking branch 'origin/%s' into " main_branch in
48
- let title = Common. first_line message in
49
- String. is_prefix title ~prefix || String. is_prefix title ~prefix: prefix2
50
- | Some main_branch ->
51
- let expect = sprintf " Merge branch '%s' into %s" main_branch branch in
52
- let expect2 = sprintf " Merge remote-tracking branch 'origin/%s' into %s" main_branch branch in
46
+ let re =
47
+ Str. regexp (sprintf {|^ Merge \( remote- tracking\)? branch '\(origin/ \)?% s'\( of .+ \)? into \(.+ \)$| } main_branch)
48
+ in
53
49
let title = Common. first_line message in
54
- String. equal title expect || String. equal title expect2
50
+ let matched = Str. string_match re title 0 in
51
+ matched && (String. equal branch main_branch || String. equal branch (Str. matched_group 4 title))
55
52
| _ -> false
56
53
57
54
let modified_files_of_commit commit = List. concat [ commit.added; commit.removed; commit.modified ]
You can’t perform that action at this time.
0 commit comments