overcommit 0.26.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +38 -0
- data/config/starter.yml +2 -1
- data/lib/overcommit/cli.rb +2 -0
- data/lib/overcommit/command_splitter.rb +144 -0
- data/lib/overcommit/configuration.rb +45 -10
- data/lib/overcommit/exceptions.rb +3 -0
- data/lib/overcommit/git_repo.rb +8 -0
- data/lib/overcommit/hook/base.rb +16 -2
- data/lib/overcommit/hook/post_rewrite/base.rb +1 -1
- data/lib/overcommit/hook/pre_commit/case_conflicts.rb +1 -1
- data/lib/overcommit/hook/pre_commit/hard_tabs.rb +1 -1
- data/lib/overcommit/hook/pre_commit/html_hint.rb +21 -0
- data/lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb +1 -1
- data/lib/overcommit/hook/pre_commit/merge_conflicts.rb +1 -1
- data/lib/overcommit/hook/pre_commit/semi_standard.rb +2 -2
- data/lib/overcommit/hook/pre_commit/standard.rb +2 -2
- data/lib/overcommit/hook/pre_commit/trailing_whitespace.rb +1 -1
- data/lib/overcommit/hook_context/base.rb +43 -1
- data/lib/overcommit/hook_context/commit_msg.rb +2 -2
- data/lib/overcommit/hook_context/post_checkout.rb +8 -0
- data/lib/overcommit/hook_context/post_rewrite.rb +29 -0
- data/lib/overcommit/hook_context/pre_commit.rb +1 -14
- data/lib/overcommit/hook_loader/plugin_hook_loader.rb +42 -3
- data/lib/overcommit/hook_runner.rb +12 -0
- data/lib/overcommit/hook_signer.rb +41 -6
- data/lib/overcommit/logger.rb +5 -0
- data/lib/overcommit/printer.rb +1 -1
- data/lib/overcommit/subprocess.rb +22 -1
- data/lib/overcommit/utils.rb +58 -4
- data/lib/overcommit/version.rb +1 -1
- data/template-dir/hooks/commit-msg +24 -4
- data/template-dir/hooks/overcommit-hook +24 -4
- data/template-dir/hooks/post-checkout +24 -4
- data/template-dir/hooks/post-commit +24 -4
- data/template-dir/hooks/post-merge +24 -4
- data/template-dir/hooks/post-rewrite +24 -4
- data/template-dir/hooks/pre-commit +24 -4
- data/template-dir/hooks/pre-push +24 -4
- data/template-dir/hooks/pre-rebase +24 -4
- metadata +6 -3
data/lib/overcommit/version.rb
CHANGED
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
data/template-dir/hooks/pre-push
CHANGED
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|
@@ -25,17 +25,32 @@ if hook_type == 'overcommit-hook'
|
|
25
25
|
exit 64 # EX_USAGE
|
26
26
|
end
|
27
27
|
|
28
|
+
# Check if Overcommit should invoke a Bundler context for loading gems
|
29
|
+
require 'yaml'
|
30
|
+
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
|
31
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
32
|
+
require 'bundler/setup'
|
33
|
+
end
|
34
|
+
|
28
35
|
begin
|
29
36
|
require 'overcommit'
|
30
37
|
rescue LoadError
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
if gemfile
|
39
|
+
puts 'You have specified the `gemfile` option in your Overcommit ' \
|
40
|
+
'configuration but have not added the `overcommit` gem to ' \
|
41
|
+
"#{gemfile}."
|
42
|
+
else
|
43
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
44
|
+
"`overcommit` gem is not installed.\n" \
|
45
|
+
'Install it with `gem install overcommit`.'
|
46
|
+
end
|
47
|
+
|
48
|
+
exit 64 # EX_USAGE
|
35
49
|
end
|
36
50
|
|
37
51
|
begin
|
38
52
|
logger = Overcommit::Logger.new(STDOUT)
|
53
|
+
Overcommit::Utils.log = logger
|
39
54
|
|
40
55
|
# Ensure master hook is up-to-date
|
41
56
|
installer = Overcommit::Installer.new(logger)
|
@@ -61,6 +76,11 @@ rescue Overcommit::Exceptions::HookContextLoadError => error
|
|
61
76
|
puts error
|
62
77
|
puts 'Are you running an old version of Overcommit?'
|
63
78
|
exit 69 # EX_UNAVAILABLE
|
79
|
+
rescue Overcommit::Exceptions::HookLoadError,
|
80
|
+
Overcommit::Exceptions::InvalidHookDefinition => error
|
81
|
+
puts error.message
|
82
|
+
puts error.backtrace
|
83
|
+
exit 78 # EX_CONFIG
|
64
84
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
85
|
Overcommit::Exceptions::HookCleanupFailed => error
|
66
86
|
puts error.message
|