-
Improvement
-
Resolution: Won't Do
-
Minor
-
None
-
Jenkins LTS v2.263.3
Git plugin 4.5.2
Git 2.26.2
We have a large Git repository (recently converted from SVN), and many builds so keeping what's cloned/checked out a small as we can is a priority.
Although the Git plugin offers a shallow clone ('CloneOption', shallow: true, depth: 1), we get no change log (JENKINS-45586).
I believe offering the partial cloning via the Git --filter=blob:none (and I guess for completeness, 'blob:limit_=_<n>' and 'tree:<depth>'), would be a better option as it keeps the .git folder small and only gets the blobs required for the build.
Just to show testing on my repo went as follows:
git fetch --no-tags https://server/repo.git +refs/heads/foo:refs/remotes/origin/foo git checkout foo .git folder = 12.2 GiB repo folder = 19.75 GiB
git fetch --no-tags --depth=1 https://server/repo.git +refs/heads/foo:refs/remotes/origin/foo git checkout foo .git folder = 2.82 GiB repo folder = 9.37 GiB NO HISTORY
git fetch --no-tags --filter=blob:none https://server/repo.git +refs/heads/foo:refs/remotes/origin/foo git checkout foo .git folder = 2.9 GiB repo folder = 9.45 GiB FULL HISTORY for the foo branch
I did try to workaround the lack of this feature manually configuring the Git repo for partial clone prior to using the Jenkins Checkout GitSCM, but immediately run in to the error:
git config remote.https://server/repo.git.promisor true git config remote.https://server/repo.git.partialclonefilter blob:none ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://server/repo.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909) at ... Caused by: hudson.plugins.git.GitException: Command "C:\git-2.26.2\bin\git.exe fetch --no-tags --force --progress -- https://server/repo.git +refs/heads/foo:refs/remotes/origin/foo" returned status code 1: error: https://server/repo.git did not send all necessary objects
- is duplicated by
-
JENKINS-70094 Support blobless clone
-
- Open
-
I don't plan to implement a git plugin configuration that would support the --filter option.
JENKINS-28335 proposes to provide a Pipeline wrapper method that will allow users to use command line git with whatever commands they prefer. A proposal with more details has been submitted as a Google Summer of Code 2021 project idea. Workarounds until that is available include embedding the credentials into the https URL or using a withCredentials step to provide the ssh private key so that command line git can be used with the command line arguments you prefer.
The --filter argument appears to only be available with git clone, not with git fetch, and seems to only have been added to git 2.27 and later. The git plugin needs to support command line git versions on common Linux operating systems. Command line git 2.27 is newer than the command line git provided with most Linux operating systems.