Skip to content

Commit

Permalink
[rubygems/rubygems] [rebuild_command] Add --diff flag to try using di…
Browse files Browse the repository at this point in the history
  • Loading branch information
duckinator authored and matzbot committed Mar 29, 2024
1 parent cd12dfd commit a28087a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/rubygems/commands/rebuild_command.rb
Expand Up @@ -11,6 +11,10 @@ class Gem::Commands::RebuildCommand < Gem::Command
def initialize
super "rebuild", "Attempt to reproduce a build of a gem."

add_option "--diff", "If the files don't match, compare them using diffoscope." do |_value, options|
options[:diff] = true
end

add_option "--force", "Skip validation of the spec." do |_value, options|
options[:force] = true
end
Expand Down Expand Up @@ -150,6 +154,14 @@ def compare(source_date_epoch, old_file, new_file)
say "SUCCESS - original and rebuild hashes matched"
else
say "FAILURE - original and rebuild hashes did not match"

if options[:diff]
say
if system("diffoscope", old_file, new_file).nil?
alert_error "error: could not find `diffoscope` executable"
end
end

terminate_interaction 1
end
end
Expand Down

0 comments on commit a28087a

Please sign in to comment.