overcommit 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/overcommit +0 -1
- data/config/default.yml +155 -2
- data/lib/overcommit.rb +2 -0
- data/lib/overcommit/cli.rb +1 -0
- data/lib/overcommit/configuration.rb +1 -1
- data/lib/overcommit/git_repo.rb +1 -2
- data/lib/overcommit/hook/base.rb +1 -1
- data/lib/overcommit/hook/commit_msg/gerrit_change_id.rb +1 -1
- data/lib/overcommit/hook/post_checkout/bower_install.rb +11 -0
- data/lib/overcommit/hook/post_checkout/bundle_install.rb +11 -0
- data/lib/overcommit/hook/post_checkout/npm_install.rb +11 -0
- data/lib/overcommit/hook/post_commit/bower_install.rb +11 -0
- data/lib/overcommit/hook/post_commit/bundle_install.rb +11 -0
- data/lib/overcommit/hook/post_commit/npm_install.rb +11 -0
- data/lib/overcommit/hook/post_merge/bower_install.rb +11 -0
- data/lib/overcommit/hook/post_merge/bundle_install.rb +11 -0
- data/lib/overcommit/hook/post_merge/npm_install.rb +11 -0
- data/lib/overcommit/hook/post_rewrite/bower_install.rb +11 -0
- data/lib/overcommit/hook/post_rewrite/bundle_install.rb +11 -0
- data/lib/overcommit/hook/post_rewrite/npm_install.rb +11 -0
- data/lib/overcommit/hook/pre_commit/base.rb +1 -1
- data/lib/overcommit/hook/pre_commit/chamber_security.rb +1 -1
- data/lib/overcommit/hook/pre_commit/coffee_lint.rb +19 -27
- data/lib/overcommit/hook/pre_commit/css_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/es_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/execute_permissions.rb +64 -0
- data/lib/overcommit/hook/pre_commit/go_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/go_vet.rb +2 -2
- data/lib/overcommit/hook/pre_commit/haml_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/hard_tabs.rb +1 -1
- data/lib/overcommit/hook/pre_commit/hlint.rb +32 -0
- data/lib/overcommit/hook/pre_commit/html_hint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/html_tidy.rb +1 -1
- data/lib/overcommit/hook/pre_commit/image_optim.rb +1 -1
- data/lib/overcommit/hook/pre_commit/java_checkstyle.rb +2 -2
- data/lib/overcommit/hook/pre_commit/js_hint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/js_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/jscs.rb +2 -2
- data/lib/overcommit/hook/pre_commit/jsl.rb +1 -1
- data/lib/overcommit/hook/pre_commit/pep257.rb +2 -2
- data/lib/overcommit/hook/pre_commit/pep8.rb +2 -2
- data/lib/overcommit/hook/pre_commit/puppet_lint.rb +24 -0
- data/lib/overcommit/hook/pre_commit/pyflakes.rb +2 -2
- data/lib/overcommit/hook/pre_commit/pylint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/python_flake8.rb +2 -2
- data/lib/overcommit/hook/pre_commit/reek.rb +2 -2
- data/lib/overcommit/hook/pre_commit/rubo_cop.rb +2 -2
- data/lib/overcommit/hook/pre_commit/ruby_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/scalariform.rb +2 -2
- data/lib/overcommit/hook/pre_commit/scalastyle.rb +2 -2
- data/lib/overcommit/hook/pre_commit/scss_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/semi_standard.rb +5 -3
- data/lib/overcommit/hook/pre_commit/shell_check.rb +2 -2
- data/lib/overcommit/hook/pre_commit/slim_lint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/sqlint.rb +24 -0
- data/lib/overcommit/hook/pre_commit/standard.rb +5 -3
- data/lib/overcommit/hook/pre_commit/trailing_whitespace.rb +1 -1
- data/lib/overcommit/hook/pre_commit/travis_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/vint.rb +2 -2
- data/lib/overcommit/hook/pre_commit/xml_lint.rb +2 -2
- data/lib/overcommit/hook/shared/bower_install.rb +13 -0
- data/lib/overcommit/hook/shared/bundle_install.rb +13 -0
- data/lib/overcommit/hook/shared/npm_install.rb +13 -0
- data/lib/overcommit/hook_context/base.rb +2 -2
- data/lib/overcommit/hook_context/pre_commit.rb +1 -1
- data/lib/overcommit/hook_context/run_all.rb +5 -0
- data/lib/overcommit/hook_signer.rb +2 -1
- data/lib/overcommit/installer.rb +4 -2
- data/lib/overcommit/os.rb +34 -0
- data/lib/overcommit/printer.rb +1 -1
- data/lib/overcommit/subprocess.rb +19 -1
- data/lib/overcommit/utils.rb +17 -5
- data/lib/overcommit/utils/file_utils.rb +69 -0
- data/lib/overcommit/version.rb +1 -1
- data/template-dir/hooks/commit-msg +2 -0
- data/template-dir/hooks/overcommit-hook +2 -0
- data/template-dir/hooks/post-checkout +2 -0
- data/template-dir/hooks/post-commit +2 -0
- data/template-dir/hooks/post-merge +2 -0
- data/template-dir/hooks/post-rewrite +2 -0
- data/template-dir/hooks/pre-commit +2 -0
- data/template-dir/hooks/pre-push +2 -0
- data/template-dir/hooks/pre-rebase +2 -0
- metadata +23 -16
@@ -0,0 +1,24 @@
|
|
1
|
+
module Overcommit::Hook::PreCommit
|
2
|
+
# Runs 'puppet-lint' against any modified Puppet files.
|
3
|
+
#
|
4
|
+
# @see http://puppet-lint.com/
|
5
|
+
class PuppetLint < Base
|
6
|
+
MESSAGE_REGEX = /(?<file>(?:\w:)?.+):(?<line>\d+):\d+:(?<type>\w+)/
|
7
|
+
|
8
|
+
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
|
9
|
+
type == 'ERROR' ? :error : :warning
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
result = execute(command, args: applicable_files)
|
14
|
+
output = result.stdout.chomp.gsub(/^"|"$/, '')
|
15
|
+
return :pass if result.success? && output.empty?
|
16
|
+
|
17
|
+
extract_messages(
|
18
|
+
output.split("\n"),
|
19
|
+
MESSAGE_REGEX,
|
20
|
+
MESSAGE_TYPE_CATEGORIZER
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -3,10 +3,10 @@ module Overcommit::Hook::PreCommit
|
|
3
3
|
#
|
4
4
|
# @see https://pypi.python.org/pypi/pyflakes
|
5
5
|
class Pyflakes < Base
|
6
|
-
MESSAGE_REGEX = /^(?<file>[^:]+):(?<line>\d+):/
|
6
|
+
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):/
|
7
7
|
|
8
8
|
def run
|
9
|
-
result = execute(command
|
9
|
+
result = execute(command, args: applicable_files)
|
10
10
|
return :pass if result.success?
|
11
11
|
|
12
12
|
errors = get_messages(result.stderr, :error)
|
@@ -3,7 +3,7 @@ module Overcommit::Hook::PreCommit
|
|
3
3
|
#
|
4
4
|
# @see http://www.pylint.org/
|
5
5
|
class Pylint < Base
|
6
|
-
MESSAGE_REGEX = /^(?<file
|
6
|
+
MESSAGE_REGEX = /^(?<file>(?:\w:)?.+):(?<line>\d+):(?<type>[CEFRW])/
|
7
7
|
|
8
8
|
# Classify 'E' and 'F' message codes as errors,
|
9
9
|
# everything else as warnings.
|
@@ -13,7 +13,7 @@ module Overcommit::Hook::PreCommit
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def run
|
16
|
-
result = execute(command
|
16
|
+
result = execute(command, args: applicable_files)
|
17
17
|
return :pass if result.success?
|
18
18
|
|
19
19
|
output = result.stdout.chomp
|
@@ -3,7 +3,7 @@ module Overcommit::Hook::PreCommit
|
|
3
3
|
#
|
4
4
|
# @see https://pypi.python.org/pypi/flake8
|
5
5
|
class PythonFlake8 < Base
|
6
|
-
MESSAGE_REGEX = /^(?<file
|
6
|
+
MESSAGE_REGEX = /^(?<file>(?:\w:)?.+):(?<line>\d+):\d+:\s(?<type>\w\d+)/
|
7
7
|
|
8
8
|
# Classify 'Exxx' and 'Fxxx' message codes as errors,
|
9
9
|
# everything else as warnings.
|
@@ -13,7 +13,7 @@ module Overcommit::Hook::PreCommit
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def run
|
16
|
-
result = execute(command
|
16
|
+
result = execute(command, args: applicable_files)
|
17
17
|
return :pass if result.success?
|
18
18
|
|
19
19
|
output = result.stdout.chomp
|
@@ -4,14 +4,14 @@ module Overcommit::Hook::PreCommit
|
|
4
4
|
# @see https://github.com/troessner/reek
|
5
5
|
class Reek < Base
|
6
6
|
def run
|
7
|
-
result = execute(command
|
7
|
+
result = execute(command, args: applicable_files)
|
8
8
|
return :pass if result.success?
|
9
9
|
|
10
10
|
output = scrub_output(result.stdout + result.stderr)
|
11
11
|
|
12
12
|
extract_messages(
|
13
13
|
output,
|
14
|
-
/^\s*(?<file>[^:]+):(?<line>\d+):/,
|
14
|
+
/^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+):/,
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
@@ -8,12 +8,12 @@ module Overcommit::Hook::PreCommit
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
result = execute(command
|
11
|
+
result = execute(command, args: applicable_files)
|
12
12
|
return :pass if result.success?
|
13
13
|
|
14
14
|
extract_messages(
|
15
15
|
result.stdout.split("\n"),
|
16
|
-
/^(?<file>[^:]+):(?<line>\d+):[^ ]+ (?<type>[^ ]+)/,
|
16
|
+
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+):[^ ]+ (?<type>[^ ]+)/,
|
17
17
|
MESSAGE_TYPE_CATEGORIZER,
|
18
18
|
)
|
19
19
|
end
|
@@ -8,12 +8,12 @@ module Overcommit::Hook::PreCommit
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
result = execute(command
|
11
|
+
result = execute(command, args: applicable_files)
|
12
12
|
return :pass if result.success?
|
13
13
|
|
14
14
|
extract_messages(
|
15
15
|
result.stdout.split("\n"),
|
16
|
-
/^(?<file>[^:]+):(?<type>[^:]+):(?<line>\d+)/,
|
16
|
+
/^(?<file>(?:\w:)?[^:]+):(?<type>[^:]+):(?<line>\d+)/,
|
17
17
|
MESSAGE_TYPE_CATEGORIZER
|
18
18
|
)
|
19
19
|
end
|
@@ -3,10 +3,10 @@ module Overcommit::Hook::PreCommit
|
|
3
3
|
#
|
4
4
|
# @see https://github.com/mdr/scalariform
|
5
5
|
class Scalariform < Base
|
6
|
-
MESSAGE_REGEX = /^\[(?<type>FAILED|ERROR)\]\s+(?<file
|
6
|
+
MESSAGE_REGEX = /^\[(?<type>FAILED|ERROR)\]\s+(?<file>(?:\w:)?.+)/
|
7
7
|
|
8
8
|
def run
|
9
|
-
result = execute(command
|
9
|
+
result = execute(command, args: applicable_files)
|
10
10
|
|
11
11
|
# example message:
|
12
12
|
# [FAILED] path/to/file.scala
|
@@ -5,13 +5,13 @@ module Overcommit::Hook::PreCommit
|
|
5
5
|
class Scalastyle < Base
|
6
6
|
MESSAGE_REGEX = /
|
7
7
|
^(?<type>error|warning)\s
|
8
|
-
file=(?<file
|
8
|
+
file=(?<file>(?:\w:)?.+)\s
|
9
9
|
message=.+\s
|
10
10
|
line=(?<line>\d+)
|
11
11
|
/x
|
12
12
|
|
13
13
|
def run
|
14
|
-
result = execute(command
|
14
|
+
result = execute(command, args: applicable_files)
|
15
15
|
output = result.stdout.chomp
|
16
16
|
messages = output.split("\n").grep(MESSAGE_REGEX)
|
17
17
|
return :pass if result.success? && messages.empty?
|
@@ -8,7 +8,7 @@ module Overcommit::Hook::PreCommit
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
result = execute(command
|
11
|
+
result = execute(command, args: applicable_files)
|
12
12
|
|
13
13
|
# Status code 81 indicates the applicable files were all filtered by
|
14
14
|
# exclusions defined by the configuration. In this case, we're happy to
|
@@ -20,7 +20,7 @@ module Overcommit::Hook::PreCommit
|
|
20
20
|
|
21
21
|
extract_messages(
|
22
22
|
result.stdout.split("\n"),
|
23
|
-
/^(?<file>[^:]+):(?<line>\d+)[^ ]* (?<type>[^ ]+)/,
|
23
|
+
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+)[^ ]* (?<type>[^ ]+)/,
|
24
24
|
MESSAGE_TYPE_CATEGORIZER,
|
25
25
|
)
|
26
26
|
end
|
@@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit
|
|
3
3
|
#
|
4
4
|
# @see https://github.com/Flet/semistandard
|
5
5
|
class SemiStandard < Base
|
6
|
+
MESSAGE_REGEX = /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
|
7
|
+
|
6
8
|
def run
|
7
|
-
result = execute(command
|
9
|
+
result = execute(command, args: applicable_files)
|
8
10
|
output = result.stdout.chomp
|
9
11
|
return :pass if result.success? && output.empty?
|
10
12
|
|
11
13
|
# example message:
|
12
14
|
# path/to/file.js:1:1: Error message (ruleName)
|
13
15
|
extract_messages(
|
14
|
-
output.split("\n")
|
15
|
-
|
16
|
+
output.split("\n").grep(MESSAGE_REGEX), # ignore header line
|
17
|
+
MESSAGE_REGEX
|
16
18
|
)
|
17
19
|
end
|
18
20
|
end
|
@@ -8,12 +8,12 @@ module Overcommit::Hook::PreCommit
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
result = execute(command
|
11
|
+
result = execute(command, args: applicable_files)
|
12
12
|
return :pass if result.success?
|
13
13
|
|
14
14
|
extract_messages(
|
15
15
|
result.stdout.split("\n"),
|
16
|
-
/^(?<file>[^:]+):(?<line>\d+):[^ ]+ (?<type>[^ ]+)/,
|
16
|
+
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+):[^ ]+ (?<type>[^ ]+)/,
|
17
17
|
MESSAGE_TYPE_CATEGORIZER,
|
18
18
|
)
|
19
19
|
end
|
@@ -8,12 +8,12 @@ module Overcommit::Hook::PreCommit
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
result = execute(command
|
11
|
+
result = execute(command, args: applicable_files)
|
12
12
|
return :pass if result.success?
|
13
13
|
|
14
14
|
extract_messages(
|
15
15
|
result.stdout.split("\n"),
|
16
|
-
/^(?<file>[^:]+):(?<line>\d+)[^ ]* (?<type>[^ ]+)/,
|
16
|
+
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+)[^ ]* (?<type>[^ ]+)/,
|
17
17
|
MESSAGE_TYPE_CATEGORIZER,
|
18
18
|
)
|
19
19
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Overcommit::Hook::PreCommit
|
2
|
+
# Runs 'sqlint' against any modified SQL files.
|
3
|
+
#
|
4
|
+
# @see https://github.com/purcell/sqlint
|
5
|
+
class Sqlint < Base
|
6
|
+
MESSAGE_REGEX = /(?<file>(?:\w:)?.+):(?<line>\d+):\d+:(?<type>\w+)/
|
7
|
+
|
8
|
+
MESSAGE_TYPE_CATEGORIZER = lambda do |type|
|
9
|
+
type == 'ERROR' ? :error : :warning
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
result = execute(command, args: applicable_files)
|
14
|
+
output = result.stdout.chomp
|
15
|
+
return :pass if result.success? && output.empty?
|
16
|
+
|
17
|
+
extract_messages(
|
18
|
+
output.split("\n"),
|
19
|
+
MESSAGE_REGEX,
|
20
|
+
MESSAGE_TYPE_CATEGORIZER
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit
|
|
3
3
|
#
|
4
4
|
# @see https://github.com/feross/standard
|
5
5
|
class Standard < Base
|
6
|
+
MESSAGE_REGEX = /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
|
7
|
+
|
6
8
|
def run
|
7
|
-
result = execute(command
|
9
|
+
result = execute(command, args: applicable_files)
|
8
10
|
output = result.stdout.chomp
|
9
11
|
return :pass if result.success? && output.empty?
|
10
12
|
|
11
13
|
# example message:
|
12
14
|
# path/to/file.js:1:1: Error message (ruleName)
|
13
15
|
extract_messages(
|
14
|
-
output.split("\n")
|
15
|
-
|
16
|
+
output.split("\n").grep(MESSAGE_REGEX), # ignore header line
|
17
|
+
MESSAGE_REGEX
|
16
18
|
)
|
17
19
|
end
|
18
20
|
end
|
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
|
|
4
4
|
# @see https://github.com/travis-ci/travis.rb
|
5
5
|
class TravisLint < Base
|
6
6
|
def run
|
7
|
-
result = execute(command
|
7
|
+
result = execute(command, args: applicable_files)
|
8
8
|
return :pass if result.success?
|
9
9
|
|
10
10
|
[:fail, (result.stdout + result.stderr).strip]
|
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
|
|
4
4
|
# @see https://github.com/Kuniwak/vint
|
5
5
|
class Vint < Base
|
6
6
|
def run
|
7
|
-
result = execute(command
|
7
|
+
result = execute(command, args: applicable_files)
|
8
8
|
return :pass if result.success?
|
9
9
|
|
10
10
|
return [:fail, result.stderr] unless result.stderr.empty?
|
@@ -13,7 +13,7 @@ module Overcommit::Hook::PreCommit
|
|
13
13
|
# path/to/file.vim:1:1: Error message
|
14
14
|
extract_messages(
|
15
15
|
result.stdout.split("\n"),
|
16
|
-
/^(?<file>[^:]+):(?<line>\d+)/
|
16
|
+
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
|
17
17
|
)
|
18
18
|
end
|
19
19
|
end
|
@@ -3,10 +3,10 @@ module Overcommit::Hook::PreCommit
|
|
3
3
|
#
|
4
4
|
# @see http://xmlsoft.org/xmllint.html
|
5
5
|
class XmlLint < Base
|
6
|
-
MESSAGE_REGEX = /^(?<file>[^:]+):(?<line>\d+):/
|
6
|
+
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):/
|
7
7
|
|
8
8
|
def run
|
9
|
-
result = execute(command
|
9
|
+
result = execute(command, args: applicable_files)
|
10
10
|
output = result.stderr.chomp
|
11
11
|
|
12
12
|
return :pass if result.success? && output.empty?
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Overcommit::Hook::Shared
|
2
|
+
# Shared code used by all BowerInstall hooks. Runs `bower install` when a
|
3
|
+
# change is detected in the repository's dependencies.
|
4
|
+
#
|
5
|
+
# @see http://bower.io/
|
6
|
+
module BowerInstall
|
7
|
+
def run
|
8
|
+
result = execute(command)
|
9
|
+
return :fail, result.stderr unless result.success?
|
10
|
+
:pass
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Overcommit::Hook::Shared
|
2
|
+
# Shared code used by all BundleInstall hooks. Runs `bundle install` when a
|
3
|
+
# change is detected in the repository's dependencies.
|
4
|
+
#
|
5
|
+
# @see http://bundler.io/
|
6
|
+
module BundleInstall
|
7
|
+
def run
|
8
|
+
result = execute(command)
|
9
|
+
return :fail, result.stdout unless result.success?
|
10
|
+
:pass
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Overcommit::Hook::Shared
|
2
|
+
# Shared code used by all NpmInstall hooks. Runs `npm install` when a change
|
3
|
+
# is detected in the repository's dependencies.
|
4
|
+
#
|
5
|
+
# @see https://www.npmjs.com/
|
6
|
+
module NpmInstall
|
7
|
+
def run
|
8
|
+
result = execute(command)
|
9
|
+
return :fail, result.stderr unless result.success?
|
10
|
+
:pass
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -49,7 +49,7 @@ module Overcommit::HookContext
|
|
49
49
|
#
|
50
50
|
# @return [String]
|
51
51
|
def hook_script_name
|
52
|
-
hook_type_name.
|
52
|
+
hook_type_name.tr('_', '-')
|
53
53
|
end
|
54
54
|
|
55
55
|
# Initializes anything related to the environment.
|
@@ -116,7 +116,7 @@ module Overcommit::HookContext
|
|
116
116
|
# a file, but the actual working tree will have a directory.
|
117
117
|
def filter_directories(modified_files)
|
118
118
|
modified_files.reject do |file|
|
119
|
-
File.directory?(file) && !
|
119
|
+
File.directory?(file) && !Overcommit::Utils::FileUtils.symlink?(file)
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
@@ -25,7 +25,7 @@ module Overcommit::HookContext
|
|
25
25
|
each do |match|
|
26
26
|
return @amendment if
|
27
27
|
# True if the command uses a git alias for `commit --amend`
|
28
|
-
@amendment = !(/git
|
28
|
+
@amendment = !(/git(\.exe)?\s+#{match[0]}/ =~ cmd).nil?
|
29
29
|
end
|
30
30
|
|
31
31
|
@amendment
|
data/lib/overcommit/installer.rb
CHANGED
@@ -114,7 +114,8 @@ module Overcommit
|
|
114
114
|
"Hook '#{File.expand_path(hook_type)}' already exists and " \
|
115
115
|
'was not installed by Overcommit'
|
116
116
|
end
|
117
|
-
FileUtils.
|
117
|
+
FileUtils.rm_f(hook_type)
|
118
|
+
Overcommit::Utils::FileUtils.symlink('overcommit-hook', hook_type)
|
118
119
|
end
|
119
120
|
end
|
120
121
|
end
|
@@ -177,7 +178,8 @@ module Overcommit
|
|
177
178
|
def overcommit_hook?(file)
|
178
179
|
return true if File.read(file) =~ /OVERCOMMIT_DISABLE/
|
179
180
|
# TODO: Remove these checks once we hit version 1.0
|
180
|
-
|
181
|
+
Overcommit::Utils::FileUtils.symlink?(file) &&
|
182
|
+
Overcommit::Utils::FileUtils.readlink(file) == 'overcommit-hook'
|
181
183
|
rescue Errno::ENOENT
|
182
184
|
# Some Ruby implementations (e.g. JRuby) raise an error when the file
|
183
185
|
# doesn't exist. Standardize the behavior to return false.
|