Skip to content

Commit 82d5220

Browse files
committed
Fix grep-based hooks to work with long file lists
Now that the `execute` helper supports passing in a separate list of splittable arguments, we can use that version to avoid issues with long lists of files exceeding the maximum command length for the operating system.
1 parent 317047a commit 82d5220

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

lib/overcommit/hook/pre_commit/hard_tabs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Overcommit::Hook::PreCommit
22
# Checks for hard tabs in files.
33
class HardTabs < Base
44
def run
5-
result = execute(command + applicable_files)
5+
result = execute(command, applicable_files)
66

77
extract_messages(
88
result.stdout.split("\n"),

lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Overcommit::Hook::PreCommit
22
# Checks for local paths in files and issues a warning
33
class LocalPathsInGemfile < Base
44
def run
5-
result = execute(command + applicable_files)
5+
result = execute(command, applicable_files)
66

77
unless result.stdout.empty?
88
return :warn, "Avoid pointing to local paths in Gemfiles:\n#{result.stdout}"

lib/overcommit/hook/pre_commit/merge_conflicts.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Overcommit::Hook::PreCommit
22
# Checks for unresolved merge conflicts
33
class MergeConflicts < Base
44
def run
5-
result = execute(command + applicable_files)
5+
result = execute(command, applicable_files)
66

77
unless result.stdout.empty?
88
return :fail, "Merge conflict markers detected:\n#{result.stdout}"

lib/overcommit/hook/pre_commit/trailing_whitespace.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Overcommit::Hook::PreCommit
22
# Checks for trailing whitespace in files.
33
class TrailingWhitespace < Base
44
def run
5-
result = execute(command + applicable_files)
5+
result = execute(command, applicable_files)
66

77
extract_messages(
88
result.stdout.split("\n"),

0 commit comments

Comments
 (0)