nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Incompatible with upcoming bare Cargo registry #32

Closed ishitatsuyuki closed 7 years ago

ishitatsuyuki commented 7 years ago

rust-lang/cargo#4026 introduced local registry without checkout, and this tool doesn't work since it relies on registry directory structure.

The old format isn't compatible with the new format at all, so choose one:

nabijaczleweli commented 7 years ago

Hmmm, I guess we could basically do the same thing as we do now but through the git2 layer rather than raw FS.

4026 landed in nightly 5 days ago, so it'll land in stable like 4 weeks from that, or does cargo release on a different cycle than rustc?

ishitatsuyuki commented 7 years ago

It should land as 0.20.0, so 1 or 2 months. I think keeping the code in master until it hits stable is a good idea.

nabijaczleweli commented 7 years ago

Eh, the difference between non-bare and bare is only the location of the repo itself (and IIRC git2 is smart enough to follow .git), so one can implement git2-based searching w/o breaking the current cargo.

pravic commented 7 years ago

nabijaczleweli closed this in 1ec0f2f 32 minutes ago

Doesn't work though:

cargo install-update -al
    Updating registry `https://github.com/rust-lang/crates.io-index`

Failed read master branch of registry repositry at
 $CARGO_HOME/registry/index/github.com-1ecc6299db9ec823.
nabijaczleweli commented 7 years ago

Can you check that that directory is actually a git repository? It works for me, but

pravic commented 7 years ago
>ls $CARGO_HOME/registry/index/github.com-1ecc6299db9ec823
config  description  FETCH_HEAD  HEAD  hooks  info  objects  refs
nabijaczleweli commented 7 years ago

Interesting, a manually-cloned bare repo works for me. Try replacing master with HEAD at main.rs#L57, maybe? Otherwise printing that error would work as well 🤔

pravic commented 7 years ago

error: Error { code: -3, klass: 4, message: "Revspec \'HEAD\' not found." }.

nabijaczleweli commented 7 years ago

And it's the same with master, I presume?

pravic commented 7 years ago

Yep

nabijaczleweli commented 7 years ago

That's definitely interesting, but I can't see how I can do anything else than read master or HEAD (but probably `master)?

pravic commented 7 years ago

https://libgit2.github.com/libgit2/#HEAD/group/revparse https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions

You have to use an origin/master, I guess. Because it isn't a working copy and we have no master branch in it. Works for me.

nabijaczleweli commented 7 years ago

If that's the last thing then I'm gonna release it, if y'all have no objections?

pravic commented 7 years ago

I don't know. It seems, it works on nightly now, so I have no objections. Have you checked on stable Rust?

nabijaczleweli commented 7 years ago

I only use stable so yes.

nabijaczleweli commented 7 years ago

Released in v1.0.0

durka commented 6 years ago

I'm seeing this issue in v1.3.1.

durska:piston-image alex$ rustc -vV
rustc 1.22.0-beta.3 (cc6ed0640 2017-11-13)
binary: rustc
commit-hash: cc6ed0640fbcd2dff95b4532fd12aa0d6c545f28
commit-date: 2017-11-13
host: x86_64-apple-darwin
release: 1.22.0-beta.3
LLVM version: 4.0
durska:piston-image alex$ cargo -vV
cargo 0.23.0-beta (cee38cd30 2017-11-12)
release: 0.23.0
commit-hash: cee38cd30d16b343b13721ec813dc89eb1c1642d
commit-date: 2017-11-12
durska:piston-image alex$ cargo install-update -V
cargo-install-update 1.3.1
durska:piston-image alex$ cargo install-update -al
    Updating registry `https://github.com/rust-lang/crates.io-index`

Failed read master branch of registry repositry at /Users/alex/.cargo/registry/index/github.com-88ac128001ac3a9a.
durska:piston-image alex$ ls -al /Users/alex/.cargo/registry/index/github.com-88ac128001ac3a9a
total 0
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 .
drwxr-xr-x  4 alex  staff  136 Sep 20 00:15 ..
drwxr-xr-x  9 alex  staff  306 Oct 17 12:38 .git
durska:piston-image alex$ ls -al /Users/alex/.cargo/registry/index/github.com-88ac128001ac3a9a/.git
total 24
drwxr-xr-x  9 alex  staff  306 Oct 17 12:38 .
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 ..
-rw-r--r--  1 alex  staff   23 Sep 20 00:15 HEAD
-rw-r--r--  1 alex  staff  144 Sep 20 00:15 config
-rw-r--r--  1 alex  staff   73 Sep 20 00:15 description
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 hooks
drwxr-xr-x  3 alex  staff  102 Sep 20 00:15 info
drwxr-xr-x  4 alex  staff  136 Sep 20 00:15 objects
drwxr-xr-x  4 alex  staff  136 Sep 20 00:15 refs
durka commented 6 years ago

The refs/heads directory is empty. This could be a problem.

durka commented 6 years ago

The problem seems to be that it's reading the wrong index. github.com-88ac128001ac3a9a has a later modified date on the directory, but github.com-1ecc6299db9ec823 has newer files in it.