Set initial_version to nil when git describe fails.

This commit is contained in:
Markus Reiter 2018-08-10 22:48:12 +02:00
parent 5198ad4277
commit 211e8538ec
2 changed files with 8 additions and 6 deletions

View File

@ -59,7 +59,7 @@ HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbr
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
if [[ -z "$HOMEBREW_VERSION" ]]
then
HOMEBREW_VERSION=">=1.4.0 (shallow or no git repository)"
HOMEBREW_VERSION=">=1.7.1 (shallow or no git repository)"
HOMEBREW_USER_AGENT_VERSION="1.X.Y"
fi

View File

@ -62,10 +62,12 @@ module Homebrew
updated = true
end
initial_version = Version.new(system_command!("git",
args: ["describe", "--tags", "--abbrev=0", initial_revision],
chdir: HOMEBREW_REPOSITORY,
print_stderr: false).stdout)
out, _, status = system_command("git",
args: ["describe", "--tags", "--abbrev=0", initial_revision],
chdir: HOMEBREW_REPOSITORY,
print_stderr: false)
initial_version = Version.new(out) if status.success?
updated_taps = []
Tap.each do |tap|
@ -186,7 +188,7 @@ module Homebrew
end
def migrate_cache_entries_to_double_dashes(initial_version)
return if initial_version > "1.7.1"
return if initial_version && initial_version > "1.7.1"
return if ENV.key?("HOMEBREW_DISABLE_LOAD_FORMULA")