Skip to content

Commit 773a5b5

Browse files
author
Shane da Silva
committed
Display better error when hooks already exist
When non-Overcommit hooks were already installed in a repo, Overcommit would raise an exception. Change the behavior to gracefully catch the exception and display a normal error message. Change-Id: Ibc11c3d9f476a47c403133ebe1b90f138078a1ca Reviewed-on: http://gerrit.causes.com/36003 Tested-by: jenkins <jenkins@causes.com> Reviewed-by: Shane da Silva <shane@causes.com>
1 parent fdcefbf commit 773a5b5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
instead of a shell string
77
* Rename `command` hook helper to `execute`
88
* Add support for JRuby 1.7.9 in Ruby 1.9 mode
9+
* Display more helpful error message when installing Overcommit into a repo
10+
that already has non-Overcommit hooks
911

1012
## 0.6.3
1113

lib/overcommit/cli.rb

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def install_or_uninstall
8181
rescue Overcommit::Exceptions::InvalidGitRepo => error
8282
log.warning "Invalid repo #{target}: #{error}"
8383
halt 69 # EX_UNAVAILABLE
84+
rescue Overcommit::Exceptions::PreExistingHooks => error
85+
log.warning "Unable to install into #{target}: #{error}"
86+
halt 73 # EX_CANTCREAT
8487
end
8588
end
8689
end

0 commit comments

Comments
 (0)