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
8585 end
8686
8787 def skip?
88- skipped_commit_types . include? ( commit_message_source )
88+ super || skipped_commit_types . include? ( commit_message_source )
8989 end
9090 end
9191end
Original file line number Diff line number Diff line change @@ -70,6 +70,26 @@ def remove_file(name)
7070 expect ( File . read ( 'COMMIT_EDITMSG' ) ) . to eq ( "[123] \n " )
7171 end
7272 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
7393 end
7494
7595 context "when the checked out branch doesn't matches the pattern" do
You can’t perform that action at this time.
0 commit comments