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

Git plug-in fetches all tags even when refspec is provided

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • Windows Server 2008 Master, Jenkins ver. 1.447.2; Linux Jenkins 1.597, Git plugin 2.2.12.

      When a repository is configured to fetch a specific refspec from the upstream repository, all tags are fetched.

      The documentation specifically states that when a refspec is specified, only that refspec will be fetched.

      NOTE: This is not a duplicate of JENKINS-6124. That issue is requesting this to be optional for all cases. This issue is requesting only that the behavior in this specific scenario behave as documented. (i.e. fix the bug)

          [JENKINS-14572] Git plug-in fetches all tags even when refspec is provided

          Code changed in jenkins
          User: rhaendel
          Path:
          src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java
          src/test/java/hudson/plugins/git/extensions/impl/CloneOptionShallowDefaultTagsTest.java
          http://jenkins-ci.org/commit/git-plugin/24fb7f3c441057ad09fc3ce6bbedffff797e92bc
          Log:
          JENKINS-14572 Add a test case for clone option's default 'fetch tags' behaviour

          Even with shallow clones "fetch all tags" is the default. Just added a
          missing test case and found a true/false bug in my previous commit which
          toggled the default to the not backwards compatible value.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: rhaendel Path: src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java src/test/java/hudson/plugins/git/extensions/impl/CloneOptionShallowDefaultTagsTest.java http://jenkins-ci.org/commit/git-plugin/24fb7f3c441057ad09fc3ce6bbedffff797e92bc Log: JENKINS-14572 Add a test case for clone option's default 'fetch tags' behaviour Even with shallow clones "fetch all tags" is the default. Just added a missing test case and found a true/false bug in my previous commit which toggled the default to the not backwards compatible value.

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java
          src/main/resources/hudson/plugins/git/extensions/impl/CloneOption/config.groovy
          src/main/resources/hudson/plugins/git/extensions/impl/CloneOption/help-noTags.html
          src/test/java/hudson/plugins/git/TestGitRepo.java
          src/test/java/hudson/plugins/git/extensions/impl/CloneOptionNoTagsTest.java
          src/test/java/hudson/plugins/git/extensions/impl/CloneOptionShallowDefaultTagsTest.java
          http://jenkins-ci.org/commit/git-plugin/5c7381cf59d58fe7e0b19a0012fa96144de66b46
          Log:
          Merge pull request #333 from rhaendel/master

          JENKINS-14572 Add "Do not fetch tags" advanced clone option

          Compare: https://github.com/jenkinsci/git-plugin/compare/6773c070cfff...5c7381cf59d5

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java src/main/resources/hudson/plugins/git/extensions/impl/CloneOption/config.groovy src/main/resources/hudson/plugins/git/extensions/impl/CloneOption/help-noTags.html src/test/java/hudson/plugins/git/TestGitRepo.java src/test/java/hudson/plugins/git/extensions/impl/CloneOptionNoTagsTest.java src/test/java/hudson/plugins/git/extensions/impl/CloneOptionShallowDefaultTagsTest.java http://jenkins-ci.org/commit/git-plugin/5c7381cf59d58fe7e0b19a0012fa96144de66b46 Log: Merge pull request #333 from rhaendel/master JENKINS-14572 Add "Do not fetch tags" advanced clone option Compare: https://github.com/jenkinsci/git-plugin/compare/6773c070cfff...5c7381cf59d5

          Mallik M added a comment -

          Is there any workaround for this issue?

          Mallik M added a comment - Is there any workaround for this issue?

          Ronny Händel added a comment -

          Since there has been no git-plugin release (not yet) after my pull request was merged, our workaround was to checkout the sources, build and deploy the plugin manually.

          Another possibility is scripting all git operations like dt25954 mentioned on 23/Oct/13 3:18 PM. Simply use "Execute shell" build steps for that. But this has one big drawback: This way, Jenkins cannot track the commits that are built and not send dedicated e-mails to the committers.

          Ronny Händel added a comment - Since there has been no git-plugin release (not yet) after my pull request was merged, our workaround was to checkout the sources , build and deploy the plugin manually. Another possibility is scripting all git operations like dt25954 mentioned on 23/Oct/13 3:18 PM. Simply use "Execute shell" build steps for that. But this has one big drawback: This way, Jenkins cannot track the commits that are built and not send dedicated e-mails to the committers.

          Mark Waite added a comment -

          Alternatives you can consider:

          • Install a pre-release build of the git plugin which includes the change
          • Use a reference repository in your job definition to reduce the data transfer and disc space use

          Mark Waite added a comment - Alternatives you can consider: Install a pre-release build of the git plugin which includes the change Use a reference repository in your job definition to reduce the data transfer and disc space use

          Mallik M added a comment -

          Thanks Mark, pre-release plugin worked for me and now plugin is not fetching tags.

          One more observation is "Shallow clone" seems not working always, I am able to point this by looking at console output of my project.
          Yet times I see "--depth 1" with command and not always.

          Is there a way to fix this issue?

          Mallik M added a comment - Thanks Mark, pre-release plugin worked for me and now plugin is not fetching tags. One more observation is "Shallow clone" seems not working always, I am able to point this by looking at console output of my project. Yet times I see "--depth 1" with command and not always. Is there a way to fix this issue?

          Mark Waite added a comment -

          mmlk if there is an issue with shallow clone not consistently remaining a shallow clone, please provide a separate bug report which shows the problem through a series of steps that others can duplicate. Console output is helpful, but is not sufficient evidence that there is a problem.

          Mark Waite added a comment - mmlk if there is an issue with shallow clone not consistently remaining a shallow clone, please provide a separate bug report which shows the problem through a series of steps that others can duplicate. Console output is helpful, but is not sufficient evidence that there is a problem.

          Mark Waite added a comment -

          Included in git plugin 2.4.1 released 26 May 2015

          Mark Waite added a comment - Included in git plugin 2.4.1 released 26 May 2015

          That issue is still there.
          It does work whith branches but not with tags.
          With branches I had to configure "Do not fetch tags" to stop fetching all tags.

          But when I do the same for '+refs/tags/ci-uat' it does not find any release for the build as no any tags fetched.
          If I remove ""Do not fetch tags"" it fetches all tags.

          Refspec: +refs/tags/ci-uat
          Honor refspec on initial clone: enabled

          Jenkins: 2.27
          Git plugin: 3.0.0
          Git client plugin: 2.0.0

          Alexey Ostrovsky added a comment - That issue is still there. It does work whith branches but not with tags. With branches I had to configure "Do not fetch tags" to stop fetching all tags. But when I do the same for '+refs/tags/ci-uat' it does not find any release for the build as no any tags fetched. If I remove ""Do not fetch tags"" it fetches all tags. Refspec: +refs/tags/ci-uat Honor refspec on initial clone: enabled Jenkins: 2.27 Git plugin: 3.0.0 Git client plugin: 2.0.0

          Git plugin does not respect 'Honor refspec on initial clone' in case if refs pointed to tags.
          All tags are fetched anyway.

          Alexey Ostrovsky added a comment - Git plugin does not respect 'Honor refspec on initial clone' in case if refs pointed to tags. All tags are fetched anyway.

            Unassigned Unassigned
            dt25954 Douglas Beatty
            Votes:
            6 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: