Skip to content
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

Use treeless clone to 'shallow' clone again. #2022

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mrichar1
Copy link
Contributor

What does this PR do?

The ability to shallow clone (--depth 1) was removed in 9848c33 as shallow clones don't preserve commit history, tags etc, meaning the salt version.py script was failing. However this resulted in much larger and slower cloning.

This PR uses a treeless clone to fetch the latest commit, commit history, tags etc without trees and blobs ('files'), keeping the clone small but allowing version to still work.

What issues does this PR fix or reference?

Previous Behavior

The original 'shallow' clone using git clone --depth 1 --branch master https://github.com/saltstack/salt.git produces a local repo around 92MB in size, but with missing metadata, resulting in incorrect versions:

* INFO: shallow path git cloned master, version 3007.0+0na.221420cd5

The current HEAD with this disabled, using git clone --branch master produces a local repo around 640MB in size, with correct versioning:

* INFO: shallow path (disabled shallow) git cloned master, version 3007.1+443.g221420cd5

New Behavior

This PR uses git clone --filter=tree:0 --branch master reducing the local repo to around 145MB in size, but versioning is still correct:

* INFO: shallow path git cloned master, version 3007.1+443.g221420cd5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants