Skip to content

fix windows path handling in blame view#791

Closed
enizor wants to merge 1 commit intogitui-org:masterfrom
enizor:fix-windows-blame
Closed

fix windows path handling in blame view#791
enizor wants to merge 1 commit intogitui-org:masterfrom
enizor:fix-windows-blame

Conversation

@enizor
Copy link
Copy Markdown

@enizor enizor commented Jun 16, 2021

revparse_single uses a git object name and not a file path - that means backslashes must be translated to slashes on windows.
Otherwise the blame view fails:

┌Blame -- src\main.rs -- <no blame available>

I reused the cfg! conditional from git2-rs/src/remote.rs, but there might be a better way to do that.

Resulting blame view on windows:

 Blame -- src\main.rs -- 869e4b7───────────────────────────────────────────────────────────────┐
 │f8f05d6 2020-03-31 Stephan Dilly          0│ #![forbid(unsafe_code)]                         │

@enizor
Copy link
Copy Markdown
Author

enizor commented Jun 16, 2021

The bug probably got introduced by #762 😅 I should have checked more thoroughly

@extrawurst
Copy link
Copy Markdown
Collaborator

we should probably refactor blame_file to take a Path (which automatically handles the separators) as a more sustainable solution

@extrawurst
Copy link
Copy Markdown
Collaborator

@enizor let me know if you need more help to bring this to the finish line. for the time being I mark this PR as draft, let me know when you think its ready

@enizor
Copy link
Copy Markdown
Author

enizor commented Nov 12, 2021

fixed by #984

@enizor enizor deleted the fix-windows-blame branch November 12, 2021 15:08
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.

2 participants