Closed milo-trujillo closed 3 years ago
Hi Milo,
Thanks a lot for letting me know and already providing a fix. While I checked for the different existing git versions I had only tested this feature on Linux so far. I will make a new release on PyPi soon.
Cheers, Christoph
git2net version 1.4.8 which includes your fix is now available on PyPi. Thanks again for reporting the issue as well as the solution :)
Git2Net currently crashes on MacOS when mining any cloned repository. This one-line patch fixes that.
Until now, if a user attempts to mine any git repo on MacOS:
This is because git2net determines the git client version using the following two lines:
https://github.com/gotec/git2net/blob/917eb7b1992d63a58581bf80958d68f115e6d56c/git2net/extraction.py#L1429-L1431
This works on Linux where the version string looks like:
But fails on MacOS, where the git version string looks like:
Since you're using regular expressions already, splitting the version string on spaces and applying a regex to just the "2.17.1" portion is unnecessary - we can apply the regex to the entire version string, and extract the first x.y.z version number regardless of position.
With this change, version detection works on both Linux and MacOS.