Merge pull request #7354 from vidusheeamoli/brew-extract-warning

dev-cmd/extract: instruct users to run git fetch unshallow
This commit is contained in:
Mike McQuaid 2020-04-14 14:03:22 +01:00 committed by GitHub
commit 86ee3b5744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,7 +132,15 @@ module Homebrew
loop do
rev = rev.nil? ? "HEAD" : "#{rev}~1"
rev, (path,) = Git.last_revision_commit_of_files(repo, pattern, before_commit: rev)
odie "Could not find #{name}! The formula or version may not have existed." if rev.nil?
if rev.nil? && source_tap.shallow?
odie <<~EOS
Could not find #{name} but #{source_tap} is a shallow clone!
Try again after running:
git -C "#{source_tap.path}" fetch --unshallow
EOS
elsif rev.nil?
odie "Could not find #{name}! The formula or version may not have existed."
end
file = repo/path
result = Git.last_revision_of_file(repo, file, before_commit: rev)