module Overcommit::Hook::Shared::SubmoduleStatus
Shared
code used by all ‘SubmoduleStatus` hooks to notify the user if any submodules are uninitialized, out of date with the current index, or contain merge conflicts.
Public Instance Methods
Source
# File lib/overcommit/hook/shared/submodule_status.rb, line 8 def run messages = [] submodule_statuses.each do |submodule_status| path = submodule_status.path if submodule_status.uninitialized? messages << "Submodule #{path} is uninitialized." elsif submodule_status.outdated? messages << "Submodule #{path} is out of date with the current index." elsif submodule_status.merge_conflict? messages << "Submodule #{path} has merge conflicts." end end return :pass if messages.empty? [:warn, messages.join("\n")] end
Private Instance Methods
Source
# File lib/overcommit/hook/shared/submodule_status.rb, line 28 def submodule_statuses Overcommit::GitRepo.submodule_statuses(recursive: config['recursive']) end