File tree 2 files changed +17
-1
lines changed
lib/overcommit/hook/commit_msg
spec/overcommit/hook/commit_msg
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def validate_pattern(message)
19
19
expected_pattern_message = config [ 'expected_pattern_message' ]
20
20
sample_message = config [ 'sample_message' ]
21
21
22
- unless message =~ /#{ pattern } /
22
+ unless message =~ /#{ pattern } /m
23
23
[
24
24
'Commit message pattern mismatch.' ,
25
25
"Expected : #{ expected_pattern_message } " ,
Original file line number Diff line number Diff line change 39
39
40
40
it { should fail_hook expected_message }
41
41
end
42
+
43
+ context 'when multiline message matches the pattern' do
44
+ let ( :config ) do
45
+ super ( ) . merge ( Overcommit ::Configuration . new (
46
+ 'CommitMsg' => {
47
+ 'MessageFormat' => {
48
+ 'pattern' => '^Some .* Message$'
49
+ }
50
+ }
51
+ ) )
52
+ end
53
+
54
+ let ( :commit_msg ) { "Some \n multiline \n Message" }
55
+
56
+ it { should pass }
57
+ end
42
58
end
You can’t perform that action at this time.
0 commit comments