Unverified Commit 04cbea4d authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #7768 from CocoaPods/segiddins/defensive-version-creation

Be defensive when passing potentially nil strings to Gem::Version
parents 815f56bf 462a15d5
...@@ -114,7 +114,9 @@ module Pod ...@@ -114,7 +114,9 @@ module Pod
# #
def self.git_version def self.git_version
raw_version = Executable.capture_command('git', ['--version']).first raw_version = Executable.capture_command('git', ['--version']).first
match = raw_version.scan(/\d+\.\d+\.\d+/).first unless match = raw_version.scan(/\d+\.\d+\.\d+/).first
raise "Failed to extract git version from `git --version` (#{raw_version.inspect})"
end
Gem::Version.new(match) Gem::Version.new(match)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment