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

Enable lenient parsing of Git version tags #3649

Merged
merged 1 commit into from
Aug 9, 2021

Conversation

colincornaby
Copy link
Contributor

Motivation:

While implementing SPM manifests in existing Git repos, I found many were using two component tags where the patch version was 0. The intention behind this change is to better support that Git tagging pattern without retraining existing teams, or causing SPM integration to be disruptive to existing tagging practices.

Modifications:

Lenient parsing was added to swift-tools-support-core at swiftlang/swift-tools-support-core#212. The tag based initializer for Version was altered to use this new lenient initializer.

It’s possible for two tags with the same meaning but different literal strings to be present in the same repository. This case did exist previously. Tags like v2.0.0 and 2.0.0 could conflict, and a decision about which tag to use would be required.

  • Previous behavior was that a tag without a v-prefix would be preferred over one with a v-prefix. This behavior was maintained.
  • A tag with more version components/more specificity is preferred. For example, 2.0.0 will be preferred over 2.0.

Result:

Git tags with two version components will now be supported and parsed as if there was a patch version of .0 appended to the end.

@tomerd
Copy link
Contributor

tomerd commented Aug 6, 2021

@swift-ci please smoke test

@abertelrud
Copy link
Contributor

Thanks, @colincornaby! Would you mind also adding a note to the CHANGELOG.md file, under the Swift v.Next section? Historically we haven't been consistent about updating it when there are user-visible changes, but we are trying to get better about that.

@colincornaby
Copy link
Contributor Author

Thanks, @colincornaby! Would you mind also adding a note to the CHANGELOG.md file, under the Swift v.Next section? Historically we haven't been consistent about updating it when there are user-visible changes, but we are trying to get better about that.

I added a note to the changelog and squashed it into the existing commit. Let me know if you have any feedback or edits!

CHANGELOG.md Outdated Show resolved Hide resolved
- Git version tags will now be parsed leniently, allowing for tags like 2.0 to be treated equivelently to 2.0.0.
- Previous behavior was that a tag without a v-prefix would be preferred over one with a v-prefix. This behavior was maintained.
- A tag with more version components is preferred. 2.0.0 will be preferred over 2.0.

Enable lenient parsing of Git version tags

- Git version tags will now be parsed leniently, allowing for tags like 2.0 to be treated equivelently to 2.0.0.
- Previous behavior was that a tag without a v-prefix would be preferred over one with a v-prefix. This behavior was maintained.
- A tag with more version components is preferred. 2.0.0 will be preferred over 2.0.

Enable lenient parsing of Git version tags

- Git version tags will now be parsed leniently, allowing for tags like 2.0 to be treated equivelently to 2.0.0.
- Previous behavior was that a tag without a v-prefix would be preferred over one with a v-prefix. This behavior was maintained.
- A tag with more version components is preferred. 2.0.0 will be preferred over 2.0.

Enable lenient parsing of Git version tags

- Git version tags will now be parsed leniently, allowing for tags like 2.0 to be treated equivelently to 2.0.0.
- Previous behavior was that a tag without a v-prefix would be preferred over one with a v-prefix. This behavior was maintained.
- A tag with more version components is preferred. 2.0.0 will be preferred over 2.0.
@tomerd
Copy link
Contributor

tomerd commented Aug 9, 2021

@swift-ci please smoke test

@abertelrud
Copy link
Contributor

Thanks, @colincornaby! Would you mind also adding a note to the CHANGELOG.md file, under the Swift v.Next section? Historically we haven't been consistent about updating it when there are user-visible changes, but we are trying to get better about that.

I added a note to the changelog and squashed it into the existing commit. Let me know if you have any feedback or edits!

Thanks; looks great to me!

@abertelrud abertelrud merged commit 0efa53e into swiftlang:main Aug 9, 2021
@colincornaby
Copy link
Contributor Author

Thanks everyone!

@tomerd
Copy link
Contributor

tomerd commented Aug 9, 2021

thank you @colincornaby <3

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.

4 participants