-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add prefix and suffix to vcs_tag() #15025
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
Conversation
It's already possible to customize the command used to generate the tag string. With that in mind, how useful would you say it is to keep adding kwargs to the meson DSL to fine time the exact processing of said string? |
default: "''" | ||
since: 1.10.0 | ||
description: | | ||
A string prepended before the output of the command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel somehow like I'd prefer this to be mutually exclusive with specifying a custom command to run -- i.e. only support it when using the default VCS detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without specifying a command you can only get git describe
, right? You can't get just the git commit?
That wouldn't work for our use-case, but I don't know what other use-cases there are out there (or not out there yet because not supported).
This is all moot now that you made me realize that I can pass --format
though, so I'm happy with whatever you prefer 👍
prefix = kwargs.get('prefix', '') | ||
suffix = kwargs.get('suffix', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you add prefix
and suffix
to the kwtypes.VcsTag
TypeDict you wong't need to use get
here. :)
It would be nice to have a test for the fallback case to make sure that the prefix and suffix are not added. |
Oh, I hadn't thought of just passing the prefix & suffix in a |
Agreed; I didn't find any test that verifies the output of |
Given that one can format the vcs string through the command, I'm not sure this PR is actually useful anymore? |
There's a bug though (stripping too much, breaks prefix/suffix that start/end with whitespaces), but #15027 fixes that :) |
Closing for now, we can always reopen it if we decide we do want this :) I'd love for the trivial bug fix #15027 to get reviewed and merged though ❤️ |
In Mesa, we want to append either an empty string if building from a release tarball, or the git commit but surrounded by parentheses and with a
git-
prefix.This PR makes this possible, as can be seen in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37337