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

fix: normalise path separators on Windows to fix sub-package tags #165

Merged

Conversation

doug-fitzmaurice-rowden
Copy link
Contributor

@doug-fitzmaurice-rowden doug-fitzmaurice-rowden commented Aug 7, 2024

The git cli and the go os library return representations of the same path using different path separators, so the comparison used here returned false, and the absolute path of the repo was set as the default for the pattern arg.

e.g.:

> git rev-parse --show-toplevel
C:/Users/Doug/Code/myrepo
os.getWd()
C:\\Users\\Doug\\Code\\myrepo

Using filepath.Clean() on both paths before using them normalises the slashes to a single \

Fixes #164

The git cli and the go os library return representations of the
same path using different path separators, so the comparison used here
returned false, and the absolute path of the repo was set as the
default for the pattern arg.

e.g.:
> git rev-parse --show-toplevel
C:/Users/Doug/Code/myrepo
os.getWd()
C:\\Users\\Doug\\Code\\myrepo

Using filepath.Clean() on both paths before using them normalises the
slashes to a single "\"
@caarlos0 caarlos0 merged commit 6862035 into caarlos0:main Aug 7, 2024
1 check passed
@caarlos0
Copy link
Owner

caarlos0 commented Aug 7, 2024

thanks!

caarlos0 added a commit that referenced this pull request Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sub-package tag parsing breaks Windows path parsing in v2.1.0
2 participants