Skip to content

Enable lenient parsing of Git version tags#3649

Merged
abertelrud merged 1 commit into
swiftlang:mainfrom
colincornaby:lenient-git-tag-parsing
Aug 9, 2021
Merged

Enable lenient parsing of Git version tags#3649
abertelrud merged 1 commit into
swiftlang:mainfrom
colincornaby:lenient-git-tag-parsing

Conversation

@colincornaby

Copy link
Copy Markdown
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

tomerd commented Aug 6, 2021

Copy link
Copy Markdown
Contributor

@swift-ci please smoke test

@abertelrud

Copy link
Copy Markdown
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
Copy Markdown
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!

Comment thread CHANGELOG.md Outdated
- 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.
@colincornaby colincornaby force-pushed the lenient-git-tag-parsing branch from 841d40a to aada8a7 Compare August 9, 2021 02:47
@tomerd

tomerd commented Aug 9, 2021

Copy link
Copy Markdown
Contributor

@swift-ci please smoke test

@abertelrud

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Thanks everyone!

@tomerd

tomerd commented Aug 9, 2021

Copy link
Copy Markdown
Contributor

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