Git-tag does not use latest tag when multiple tags on same commit
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 221
- PR merge metrics
- No merged PRs in 30d
Description
**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](https://github.com/asikeero/auto-tag-bug) 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](https://github.com/intuit/auto/blob/7a6f0ae37414b9c56ea7db6547873b77c4dfb425/packages/core/src/git.ts#L882) 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.