Skip to content

Commit 7211c4c

Browse files
committed
Pass STDIN to HookContext::Base constructor
1 parent f1bff8a commit 7211c4c

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/overcommit/hook_context.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Utility module which manages the creation of {HookContext}s.
22
module Overcommit::HookContext
3-
def self.create(hook_type, config, args)
3+
def self.create(hook_type, config, args, input)
44
hook_type_class = Overcommit::Utils.camel_case(hook_type)
55
underscored_hook_type = Overcommit::Utils.snake_case(hook_type)
66

77
require "overcommit/hook_context/#{underscored_hook_type}"
88

9-
Overcommit::HookContext.const_get(hook_type_class).new(config, args)
9+
Overcommit::HookContext.const_get(hook_type_class).new(config, args, input)
1010
rescue LoadError, NameError => error
1111
# Could happen when a symlink was created for a hook type Overcommit does
1212
# not yet support.

lib/overcommit/hook_context/base.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ module Overcommit::HookContext
1313
class Base
1414
# @param config [Overcommit::Configuration]
1515
# @param args [Array<String>]
16-
def initialize(config, args)
16+
def initialize(config, args, input)
1717
@config = config
1818
@args = args
19+
@input = input
1920
end
2021

2122
# Returns the camel-cased type of this hook (e.g. PreCommit)

template-dir/hooks/overcommit-hook

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ begin
4545

4646
config = Overcommit::ConfigurationLoader.load_repo_config
4747

48-
context = Overcommit::HookContext.create(hook_type, config, ARGV)
48+
context = Overcommit::HookContext.create(hook_type, config, ARGV, STDIN)
4949
config.apply_environment!(context, ENV)
5050

5151
printer = Overcommit::Printer.new(logger, context)

0 commit comments

Comments
 (0)