-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Shallow git clone to target location (and utilize cache as full repo source) #10074
Comments
Since 2.1 we don't ever clone by default anymore, even for dev versions, so I don't think this is super urgent or beneficial as the amount of clones happening is pretty low, and I'd even argue if you do request a clone you most likely will want the full history of the repo to work with it, so it might even be counter productive to optimize this away. |
just ran into this problem, using composer 2.1.14 for example, installing causing issues for our CI (and wastes space locally) as it sums up to 100s of megabytes edit: turns out a |
Closing as I don't see the point as per my comment above. |
I think this should be added to be enabled with an optional parameter. Many packages use dists yes, but for ones that only have a repository as a source it still uses the full git history in both the cache and the target. If using it with a dev environment where you want to edit the packages that's great, but for CI, building containers, or other things like that it's counterproductive to have the entire repository in the target directory. If |
@Seldaek would it be ok with you to reopen this issue? Fo CI purposes, we need shallow clone - we have large dependencies and can access them thru git only. Currently, whole repo needs to be cloned, which is several orders of magnitude slower than shallow clone. |
Sorry but I am not so inclined to bear the cost of maintenance for this edge case, and add even more complexity to GitDownloader (which is already a horrible mess of mostly untested edge cases). I would recommend using Private Packagist or similar to host the private packages in a way that they can be installed as regular packages. It tends to make everything faster and smoother anyway, and should help more than just your CI. |
@Seldaek as others mentioned, this is not only about performance. I'd like to add another example. To send this comment here I did a new clone to check how much it grew since then. Now, only about two months later, the This is one single repo. Size adds up, when you work on and with a lot of stuff. |
@NickSdot and the reason there is a clone is that the packages are defined inline as having only a git source to install. If a dist was defined with the zipball URL from github then this dependency would be downloaded as a zip and all would be well. Again, I don't see the need to bear the cost of maintaining this because others have unreasonable expectations. |
@Seldaek I am the author of this issue and in some scenarios/repos, the size/time different can be even 100 times (realistically, theoretically nearly unlimited). In our usecase, it will reduce about 4 GB download to 40 MB. The improvement will be huge and it will save us also our SSD cells - we currently, sadly need to download/store the whole 4GB in CI daily many times. I would be happy if this issue can be at least kept open, as it should be possible when the dep constraints are like |
@Seldaek can you please keep this issue open. I actually think this is solveable by using git sparse checkout to allow still clone all |
This is a feature request to improve git performace and save disk space with git repos.
Currently, all git cloning is done thru cache. This is perfect and it seems, as discussed in #3449 (and some other related issues), one full git clone is always needed. However the cached repo is 1:1 mirrored to the target install location, which requires twice the space and is time consuming with repos with long history or big removed files.
Example of such repos are:
This is a feature request to always determine the exact sha to clone againt the single local cached copy and then mirror/fetch the exactly sha to the install target location only.
Updating the target shallowly (eg. git fetch) is possible since git 2.5 (2015), ref https://stackoverflow.com/questions/14872486/retrieve-specific-commit-from-a-remote-git-repository/30701724#30701724
The text was updated successfully, but these errors were encountered: