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

Pick the higher version if there are multiple on the current commit #162

Merged
merged 1 commit into from
Sep 13, 2018

Commits on Sep 7, 2018

  1. Pick the higher version if there are multiple on the current commit

    Currently, when there are multiple version tags on the current commit, one is picked semi-randomly. I say `semi` because it's actually deterministic, but it doesn't quite make sense. Anyway, if there are two tags, it typically picks the highest one, unless the last segment has more decimals (e.g. it picks `0.9` over `0.10`, and `0.99` over `0.100`).
    ```
    git tag v0.1
    git tag v0.2
    sbt 'show version' #0.2
    
    git tag v0.9
    git tag v0.10
    sbt 'show version' #0.9
    ```
    Technically you could say "who cares, it's the same commit anyway", but if you then publish the package to the jar repository, you have to pick the right one, and that's the one with the higher version - because the latter one is likely already published and it will fail on the attempt to re-publish.
    
    Note: the [sort algo](https://github.com/mpollmeier/versionsort/blob/master/src/main/java/versionsort/VersionHelper.java) is short enough to copy it (and it's tests) into this repo, if you want to save a dependency. That jar has zero dependencies though (not even scala). I use it for another project and just published it to maven central.
    mpollmeier committed Sep 7, 2018
    Configuration menu
    Copy the full SHA
    a9153c9 View commit details
    Browse the repository at this point in the history