Skip to content

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

Merged
caarlos0 merged 1 commit intocaarlos0:mainfrom
doug-fitzmaurice-rowden:windows-path-normalisation
Aug 7, 2024
Merged

fix: normalise path separators on Windows to fix sub-package tags#165
caarlos0 merged 1 commit intocaarlos0:mainfrom
doug-fitzmaurice-rowden:windows-path-normalisation

Conversation

@doug-fitzmaurice-rowden
Copy link
Copy Markdown
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
@caarlos0
Copy link
Copy Markdown
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