-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Discussion: Using shallow git clones #48
Comments
I believe this could be take as far as only grabbing the relevant files from the repository as well, reducing necessary bandwidth further. I have this example lying around:
That only request the files in |
Hi - thanks for the interest in this project. To clone the repo for read - would be one thing, I am not aware you can write back new commits from a shallow clone. Can you? I honestly have no idea, never put much thought into it. If you can then yeah - it's a no brainer really and the only reason it's not that way is simply that never occurred to me that it was possible. Another option would be to create another implementation for the storage layer and talk directly to the APIs, but that would be a different implementation per provider. Out of curiosity - are you using GitHub or something else? |
I LOVE this project! I can't imagine having to use any other backend.
This is where I figured my own knowledge might be lacking. I was literally playing with
Thanks. That's a route I hadn't considered and definitely feels like a good alternative. I'm using GitLab. But, I think much of the API is similar. [citation needed] Thank you for the quick response and the insight! |
They are similar but not exactly the same.. which would mean one implementation per provider to maintain. Authentication is different too. It also comes with another problem - APIs typically rate throttled. But - it would be fast no matter how big the repo is. |
For sure. And even where they agree you can't depend on them to remain aligned.
Also great points. But, I've seen very promising results with shallow clones and being able to push changes upstream. It does get nitty gritty with plumbing commands. Here's a one-liner I put together to test it that changes the contents of the README.md in a repository to have the contents
Basically, it (as a reference for myself and whoever else stumbles across this):
But, then you should be able to push your current branch to the remote. (I bet there's even a way to bypass even updating the local reference and just push the reference directly to the remote, I just don't know it offhand.) This feels promising, and I'd like to dive into it more, but I do have to table this for the next day or so. |
This looks very promising. Thank you! And it wouldn't require a force push at the end and keep the remote branch clean and linear? |
Yup. The only difference from what git normally does, is the file sorting in the tree. I do want to look into that for consistency's sake. |
Ok, I went overboard at first. This is even easier than I expected. You can do that sparse checkout, only change that file, use |
I don't have any hard data, just from experience and looking at the code, it looks like an entire git clone is performed. I imagine it should be sufficient to shallow clones of the various branches one needs to request. And that should provide enough information to generate the commits necessary for locking the repositories. But there could also be a gap here in my understanding of git the tool, the SSH/HTTP APIs, and/or git internals.
My motivation for starting this discussion is that my own state repository has grown to be about 70 MB, and so I really notice slowness during wrapper runs. Other options I've considered are running the backend as a local service, though I really like the CLI wrapper style of usage. I also considered patching the code to cache repositories to disk locally for reuse, but this felt like a potentially more durable and widely useful solution, so I wanted to open this discussion before delving deeper into what that would look like.
I hope this is the right place for this.
The text was updated successfully, but these errors were encountered: