extract: better success message

Fixes the empty rev string when copying file from HEAD; explicitly
set rev to HEAD in that case.
This commit is contained in:
Caleb Xu 2018-08-25 13:35:08 -04:00
parent d4a2006f04
commit ff2ce2f093

View File

@ -95,6 +95,7 @@ module Homebrew
odie "Could not find #{name}! The formula or version may not have existed." if test_formula.nil? odie "Could not find #{name}! The formula or version may not have existed." if test_formula.nil?
result = Git.last_revision_of_file(repo, file, before_commit: rev) result = Git.last_revision_of_file(repo, file, before_commit: rev)
elsif File.exist?(file) elsif File.exist?(file)
rev = "HEAD"
version = Formulary.factory(file).version version = Formulary.factory(file).version
result = File.read(file) result = File.read(file)
else else
@ -122,7 +123,7 @@ module Homebrew
ohai "Overwriting existing formula at #{path}" if ARGV.debug? ohai "Overwriting existing formula at #{path}" if ARGV.debug?
path.delete path.delete
end end
ohai "Writing formula for #{name} from #{rev} to #{path}" ohai "Writing formula for #{name} from revision #{rev} to #{path}"
path.write result path.write result
end end