diff options
Diffstat (limited to 'lib/rubygems/source/git.rb')
-rw-r--r-- | lib/rubygems/source/git.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb index fb9cbce2fb..35c2270a74 100644 --- a/lib/rubygems/source/git.rb +++ b/lib/rubygems/source/git.rb @@ -178,9 +178,17 @@ class Gem::Source::Git < Gem::Source # Converts the git reference for the repository into a commit hash. def rev_parse # :nodoc: + hash = nil + Dir.chdir repo_cache_dir do - Gem::Util.popen(@git, 'rev-parse', @reference).strip + hash = Gem::Util.popen(@git, 'rev-parse', @reference).strip end + + raise Gem::Exception, + "unable to find reference #{@reference} in #{@repository}" unless + $?.success? + + hash end ## |