-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: use shallow clones for new git checkouts #13078
Comments
Some users depend on |
+1 for the CL. Maybe add |
A suggestion: some data about the magnitude of the improvement in the size of the downloaded repository could probably help the reviewers. |
It's already the case that "go get" won't always fetch the full history in some cases (subversion), if that precedent matters. I'm also in favor or switching to shallow clones. Personal motivation: Camlistore's Git repo is huge, but mostly because we used to have some huge assets and other libraries in it, since gone. But that means for a user just wanting a few files, they have to download megabytes. People who want history can go into the git directories and run the git commands. Or we can add a new |
+1 for the feature and for @bradfitz's |
I do think it would be worth switching to shallow clones. I don't see much value in adding a flag to the go tool. |
Maybe having an environment variable for the git command (as well as other vcs commands) would do the trick and make it more flexible, if that's the case. Just like git allows customizing the ssh command with the GIT_SSH_COMMAND variable. Probably off-topic, though. |
I think that these requests are outside the remit of go get. We all know go get is just a wrapper around git clone. As time goes on, a few little tweaks have been added to the clone model, and the result is more requests for more tweaks, more flags, etc. This is natural and expected, go get is a simplified wrapper around a more complicated command so it is a logical conclusion that go get itself would have to become complex in turn. Rather than this outcome, I suggest that we document the limitations of go get and recommend to people who need more that they simply skip go get, and use git clone; giving them the full power of the tool for their specific scenario without having to further complicate the simple model that go get provides. |
@davecheney |
For the sake of clarity... Even though, it is not the core job of the go tool, I raised to issue of being able to deep copy because of the canonical URLs. I simply want to be able to run
rather than figuring out what exact repo it is pointing to. But I simply can run |
+1 shallow clone. I just tried to do |
The title is miss leading. |
+1 I agree with what @bradfitz said. |
+1 to |
Just to make it clear: I'm |
I'm also -1 on a new flag. I probably shouldn't have even mentioned it. I'll just make my https://github.com/bradfitz/gitutil/tree/master/git-allgoupdate code unshallow everything it finds in GOPATH instead. I think we're all in agreement that we should go with shallow clones. The difference in size between shallow and deep for some of the repos is quite large. |
I'm thinking that is good to provide flag or environment variable to enable or disable full/shallow because CI server hope to get shallow. |
No flags, no environment variables, none of that complexity or configuration. The go command should do the right thing. People who want something else can type git commands. It sounds like there is general agreement that the right thing is shallow clones. |
@mengzhuo, did you forget to upload it? I don't see it at https://go-review.googlesource.com/#/c/16360/ |
@bradfitz Sorry, I'm new to Gerrit. I had clicked "fix" on Russ's comment and changed into 1. |
This is being reverted in https://go-review.googlesource.com/#/c/16832/ so re-opening this bug. This will need better tests to re-introduce. |
Yes, This is my fault. Light up the darkness 2015-11-12 16:35 GMT+08:00 Brad Fitzpatrick notifications@github.com:
|
Complication: some servers do not support --depth=1. |
It's now too late to do this in Go 1.6. It would need to be reintroduced in a non-freeze time, such as early in Go 1.7. That said, please consider whether doing a shallow clone fetches all the necessary tags for the go command to do its tag-based checkout selection. If a shallow clone does not fetch all the necessary tags, then a separate tag fetch would be needed, and if that's not possible then we can't do shallow clones at all. |
+1 for |
@kokizzu, we don't vote on issues. We all want this. That's not the issue. The issue is how to implement it correctly. |
In case we have GOPATH defined, we probably have the dependencies, than we don't need to download them again. It still works as expected in a box with no GOPATH defined. It's way faster to avoid downloading the dependencies. This is because `go get` is dumb when cloning Git repositories. This should probably change when golang/go#13078 is fixed (Go 1.7, hopefully).
It's not good practice for a library, but we vendored our dependencies in the past because go get github.com/fsouza/go-dockerclient was too slow, but now vendoring is well advised in Go 1.5 and standard in Go 1.6. I'm also dropping Go 1.4 as some standard tools developed by the Go core team already did that. This will make tests on Travis run even faster, but I can hope that golang/go#13078 will eventually get fixed.
It's not good practice for a library, but we vendored our dependencies in the past because go get github.com/fsouza/go-dockerclient was too slow, but now vendoring is well advised in Go 1.5 and standard in Go 1.6. I'm also dropping Go 1.4 as some standard tools developed by the Go core team already did that. This will make tests on Travis run even faster, but I can hope that golang/go#13078 will eventually get fixed.
It's not good practice for a library, but we vendored our dependencies in the past because go get github.com/fsouza/go-dockerclient was too slow, but now vendoring is well advised in Go 1.5 and standard in Go 1.6. I'm also dropping Go 1.4 as some standard tools developed by the Go core team already did that. This will make tests on Travis run even faster, but I can hope that golang/go#13078 will eventually get fixed.
It's not good practice for a library, but we vendored our dependencies in the past because go get github.com/fsouza/go-dockerclient was too slow, but now vendoring is well advised in Go 1.5 and standard in Go 1.6. I'm also dropping Go 1.4 as some standard tools developed by the Go core team already did that. This will make tests on Travis run even faster, but I can hope that golang/go#13078 will eventually get fixed.
Any new developments on this? (no pun intended) |
No new developments. In the long term I think the answer will be that the go command will move to downloading snapshots instead of git repos, and then everything will be "shallow". |
Let's wait another 20 years right until github realizes |
@celesteking afaik, go does shallow clones when using modules, so there's progress x) |
I have already submit a code-review for this at
https://go-review.googlesource.com/#/c/16360/
as @bradfitz asked.
The text was updated successfully, but these errors were encountered: