diff --git a/lib/overcommit/hook_context/helpers/file_modifications.rb b/lib/overcommit/hook_context/helpers/file_modifications.rb index 00aaccc8..e0823732 100644 --- a/lib/overcommit/hook_context/helpers/file_modifications.rb +++ b/lib/overcommit/hook_context/helpers/file_modifications.rb @@ -12,7 +12,9 @@ def amendment? cmd = Overcommit::Utils.parent_command return unless cmd - amend_pattern = 'commit(\s.*)?\s--amend(\s|$)' + # POSIX character class rather than `\s`, which macOS git's regex + # library does not support + amend_pattern = 'commit([[:space:]].*)?[[:space:]]--amend([[:space:]]|$)' # Since the ps command can return invalid byte sequences for commands # containing unicode characters, we replace the offending characters,