class Overcommit::HookContext::PrePush

Contains helpers related to contextual information used by pre-push hooks.

Constants

PushedRef

Attributes

args[RW]

Public Instance Methods

modified_files() click to toggle source
# File lib/overcommit/hook_context/pre_push.rb, line 31
def modified_files
  @modified_files ||= pushed_refs.map(&:modified_files).flatten.uniq
end
modified_lines_in_file(file) click to toggle source
# File lib/overcommit/hook_context/pre_push.rb, line 35
def modified_lines_in_file(file)
  @modified_lines ||= {}
  @modified_lines[file] = pushed_refs.each_with_object(Set.new) do |pushed_ref, set|
    set.merge(pushed_ref.modified_lines_in_file(file))
  end
end
pushed_refs() click to toggle source
# File lib/overcommit/hook_context/pre_push.rb, line 25
def pushed_refs
  input_lines.map do |line|
    PushedRef.new(*line.split(' '))
  end
end
remote_name() click to toggle source
# File lib/overcommit/hook_context/pre_push.rb, line 8
def remote_name
  @args[0]
end
remote_ref_deletion?() click to toggle source
# File lib/overcommit/hook_context/pre_push.rb, line 16
def remote_ref_deletion?
  return @remote_ref_deletion if defined?(@remote_ref_deletion)

  @remote_ref_deletion ||= input_lines.
                           first&.
                           split(' ')&.
                           first == '(deleted)'
end
remote_url() click to toggle source
# File lib/overcommit/hook_context/pre_push.rb, line 12
def remote_url
  @args[1]
end