summaryrefslogtreecommitdiff
path: root/lib/chef/provider/git.rb
diff options
context:
space:
mode:
authorkzwin <kz@example.org>2017-09-02 11:02:39 -0400
committerkzwin <kz@example.org>2017-09-02 11:02:39 -0400
commit70c57c564d0d569e0360be78d421a745ff83811a (patch)
tree66b2ef20ed0359bb9e86503dfca0b5153fb959d6 /lib/chef/provider/git.rb
parent0595c4c975e247ec968f256368e471a516b8a4b0 (diff)
downloadchef-70c57c564d0d569e0360be78d421a745ff83811a.tar.gz
log when git version is unparsable
Signed-off-by: kzwin <kz@example.org>
Diffstat (limited to 'lib/chef/provider/git.rb')
-rw-r--r--lib/chef/provider/git.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index 5b16e98427..4f0ea8170d 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -113,7 +113,13 @@ class Chef
defined?(@git_gem_version) and return @git_gem_version
output = git("--version").stdout
match = GIT_VERSION_PATTERN.match(output)
- @git_gem_version ||= match ? Gem::Version.new(match[1]) : nil
+ if match
+ @git_gem_version = Gem::Version.new(match[1])
+ else
+ Chef::Log.warn "Unable to parse git version from '#{output}'"
+ @git_gem_version = nil
+ end
+ @git_gem_version
end
def existing_git_clone?