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

Update notifier: avoid false positives when gh is built from source #2812

Merged
merged 1 commit into from Jan 21, 2021

Conversation

mislav
Copy link
Contributor

@mislav mislav commented Jan 20, 2021

When gh was built from source, the version number will look something like this since it's taken from git describe:

v1.4.0-34-g{SHA}

When compared as semver against v1.4.0, the latter version is falsely reported as newer. This is because the output of git describe wasn't meant to be interpreted as semver.

The solution is to translate the git describe string to faux-semver so it can be safely compared with the version reported from the server.

Fixes this case:

A new release of gh is available: v1.4.0-41-g2f9e4cb1 → v1.4.0
https://github.com/cli/cli/releases/tag/v1.4.0

When gh was built from source, the version number will look something
like this since it's taken from `git describe`:

    v1.4.0-34-g{SHA}

When compared as semver against `v1.4.0`, the latter version is falsely
reported as newer. This is because the output of `git describe` wasn't
meant to be interpreted as semver.

The solution is to translate the `git describe` string to faux-semver so
it can be safely compared with the version reported from the server.

Fixes this case:

    A new release of gh is available: v1.4.0-41-g2f9e4cb1 → v1.4.0
    https://github.com/cli/cli/releases/tag/v1.4.0
Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

Nice catch

@mislav mislav merged commit f1a9da4 into trunk Jan 21, 2021
@mislav mislav deleted the updater-dev-version-match branch January 21, 2021 14:11
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.

None yet

2 participants