File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
lib/overcommit/hook/prepare_commit_msg
spec/overcommit/hook/prepare_commit_msg Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ def skipped_commit_types
85
85
end
86
86
87
87
def skip?
88
- skipped_commit_types . include? ( commit_message_source )
88
+ super || skipped_commit_types . include? ( commit_message_source )
89
89
end
90
90
end
91
91
end
Original file line number Diff line number Diff line change @@ -70,6 +70,26 @@ def remove_file(name)
70
70
expect ( File . read ( 'COMMIT_EDITMSG' ) ) . to eq ( "[123] \n " )
71
71
end
72
72
end
73
+
74
+ context 'when skip_if exits with a zero status' do
75
+ let ( :config ) { new_config ( 'skip_if' => [ 'bash' , '-c' , 'exit 0' ] ) }
76
+
77
+ it { is_expected . to pass }
78
+
79
+ it 'does not change the commit message' do
80
+ expect ( File . read ( 'COMMIT_EDITMSG' ) ) . to eq ( "\n " )
81
+ end
82
+ end
83
+
84
+ context 'when skip_if exits with a non-zero status' do
85
+ let ( :config ) { new_config ( 'skip_if' => [ 'bash' , '-c' , 'exit 1' ] ) }
86
+
87
+ it { is_expected . to pass }
88
+
89
+ it 'does change the commit message' do
90
+ expect ( File . read ( 'COMMIT_EDITMSG' ) ) . to eq ( "[#123]\n " )
91
+ end
92
+ end
73
93
end
74
94
75
95
context "when the checked out branch doesn't matches the pattern" do
You can’t perform that action at this time.
0 commit comments