Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify locally installed Git version is >=2.11 #349

Merged
merged 2 commits into from
Feb 21, 2019
Merged

Verify locally installed Git version is >=2.11 #349

merged 2 commits into from
Feb 21, 2019

Conversation

itaisteinherz
Copy link
Collaborator

This fixes #348.

@sindresorhus sindresorhus merged commit 6df47b9 into sindresorhus:master Feb 21, 2019
@itaisteinherz itaisteinherz deleted the verify-git-version branch February 21, 2019 05:28
};

exports.verifyRecentGitVersion = async () => {
if (semver.lt(await gitVersion(), '2.11.0')) {
Copy link
Collaborator Author

@itaisteinherz itaisteinherz Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that this could be moved to a separate method in version.js named isVersionLower, along with isVersionGreater. Doing so would keep this file (almost) entirely focused on git-related methods.
Also, we're currently not checking if the output returned by gitVersion is actually a version, which could lead to some issues in future versions of git.

@sindresorhus Thoughts?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isVersionLower, along with isVersionGreater.

We don't really need both of these though. How about just one called isVersionGreaterThanOrEqualTo()? That's a mouthful though... Alternatively, isMinimumVersion() / isAtLeastVersion().

Also, we're currently not checking if the output returned by gitVersion is actually a version, which could lead to some issues in future versions of git.

We should definitely do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need both of these though. How about just one called isVersionGreaterThanOrEqualTo()? That's a mouthful though... Alternatively, isMinimumVersion() / isAtLeastVersion().

In ui.js and prerequisite-tasks.js we're using !isVersionGreater(), which is the same as isVersionLowerThanOrEqualTo(). This requires us to have a way to check if v1 >= v2 as well as if v1 <= v2, which means we'll need to have at least 2 methods.

To solve this, we could keep isVersionGreater() and add another method for checking version equality isVersionEqualTo() (which is more readable in my opinion).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Then we should also rename isVersionGreater() => isVersionGreaterThan() for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify locally installed Git version is >=2.11
2 participants