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

Initial tag hard coded to 0.1.0, even when it doesn't match tag_pattern #1066

Open
1 task done
muja opened this issue Feb 28, 2025 · 3 comments · May be fixed by #1070
Open
1 task done

Initial tag hard coded to 0.1.0, even when it doesn't match tag_pattern #1066

muja opened this issue Feb 28, 2025 · 3 comments · May be fixed by #1070
Assignees
Labels
bug Something isn't working

Comments

@muja
Copy link

muja commented Feb 28, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When running git cliff --bumped-version with a tag pattern configured and no matching tags, it will just happily create the hard-coded 0.1.0 tag without validating it against the regex.

Steps To Reproduce

cd $(mktemp -d)
git init .
git commit --allow-empty -m 'chore: initial commit'
git cliff --bumped-version --tag-pattern='foo-[0-9]+\.[0-9]+\.[0-9]+' ## success, prints "0.1.0"

Expected behavior

git cliff creates a tag that passes the regex. Since that is not really trivial and probably not very practical, it should at least refuse to print anything and exit with an error code instead.

Screenshots / Logs

No response

Software information

  • Operating system: n/a
  • Rust version: n/a
  • Project version: 2.8.0

Additional context

I am aware of the initial_tag option. However, it is actually infeasible for us to set this in the cliff.toml as we have one for the whole team. It would be great if this option was available as an ENV or a CLI param.

@muja muja added the bug Something isn't working label Feb 28, 2025
@orhun orhun linked a pull request Mar 2, 2025 that will close this issue
12 tasks
@orhun
Copy link
Owner

orhun commented Mar 2, 2025

Hey, thanks for reporting 👋🏼

This should be fixed in #1070

I am aware of the initial_tag option. However, it is actually infeasible for us to set this in the cliff.toml as we have one for the whole team. It would be great if this option was available as an ENV or a CLI param.

This is not a very commonly used configuration option, you'd probably only need it once while creating the initial version. But I can implement it if you need it. Just let me know and shoot me another issue :)

@muja
Copy link
Author

muja commented Mar 2, 2025

Well when onboarding other teams to the tool / process (which mandates a tag-prefix for monorepos) this is a common scenario and it's an obstacle to have to tell them "you have to create an initial tag per subcomponent first"

@orhun
Copy link
Owner

orhun commented Mar 5, 2025

Yeah, I see the inconvenience... I just tested this again and realized --bumped-version and --tag could be used together. Also, it yields the value of --tag when there isn't any tag exist yet. Is that an useful behavior for your case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants