template-dir/hooks/pre-commit in overcommit-0.15.0 vs template-dir/hooks/pre-commit in overcommit-0.16.0

- old
+ new

@@ -2,10 +2,18 @@ # Entrypoint for Overcommit hook integration. Installing Overcommit will result # in all of your git hooks being symlinked to this file, allowing the framework # to manage your hooks for you. +# Prevent a Ruby stack trace from appearing when we interrupt the hook. +# Note that this will be overridden when Overcommit is loaded, since the +# InterruptHandler will redefine the trap at that time. +Signal.trap('INT') do + puts 'Hook run interrupted' + exit 130 +end + # Required for Ruby 1.8 compatibility (for older OSX versions) if RUBY_VERSION.split('.')[0..1] == %w[1 8] require 'rubygems' end @@ -76,15 +84,16 @@ exit 78 # EX_CONFIG rescue Overcommit::Exceptions::HookContextLoadError => error puts error puts 'Are you running an old version of Overcommit?' exit 69 # EX_UNAVAILABLE -rescue Overcommit::Exceptions::HookSetupFailed => error - puts error +rescue Overcommit::Exceptions::HookSetupFailed, + Overcommit::Exceptions::HookCleanupFailed => error + puts error.message exit 74 # EX_IOERR rescue Overcommit::Exceptions::HookCancelled puts 'You cancelled the hook run' - exit 1 + exit 130 # Ctrl-C cancel rescue Overcommit::Exceptions::InvalidGitRepo => error puts error exit 64 # EX_USAGE rescue => error puts error.message