File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
lib/overcommit/hook/pre_push
spec/overcommit/hook/pre_push Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,9 @@ module Overcommit::Hook::PrePush
44 # @see https://git-lfs.github.com/
55 class GitLfs < Base
66 def run
7- result = execute ( [ 'command' , '-v' , 'git-lfs' ] )
8- unless result . success?
7+ unless in_path? ( 'git-lfs' )
98 return :warn , 'This repository is configured for Git LFS but \'git-lfs\' ' \
10- ' was not found on your path.\nIf you no longer wish to use Git LFS, ' \
9+ " was not found on your path.\n If you no longer wish to use Git LFS, " \
1110 'disable this hook by removing or setting \'enabled: false\' for GitLFS ' \
1211 'hook in your .overcommit.yml file'
1312 end
Original file line number Diff line number Diff line change 88 let ( :result ) { double ( 'result' ) }
99
1010 before do
11+ subject . stub ( in_path? : true )
1112 subject . stub ( :execute ) . and_return ( result )
1213 end
1314
1415 context 'when git-lfs is not on path' do
1516 before do
16- result . stub ( success ? : false , stderr : '' )
17+ subject . stub ( in_path ? : false )
1718 end
1819
1920 it { should warn }
2930
3031 context 'when git lfs hook exits unsuccessfully' do
3132 before do
32- # First for checking that git-lfs is on path, second for calling the hook itself
33- result . stub ( :success? ) . and_return ( true , false )
34- result . stub ( :stderr ) . and_return ( '' , 'error: failed to push some refs' )
33+ result . stub ( success? : false )
34+ result . stub ( stderr : 'error: failed to push some refs' )
3535 end
3636
3737 it { should fail_hook }
You can’t perform that action at this time.
0 commit comments