-
Notifications
You must be signed in to change notification settings - Fork 91
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
flatpak-builder: allow to shallow clone git repos #6
Comments
Hmm, I can see how this could be useful. But its also somewhat tricky. For the initial pull things are fine, but on an update the depth is stored, so the new pull will drop all local history other than the new head of the branch you pulled. If you're only pulling a repo once this is not really a problem. However, with xdg-app you can have a single download cache shared by multiple json files, or the same json file can refer to the same git repo (either directly or via submodules) which could be problematic if those refered to different branches (or direct commit ids). I wish there was a way to do an initial shallow clone, but then allow further pulls to just get all changes between your current commit and the new HEAD. |
From @hbons on February 29, 2016 13:21 I think recent Git releases fixed this. You can do a shallow clone and then pull whatever else you need later. |
There was some kind of fix, but I don't think it does quite what we want here anyway. |
From @hbons on February 29, 2016 15:35 Shallow clones are the default setting in SparkleShare and it works great, so it might be worth looking into. :) |
From @jcelerier on June 1, 2016 9:47 +1 for shallow clones |
From @albfan on March 11, 2017 10:39 Any little test that can be configured to implement this? Like a flatpak project with a dependency with more than one commit. Doing a shallow copy from dep and commiting another change to it should be enough to test if this will work. I'm trying to install gnome-todo with flatpak and there's a huge repos gnome-online-accounts and evolution-data-server that has no sense to download entirely. Moreover when I have them downloaded to use with jhbuild. is there too an option to reuse existing repo clones? Another problem related is on a unsuccesful build (interrunped) flatpak cannot reuse clone_tmp dir and fails (maybe that can be solved too here or another issue is needed) |
From @albfan on March 11, 2017 10:57 Humm, shallow copies fails telepathy-account-widgets is a submodule of gnome-online-accounts and it seek for a specific commit so after bare clone, depth 1 is not correct Given that I have those repos cloned, is there a way to instruct flatpak to use existing clones (like ~/jhbuild/checkout)? |
Shallow Clone a repo to a specific commit should work, but that's something git needs to provide (or any other VCS) |
Then
is possible Seems seing https://stackoverflow.com/a/19394911/848072 that you can do
Implement that could be a disk space and time saver |
It is possible to make shallow clones of a branch, yes, but what if i want a particular commit. For instance, say the git source in the json manifest has only a git uri + a commit id. This is quite common, because we want reproducible builds (not just latest branch head). Additionally, it is hit every time we mirror git submodules, because submodules are always refered to by commit id, and never by branch name. |
fetch says it can be refspec, so maybe
would work I'm reluctant this will work correctly in all situations, is just I don't know where to start to create a use case and what to modify to test it Feel free to close it |
I don't want to close this because I want this feature, but it just doesn't seem possible:
|
Hmm, in lastest upstream docs they say:
So, maybe it will eventually be possible? |
Adding those config now error changes:
|
The config has to be on the server side. |
When downloading a git repo we try to do a shallow (depth=1) fetch of only the specified target. This normally works fine for branches and tags, but if the commit is a raw SHA1 then it fails, because we can only request refs from the remote. We handle this by doing an ls-remote and seeing if the specified target is either a (possilby partial) ref, or a commit id that a remote ref is pointing at. If it is, we pull that ref only. If not, then we fall back to a full fetch. I believe this is the best we can do to fix flatpak#6
initial implementation on #47 |
From @alexlarsson on May 19, 2016 15:32
From @hbons on February 27, 2016 21:39
Git repos can be huge, and when building you may not be interested in the full history.
Maybe a property in the json file (or even changing the default) to allow shallow cloning would save a lot of time and bandwidth.
Copied from original issue: alexlarsson/xdg-app#112
Copied from original issue: flatpak/flatpak#15
The text was updated successfully, but these errors were encountered: