intuit/auto

Git-tag does not use latest tag when multiple tags on same commit

Opened this issue · 0 comments

Describe the bug

When creating a release with auto shipit and using the git-tag plugin, if there are multiple tags associated with the latest release, then the oldest one of those is used.

To Reproduce

I made a minimal repo showing the issue. This repo has one commit, and a release created from that commit. There are two tags on that commit, tags v1.0.0 and v2.0.0 of which v2.0.0 is newer. The release is tagged v2.0.0.

git  clone https://github.com/asikeero/auto-tag-bug.git
cd auto-tag-bug
auto shipit --dry-run

Output, note the Would have published line:

✔  success   Calculated version bump: patch
ℹ  info      Potential Changelog Addition:

ℹ  info      Would have published: v1.0.1
ℹ  info      Current "Latest Release" on Github: v2.0.0
ℹ  info      Using release notes:

ℹ  info      Would have created a release on GitHub for version: 2.0.1
●  note      The above version would only get released if ran with "shipit" or a custom script that bumps the version using the "version" command

Expected behavior

I would expect the latest tag to be used when calculating the version bump. Auto uses the latest release, but when fetching tags on that release, it selects the first (or oldest) one if there are multiple. Another solution might be that auto would be able to use the tag which is associated with the latest release.

I believe the problem is this line which fetches the latest tag with

git describe --tags --abbrev=0

This will return the oldest tag on a commit, and not the latest.

Environment information:
I am running auto 11.0.4 installed as a binary on MacOS.