Sha256: 21d8ba7673e5015f21ccc0fe02b62500599974cb43d9e897723912d873e36a8b
Contents?: true
Size: 969 Bytes
Versions: 31
Compression:
Stored size: 969 Bytes
Contents
# frozen_string_literal: true module Overcommit::HookContext # Contains helpers related to contextual information used by post-checkout # hooks. class PostCheckout < Base # Returns the ref of the HEAD that we transitioned from. def previous_head @args[0] end # Returns the ref of the new current HEAD. def new_head @args[1] end # Returns whether this checkout was the result of changing/updating a # branch. def branch_checkout? @args[2].to_i == 1 end # Returns whether this checkout was for a single file. def file_checkout? !branch_checkout? end # Get a list of files that have been added or modified between # `previous_head` and `new_head`. Renames and deletions are ignored, since # there should be nothing to check. def modified_files @modified_files ||= Overcommit::GitRepo.modified_files(refs: "#{previous_head} #{new_head}") end end end
Version data entries
31 entries across 31 versions & 2 rubygems