diff --git a/Library/Homebrew/dev-cmd/extract.rb b/Library/Homebrew/dev-cmd/extract.rb index 0a4e60a5fe..f1f2a6ff48 100644 --- a/Library/Homebrew/dev-cmd/extract.rb +++ b/Library/Homebrew/dev-cmd/extract.rb @@ -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)