codacy / git-version

Git versioning used in Codacy
Apache License 2.0
135 stars 43 forks source link

[CY-4189] Adds new tags even when the commit is already tagged properly #51

Closed nazarewk closed 3 years ago

nazarewk commented 3 years ago

This script tags the same commit multiple times, I am pretty sure this is not the desired behavior in common case. For example this fails:

version="$(git-version)"
git tag "${version}"
version2="$(git-version)"
test "${version}" = "${version2}"

Could you make it an opt-in?

github-actions[bot] commented 3 years ago

Internal ticket created : CY-4189

franciscodua commented 3 years ago

Hi @nazarewk

I'm not sure if I understood this correctly. Can you explain your use case and what is the behavior you expected from the tool?

Currently, it either gives you a new version that you can use to create a new tag, or it can give you the previous version if you pass the flag --previous-version. Maybe this is the opt-in that you mentioned. But if it isn't let us know

nazarewk commented 3 years ago

I mean as in I would not expect the new version to be configured for the same commit as the previous one. In my opinion it would be a good default to return a previous version when the distance is 0, but at least I would expect a flag allowing this functionality

franciscodua commented 3 years ago

The idea makes sense. Thank you for the feedback. But we won't be able to tackle this in the near future. If you want to contribute with a PR for this repository we would appreciate it. Just keep in mind that it shouldn't be a breaking change, e.g., using the flag you mentioned.

franciscodua commented 3 years ago

I'm closing this issue. Feel free to reopen it if you have further questions