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

Git plugin fetches all branches before fetching the specified refspec

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • Jenkins 1.609.1, Git plugin 2.4.0, Git Client plugin 1.18.0, Centos 6

      We have a project in several branches where just one branch is needed to build at a time. Some other branches contain a lot of unneeded data. The correct refspec is specified in the job's configuration. But when the job is run, Jenkins first downloads all the refs:
      > /usr/bin/git -c core.askpass=true fetch --tags --progress **url here** +refs/heads/:refs/remotes/origin/ # timeout=30
      Only then, after adding the remote and other operations, it uses the specified ref:
      > /usr/bin/git -c core.askpass=true fetch --tags --progress **url here** +refs/heads/master:refs/remotes/origin/master # timeout=30
      This leads to a big waste of time, as lots of data is actually downloaded but not used at all.

          [JENKINS-31393] Git plugin fetches all branches before fetching the specified refspec

          Mark Waite added a comment -

          Fixed in git plugin 2.5.1

          Mark Waite added a comment - Fixed in git plugin 2.5.1

          Mark Waite added a comment - - edited

          The git plugin intentionally fetches all refspecs on initial clone, unless "Advanced clone behaviours" is enabled and sets "Honor refspec on initial clone". The use case described in JENKINS-36507 (and others like it) required that the plugin retain its default behavior of always fetching all refspecs on initial clone.

          Mark Waite added a comment - - edited The git plugin intentionally fetches all refspecs on initial clone, unless "Advanced clone behaviours" is enabled and sets "Honor refspec on initial clone". The use case described in JENKINS-36507 (and others like it) required that the plugin retain its default behavior of always fetching all refspecs on initial clone.

            Unassigned Unassigned
            sacchettom Marco Sacchetto
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: