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

Win 10 path missing a slash #122

Closed
Samzyre opened this issue Mar 10, 2021 · 12 comments
Closed

Win 10 path missing a slash #122

Samzyre opened this issue Mar 10, 2021 · 12 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@Samzyre
Copy link
Contributor

Samzyre commented Mar 10, 2021

Describe the bug
Local cargo index git path The error message is missing some backslashes.

To Reproduce
When I have useLocalCargoIndex set to true, I get this error:

**clap: Error: Command failed: git --no-pager --git-dir="C:\Users\Samz.cargo\registry\index\github.com-1ecc6299db9ec823.git" show origin/master:cl/ap/clap fatal: invalid object name 'origin/master'. ** ( Check Reviews )

Expected behavior
The user dir is faultly Samz.cargo and should be Samz\.cargo, and github.com-1ecc6299db9ec823.git should have \.git

Desktop (please complete the following information):

  • OS: Windows
  • Version: 10.0.19042

Additional context
Seems to be the case in 0.5.6 and 0.5.7 (not sure why it worked until 0.5.7 update tho)
Perhaps related to this #116 ?

EDIT: Corrected some details about the issue, also see my comment

@Samzyre
Copy link
Contributor Author

Samzyre commented Mar 10, 2021

Node version v14.16.0 (if it helps)

@Samzyre
Copy link
Contributor Author

Samzyre commented Mar 11, 2021

Setting localCargoIndexBranch to origin/HEAD (like it's in the description) instead of origin/master (default) also solves the error. So maybe that's the actual problem since I read that the error message might have dropped a backslash in markdown.

@char-name
Copy link

I had the same problem and it didn't work after setting local Cargo Index Branch, I solved it by deleting ~/.cargo/registry and regenerating it again

@MeerMusik
Copy link

Same Issue here. Manually deleting the Cargo.Registry Directory solves it for a moment. But as soon as I change cargo.toml everything breaks again: Just re-saving cargo.toml without any changes at all is enough.

System:
Windows 10 20H2, x86_64
Visual Studio Code 1.54.3 (but also already existed in atleast 1.54.2)
Crates Version: 0.5.7

Potential Issue: Crates and the Local Cargo Index do not like each other. I have now DISABLED "Use Local Cargo Index", restarted VS Code a couple times and also recreated the Cargo Registry multiple times. Crates for works now.

BTW: Thanks for this Extension. Nice little helper :)

@serayuzgur
Copy link
Owner

@MeerMusik Thanks. It is just getting more complex for me. Two different group of users have different opinions about / , please help me to fix this issue with a PR. I don't have a windows system and need someone to test it at least 2 version of windows (7, 10 for ex.).

@MeerMusik
Copy link

MeerMusik commented Mar 30, 2021

@MeerMusik Thanks. It is just getting more complex for me. Two different group of users have different opinions about / , please help me to fix this issue with a PR. I don't have a windows system and need someone to test it at least 2 version of windows (7, 10 for ex.).

@serayuzgur Sorry I can not help you with that PR as I am being literally still in the preparation Phase to learn Rust.

But I am willing to test whatever "experimental" Version will be provided in whatever way, on my Windows 10 Machine.
Just annouce it in this Issue as you see fit and I will try it out :)

Good Luck!

@serayuzgur serayuzgur added bug Something isn't working help wanted Extra attention is needed labels Mar 31, 2021
Samzyre added a commit to Samzyre/crates that referenced this issue Mar 31, 2021
serayuzgur pushed a commit that referenced this issue Apr 9, 2021
* Fix hover error message Markdown (#122)

* Reintroduce 'origin/HEAD' as the default index branch (#120, #121)
@mtsr
Copy link

mtsr commented Apr 10, 2021

I'm not sure the problem is anything to do with the path. This works fine:

Welcome to Node.js v15.14.0.
Type ".help" for more information.
> path.resolve(os.homedir(), ".cargo/")
'C:\\Users\\mtsr\\.cargo'

However, no matter what I do, I get

PS C:\Users\mtsr\.cargo\registry\index\github.com-1ecc6299db9ec823> git show origin/master:fu/tu/futures-lite
fatal: invalid object name 'origin/master'.

which makes total sense, because the repository doesn't even specify a remote.

I'm betting it has something to do with the comment at the top of https://github.com/rust-lang/cargo/blob/58a961314437258065e23cb6316dfc121d96fb71/src/cargo/sources/registry/index.rs where it desribes that it reads directly from the raw git objects.

I'm kind of curious why it works on Mac and Linux, though? A quick test shows that the above git command just works on Mac.

Also, did it work on Windows previously and break, or has it simply never worked?

Maybe a more longterm solution could be to move to libgit2 as well, instead of relying on a git executable. It's always going to a bit cat & mouse, because you're pretty much relying on an internal implementation detail of cargo...

@Samzyre
Copy link
Contributor Author

Samzyre commented Apr 10, 2021

@mtsr Yeah it's the error message handling markdown wrong, the error itself seems to come from how git dependencies are indexed by newer versions of cargo (see #126). For the time being I solved by setting localCargoIndexBranch to origin or origin/HEAD, you can also turn local index off for crates altogether.

@mtsr
Copy link

mtsr commented Apr 10, 2021

Ah yeah, #126 does work.

@serayuzgur serayuzgur added this to the 0.5.8 milestone Apr 15, 2021
@serayuzgur
Copy link
Owner

can you please check 0.5.8

@Samzyre
Copy link
Contributor Author

Samzyre commented Apr 19, 2021

I consider this issue closed now since 0.5.9.

@Samzyre Samzyre closed this as completed Apr 19, 2021
@serayuzgur
Copy link
Owner

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants