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

refspec is not applied on clone (initial fetch)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • Jenkins Latest and greatest (1.614) / Older but stable (1.596.3)
      git-client 1.17.1 / 1.16.1
      git-plugin 2.3.5 / 2.3.4

      As far as i can see the refspec is not used on the initial clone.
      Here is the relevant extract from a build with a cleaned workspace:

      Cloning the remote Git repository
      Cloning repository gitserver:/data/git/MyProject.git
       > /usr/bin/git init /data/jenkins/workspace/myjob.checkoutrefspec # timeout=10
      Fetching upstream changes from gitserver:/data/git/MyProject.git
       > /usr/bin/git --version # timeout=10
      using GIT_SSH to set credentials Jenkins private key
       > /usr/bin/git fetch --tags --progress gitserver:/data/git/MyProject.git +refs/heads/*:refs/remotes/origin/*
       > /usr/bin/git config remote.origin.url gitserver:/data/git/MyProject.git # timeout=10
       > /usr/bin/git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
       > /usr/bin/git config remote.origin.url gitserver:/data/git/MyProject.git # timeout=10
      

      this is directly followed by

      Fetching upstream changes from gitserver:/data/git/MyProject.git
      using GIT_SSH to set credentials Jenkins private key
       > /usr/bin/git fetch --tags --progress gitserver:/data/git/MyProject.git +refs/heads/development:refs/remotes/origin/development
       > /usr/bin/git rev-parse origin/development^{commit} # timeout=10
      Checking out Revision c5280c05a01a61f2ae43e46a1ee398be27cdc14e (origin/development)
       > /usr/bin/git config core.sparsecheckout # timeout=10
       > /usr/bin/git checkout -f c5280c05a01a61f2ae43e46a1ee398be27cdc14e
      First time build. Skipping changelog.
      

      wich is using the configured refspec. This fetch is used correctly in later builds.

      We have some old and heavy branches (with some binaries) that we do not want to get fetched at any time. As of today this is only possible with sparse checkouts, but they have the drawback that we can not push tags back to remote after the build.

          [JENKINS-28516] refspec is not applied on clone (initial fetch)

          Simon Weber added a comment -

          This is particularly brutal when using "delete repository and force clone" with shallow clones.

          Is anyone planning to tackle this soon?

          Simon Weber added a comment - This is particularly brutal when using "delete repository and force clone" with shallow clones. Is anyone planning to tackle this soon?

          Eugene Timokhov added a comment - Same https://issues.jenkins-ci.org/browse/JENKINS-31393 ?

          Seems to be solved by JENKINS-31393 (and explained in JENKINS-33140), so this bug can be closed.

          Daniel Geißler added a comment - Seems to be solved by  JENKINS-31393 (and explained in JENKINS-33140 ), so this bug can be closed.

          Mark Waite added a comment -

          Fixed in git plugin 2.5.1.

          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 - Fixed in git plugin 2.5.1. 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
            dageissl Daniel Geißler
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: