Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64844

Add Partial Clone ability to Git plugin

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • git-plugin
    • 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
      

            Unassigned Unassigned
            amolago Chris Lake
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: