-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
feat(git_utils): Allow configurable shallow clone depth in git_cmd_clone #640
base: develop
Are you sure you want to change the base?
Conversation
Merge develop into master
Merge develop into master
Merge develop into master (v6.0.0-alpha.4)
Merge develop into master (v6.0.0-alpha.5)
Merge develop into master (Release v6.0.0-alpha.8)
Merge develop into master (Release v6.0.0-alpha.9)
Merge develop into master (Release v6.0.0-alpha.10)
Merge develop into master (Release v6.0.0-alpha.11)
Merge develop into master (Release v6.0.0-alpha.12)
Merge develop into master (Release v6.0.0-alpha.13)
…ptions Signed-off-by: Aleksei Sviridkin <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
Thank you for the PR and for that detailed description. I think this is a good idea and as you can see this is a feature that was requested for a long time. Though, im currently not sure if there will be a significant downside if we make depth 1 the default. One thought i had was, if we should show the user a dialog if he want's to do a shallow clone or not, with a user friendly and not too technical description about what that means and when it would be usefull to do that. |
…-branch parameters Signed-off-by: Aleksei Sviridkin <[email protected]>
A little update for a function. Now you can use it anywhere without any behavior changes and set the depth and branch options where it's already safe. Also, fully documented in code. P.S. I was so frustrated with the full clone that I didn’t check any issues and just submitted this PR to your repository. I’m glad to see I’m not the only one and that the issue has already been opened. |
Hi, so i had a talk with the Moonraker maintainer. We shouldn't use shallow clones at all. The general recommendation was to use a blobless clone instead which would reduce download size and be faster than a regular clone. Also, it was said that there should be no general issue with using the blobless clone by default, so that could become the new default way of cloning. Moonraker itself uses blobless clones with the update managers "hard reset" functionality. https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone (see "Quick Summary") |
This PR enhances the git_cmd_clone function in git_utils.py by adding a new optional parameter depth (default value: 1). This allows users to customize the depth of the shallow clone, enabling faster cloning and reduced data transfer. The default behavior remains unchanged, ensuring backward compatibility.
Changes:
• Updated the function signature of git_cmd_clone to include depth: int = 1.
• Modified the git clone command to use the provided depth value with the --depth flag.
• Retained the --single-branch option for cloning only the default branch.
Rationale:
Introducing a configurable clone depth provides flexibility for users who may need to fetch more or fewer commits based on their specific requirements. This optimization can lead to significant speed improvements and reduced network load when working with large repositories or in environments with limited bandwidth.
Testing:
• Verified that cloning with the default depth (1) functions correctly.
• Confirmed that specifying different depth values works as expected.
Additional Context:
This change aims to improve performance and user control during repository cloning without disrupting existing workflows.