8000 FIX: Escape asterisk for Windows only when tag_prefix is empty by effigies · Pull Request #274 · python-versioneer/python-versioneer · GitHub
[go: up one dir, main page]

Skip to content

FIX: Escape asterisk for Windows only when tag_prefix is empty 8000 #274

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

Closed
wants to merge 5 commits into from

Conversation

effigies
Copy link
Contributor

Fixes #273.

@DancingQuanta @mhkline @jenshnielsen Can you test to ensure this covers both uses cases? Unfortunately we haven't gotten CI tests working on Windows, so I can't test, myself.

@mhkline
Copy link
mhkline commented Oct 22, 2021

Both use cases? I just stumbled here because I was trying to build a package (castxml) that used versioneer. It contains a copy of versioneer.py in its repo, and I just modified it in-place (the horror).

FWIW, I'm building on Windows with MSYS2 (MinGW64).

@jenshnielsen
Copy link

@effigies Thanks I can confirm that your fix works for the usecase of having a pattern that starts with a char. In our case v gets correctly turned into v* and the version is reported correctly.

@jenshnielsen
Copy link

However for a different repo that uses non prefixed tags this does not work. As in
git describe --tags --dirty --always --long --match \* does not match any tags for me.
but ``` git describe --tags --dirty --always --long --match *`` works for me as expected.

It seems to me that a simpler solution would be to omit the whole match clause if the tag_prefix is empty

@jenshnielsen
Copy link

Digging a bit more the issue is not around if the string starts with or contains a * but which shell you are using.

In cmd and powershell * should not be escaped but in Git bash it should be regardless of the position

@effigies
Copy link
Contributor Author

@jenshnielsen Thanks for the analysis. Can we reliably select which condition we're in with git.cmd and git.exe? We try one and then the other. So the fix could be to try one form (sounds like unescaped) with git.cmd and the other with git.exe.

@effigies
Copy link
Contributor Author

Pushed a guess as to what might resolve this.

@jenshnielsen
Copy link

I tried testing out this branch but it looks like something has good wrong with the return code handling. With this branch this call that used to work fine _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True) now returns None as an error code and prevents git describe from being called at all

@hwjohn
Copy link
hwjohn commented Dec 30, 2021

If the tag_prefix is an empty string, I think you could just omit the --match argument altogether. This would avoid having to guess whether to escape the asterisk or not.

@effigies
Copy link
Contributor Author

Closing in favor of #283.

@effigies effigies closed this Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag prefix broken on Windows with versioneer 0.21
4 participants
0