rust-analyzer / rust-analyzer.github.io

https://rust-analyzer.github.io/
87 stars 51 forks source link

Improve git clone command in manual #184

Closed createyourpersonalaccount closed 2 years ago

createyourpersonalaccount commented 2 years ago

By adding --depth 1, the command only downloads the latest commit snapshot, thereby saving bandwidth and completing faster.

Since the repository is cloned for the purpose of building and installing, it is not important to have the commit history.

lnicola commented 2 years ago

I'm not sure this is worth it. Our repository should be pretty small (5-10 MB or so?), and I think shallow clones can be problematic in some cases like doing git pull on one of them (at some point you will want to update, right?).

Finally, this is the wrong repository, the manual is kept next to the source code.

createyourpersonalaccount commented 2 years ago

@lnicola

I think pulling works...

Is this the wrong repository for https://rust-analyzer.github.io/manual.html ?

createyourpersonalaccount commented 2 years ago

Hmm, the other open PR, #168 is mentioning https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/manual.adoc as the correct repository. it's not the link in the website at the bottom though, so that was a bit confusing. Separate question: do you think the bottom link in https://rust-analyzer.github.io/manual.html should link to https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/manual.adoc ?

lnicola commented 2 years ago

See https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/:

These clones truncate the commit history to reduce the clone size. This creates some unexpected behavior issues, limiting which Git commands are possible. These clones also put undue stress on later fetches, so they are strongly discouraged for developer use. They are helpful for some build environments where the repository will be deleted after a single build.

Is this the wrong repository

Yes, there's a comment on that theme at the top, any idea on how to make it more visible?

lnicola commented 2 years ago

Maybe it should, but not on the blog and changelog posts. I think it's the same footer on every page.

createyourpersonalaccount commented 2 years ago

@lnicola

Okay, you are right. Actually pulling into a shallow copy seems to not work; you need to complete the history first or re-clone.

The stress is put server-side and probably github can deal with it.

But also there are no instructions to pull or update the rust-analyzer on the manual page. But I concede, it is not a good idea, anyone who cares for --depth 1 can probably put the command themselves.

createyourpersonalaccount commented 2 years ago

Maybe it should, but not on the blog and changelog posts. I think it's the same footer on every page.

Yes I agree. It can maybe be overridden for single pages, but not sure.

lnicola commented 2 years ago

I think pull actually works for me (it appears to do nothing when there are no new commits).

The stress is put server-side and probably github can deal with it.

No, we should play nicely. If everyone said "GitHub can deal with my shallow clone", that would be pretty awful.

But It seems we've grown to 64 MB, I wonder if there's anything we could get rid of in there.

lnicola commented 2 years ago

Yeah, it seems our largest objects are an unsquashed GraphQL schema and a lot of package-lock.json copies. I'd expect git clone --single-branch to make a difference here (the docs are larger than the source code), but it doesn't appear to.