git2-rs icon indicating copy to clipboard operation
git2-rs copied to clipboard

Fix revparsing with windows paths in blame example

Open enizor opened this issue 4 years ago • 0 comments

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

E:\dev\git2-rs>.\target\debug\blame.exe examples\blame.rs
error: the path 'examples\blame.rs' does not exist in the given tree; class=Tree (14); code=NotFound (-3)

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

enizor avatar Jun 16 '21 21:06 enizor