Browse Source

Merge "add the "honorRefspec" option to the Git SCM"

tags/2.10.0
Zuul 2 months ago
parent
commit
9f84f69f3c

+ 7
- 1
jenkins_jobs/modules/scm.py View File

@@ -172,6 +172,8 @@ def git(registry, xml_parent, data):
172 172
         * **depth** (`int`) - Set shallow clone depth (default 1)
173 173
         * **do-not-fetch-tags** (`bool`) - Perform a clone without tags
174 174
             (default false)
175
+        * **honor-refspec** (`bool`) - Perform initial clone using the refspec
176
+            defined for the repository (default false)
175 177
         * **sparse-checkout** (`dict`)
176 178
             * **paths** (`list`) - List of paths to sparse checkout. (optional)
177 179
         * **submodule** (`dict`)
@@ -443,7 +445,8 @@ def git_extensions(xml_parent, data):
443 445
     clone_options = (
444 446
         "shallow-clone",
445 447
         "timeout",
446
-        "do-not-fetch-tags"
448
+        "do-not-fetch-tags",
449
+        "honor-refspec",
447 450
     )
448 451
     if any(key in data for key in clone_options):
449 452
         ext_name = impl_prefix + 'CloneOption'
@@ -465,6 +468,9 @@ def git_extensions(xml_parent, data):
465 468
                 data.get('do-not-fetch-tags', False)).lower()
466 469
         if 'timeout' in data:
467 470
             XML.SubElement(ext, 'timeout').text = str(data['timeout'])
471
+        if 'honor-refspec' in data:
472
+            XML.SubElement(ext, 'honorRefspec').text = str(
473
+                data.get('honor-refspec', False)).lower()
468 474
     if not trait and 'sparse-checkout' in data:
469 475
         ext_name = impl_prefix + 'SparseCheckoutPaths'
470 476
         ext = XML.SubElement(xml_parent, ext_name)

+ 1
- 0
tests/scm/fixtures/git-cloneoptions01.xml View File

@@ -28,6 +28,7 @@
28 28
         <shallow>false</shallow>
29 29
         <depth>1</depth>
30 30
         <noTags>true</noTags>
31
+        <honorRefspec>true</honorRefspec>
31 32
       </hudson.plugins.git.extensions.impl.CloneOption>
32 33
       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
33 34
     </extensions>

+ 1
- 0
tests/scm/fixtures/git-cloneoptions01.yaml View File

@@ -4,3 +4,4 @@ scm:
4 4
       branches:
5 5
         - master
6 6
       do-not-fetch-tags: true
7
+      honor-refspec: true

Loading…
Cancel
Save