Skip to content

Commit a76f1ac

Browse files
sdsShane da Silva
authored and
Shane da Silva
committed
Reset gem path after installing Overcommit
When running the Overcommit hook when Overcommit has not been installed, the user is asked to install it. However, after installation you could not load the `overcommit` gem since the gem path was already cached. Fix this by resetting the gem path. Change-Id: I868edd68ef4603610faf3d8f98f648f2691dfe38 Reviewed-on: http://gerrit.causes.com/35619 Reviewed-by: Shane da Silva <shane@causes.com> Tested-by: Shane da Silva <shane@causes.com>
1 parent d5c8808 commit a76f1ac

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

template-dir/hooks/overcommit-hook

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ rescue LoadError
2727

2828
if (answer = gets) && answer.strip.downcase.start_with?('y')
2929
if system('gem install overcommit')
30+
Gem.clear_paths # Reset load paths so newly installed gem is found
3031
require 'overcommit'
3132
else
3233
puts 'Unable to install Overcommit'

0 commit comments

Comments
 (0)