File tree 2 files changed +6
-7
lines changed
lib/overcommit/hook/pre_push
spec/overcommit/hook/pre_push
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
4
4
# @see https://git-lfs.github.com/
5
5
class GitLfs < Base
6
6
def run
7
- result = execute ( [ 'command' , '-v' , 'git-lfs' ] )
8
- unless result . success?
7
+ unless in_path? ( 'git-lfs' )
9
8
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, " \
11
10
'disable this hook by removing or setting \'enabled: false\' for GitLFS ' \
12
11
'hook in your .overcommit.yml file'
13
12
end
Original file line number Diff line number Diff line change 8
8
let ( :result ) { double ( 'result' ) }
9
9
10
10
before do
11
+ subject . stub ( in_path? : true )
11
12
subject . stub ( :execute ) . and_return ( result )
12
13
end
13
14
14
15
context 'when git-lfs is not on path' do
15
16
before do
16
- result . stub ( success ? : false , stderr : '' )
17
+ subject . stub ( in_path ? : false )
17
18
end
18
19
19
20
it { should warn }
29
30
30
31
context 'when git lfs hook exits unsuccessfully' do
31
32
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' )
35
35
end
36
36
37
37
it { should fail_hook }
You can’t perform that action at this time.
0 commit comments