diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-02-22 10:05:09 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-02-22 10:23:05 +0900 |
commit | ac5a949c2a973d2f715bc38dd30f8a2539e64c29 (patch) | |
tree | e5d45dec52368b9453477a518b83edb73835be6d /tool/lib | |
parent | 015bf5c461bbd2702e426e87bbea202358d5b2ba (diff) | |
download | ruby-ac5a949c2a973d2f715bc38dd30f8a2539e64c29.tar.gz |
Refine exception messages when git failed
Diffstat (limited to 'tool/lib')
-rw-r--r-- | tool/lib/bundled_gem.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb index 7fdaaf816f..a92c56d7e0 100644 --- a/tool/lib/bundled_gem.rb +++ b/tool/lib/bundled_gem.rb @@ -87,13 +87,16 @@ module BundledGem end def checkout(gemdir, repo, rev, git: $git) - return unless rev + return unless rev or !git or git.empty? unless File.exist?("#{gemdir}/.git") puts "Cloning #{repo}" - system("#{git} clone #{repo} #{gemdir}") or raise + command = "#{git} clone #{repo} #{gemdir}" + system(command) or raise "failed: #{command}" end puts "Update #{File.basename(gemdir)} to #{rev}" - system("#{git} fetch origin #{rev}", chdir: gemdir) - system("#{git} checkout --detach #{rev}", chdir: gemdir) + command = "#{git} fetch origin #{rev}" + system(command, chdir: gemdir) or raise "failed: #{command}" + command = "#{git} checkout --detach #{rev}" + system(command, chdir: gemdir) or raise "failed: #{command}" end end |