Merge pull request #2723 from MikeMcQuaid/missing-formula-shallow-clones

missing_formula: note on shallow clones.
This commit is contained in:
Mike McQuaid 2017-06-03 10:20:38 +01:00 committed by GitHub
commit 1e33120a22

View File

@ -126,10 +126,17 @@ module Homebrew
relative_path = path.relative_path_from tap.path relative_path = path.relative_path_from tap.path
tap.path.cd do tap.path.cd do
ohai "Searching for a previously deleted formula..." unless silent unless silent
ohai "Searching for a previously deleted formula..."
if (tap.path/".git/shallow").exist?
opoo <<-EOS.undent
#{tap} is shallow clone. To get complete history run:
git -C "$(brew --repo #{tap})" fetch --unshallow
EOS
end
end
# We know this may return incomplete results for shallow clones but
# we don't want to nag everyone with a shallow clone to unshallow it.
log_command = "git log --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}" log_command = "git log --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}"
hash, short_hash, *commit_message, relative_path = hash, short_hash, *commit_message, relative_path =
Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp) Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp)