diff options
author | Nick LaMuro <nicklamuro@gmail.com> | 2016-07-25 17:28:41 -0500 |
---|---|---|
committer | Nick LaMuro <nicklamuro@gmail.com> | 2016-07-25 21:44:01 -0500 |
commit | 1838c66f27b9668e278c7ee6ac7965a445b629cb (patch) | |
tree | b99b7636830216c83926d8bb128de72175252d79 /lib | |
parent | 55cedfaa4b6b2f02ec3ca32af6e259741e24bb01 (diff) | |
download | bundler-1838c66f27b9668e278c7ee6ac7965a445b629cb.tar.gz |
Removes OSX/msysgit strings from git version
When running the original `version` output through
`Gem::Version.create` when the git version is something like
$ git --version
git version 1.2.3 (Apple Git-22)
Ruby blows up with the error:
ArgumentError: Malformed version number string 1.2.3 (Apple Git-22)
The '(Apple Git-22)' and any additions that are added by `msysgit` (ex:
1.8.3.msysgit.0) can be safely ignored as they are additions to the git
version for those specific versions.
This was affecting running tests on OSX and being able to even bundle
with git gem dependencies on OSX (with this version of the gem).
This change simply regexes those rules out, in addition to removing the
`git version`, so only the version number (containing numbers or `.`s)
will be parsed.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index d953cd0a04..feb8d0137b 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -80,7 +80,7 @@ module Bundler end def version - git("--version").sub("git version", "").strip + git("--version").match(/(git version\s*)?((\.?\d+)+).*/)[2] end def checkout |