Merge "Add depth option to git shallow-clone"

This commit is contained in:
Zuul 2018-06-15 03:45:15 +00:00 committed by Gerrit Code Review
commit 19e3c86074
8 changed files with 14 additions and 3 deletions

View File

@ -169,6 +169,7 @@ def git(registry, xml_parent, data):
* **scm-name** (`string`) - The unique scm name for this Git SCM * **scm-name** (`string`) - The unique scm name for this Git SCM
(optional) (optional)
* **shallow-clone** (`bool`) - Perform shallow clone (default false) * **shallow-clone** (`bool`) - Perform shallow clone (default false)
* **depth** (`int`) - Set shallow clone depth (default 1)
* **do-not-fetch-tags** (`bool`) - Perform a clone without tags * **do-not-fetch-tags** (`bool`) - Perform a clone without tags
(default false) (default false)
* **sparse-checkout** (`dict`) * **sparse-checkout** (`dict`)
@ -381,8 +382,10 @@ def git(registry, xml_parent, data):
) )
if any(key in data for key in clone_options): if any(key in data for key in clone_options):
clo = XML.SubElement(exts_node, impl_prefix + 'CloneOption') clo = XML.SubElement(exts_node, impl_prefix + 'CloneOption')
XML.SubElement(clo, 'shallow').text = str( clone_mapping = [
data.get('shallow-clone', False)).lower() ('shallow-clone', 'shallow', False),
('depth', 'depth', 1)]
convert_mapping_to_xml(clo, data, clone_mapping, fail_required=True)
if 'do-not-fetch-tags' in data: if 'do-not-fetch-tags' in data:
XML.SubElement(clo, 'noTags').text = str( XML.SubElement(clo, 'noTags').text = str(
data.get('do-not-fetch-tags', False)).lower() data.get('do-not-fetch-tags', False)).lower()

View File

@ -37,6 +37,7 @@
<hudson.plugins.git.extensions.impl.CleanBeforeCheckout/> <hudson.plugins.git.extensions.impl.CleanBeforeCheckout/>
<hudson.plugins.git.extensions.impl.CloneOption> <hudson.plugins.git.extensions.impl.CloneOption>
<shallow>true</shallow> <shallow>true</shallow>
<depth>1</depth>
</hudson.plugins.git.extensions.impl.CloneOption> </hudson.plugins.git.extensions.impl.CloneOption>
<hudson.plugins.git.extensions.impl.SubmoduleOption> <hudson.plugins.git.extensions.impl.SubmoduleOption>
<disableSubmodules>false</disableSubmodules> <disableSubmodules>false</disableSubmodules>

View File

@ -26,6 +26,7 @@
<extensions> <extensions>
<hudson.plugins.git.extensions.impl.CloneOption> <hudson.plugins.git.extensions.impl.CloneOption>
<shallow>false</shallow> <shallow>false</shallow>
<depth>1</depth>
<noTags>true</noTags> <noTags>true</noTags>
</hudson.plugins.git.extensions.impl.CloneOption> </hudson.plugins.git.extensions.impl.CloneOption>
<hudson.plugins.git.extensions.impl.WipeWorkspace/> <hudson.plugins.git.extensions.impl.WipeWorkspace/>

View File

@ -28,6 +28,7 @@
<hudson.plugins.git.extensions.impl.CleanCheckout/> <hudson.plugins.git.extensions.impl.CleanCheckout/>
<hudson.plugins.git.extensions.impl.CloneOption> <hudson.plugins.git.extensions.impl.CloneOption>
<shallow>true</shallow> <shallow>true</shallow>
<depth>1</depth>
</hudson.plugins.git.extensions.impl.CloneOption> </hudson.plugins.git.extensions.impl.CloneOption>
<hudson.plugins.git.extensions.impl.WipeWorkspace/> <hudson.plugins.git.extensions.impl.WipeWorkspace/>
</extensions> </extensions>

View File

@ -27,6 +27,7 @@
<hudson.plugins.git.extensions.impl.CleanCheckout/> <hudson.plugins.git.extensions.impl.CleanCheckout/>
<hudson.plugins.git.extensions.impl.CloneOption> <hudson.plugins.git.extensions.impl.CloneOption>
<shallow>false</shallow> <shallow>false</shallow>
<depth>1</depth>
</hudson.plugins.git.extensions.impl.CloneOption> </hudson.plugins.git.extensions.impl.CloneOption>
<hudson.plugins.git.extensions.impl.WipeWorkspace/> <hudson.plugins.git.extensions.impl.WipeWorkspace/>
</extensions> </extensions>

View File

@ -29,6 +29,7 @@
<extensions> <extensions>
<hudson.plugins.git.extensions.impl.CloneOption> <hudson.plugins.git.extensions.impl.CloneOption>
<shallow>false</shallow> <shallow>false</shallow>
<depth>1</depth>
<timeout>20</timeout> <timeout>20</timeout>
</hudson.plugins.git.extensions.impl.CloneOption> </hudson.plugins.git.extensions.impl.CloneOption>
<hudson.plugins.git.extensions.impl.CheckoutOption> <hudson.plugins.git.extensions.impl.CheckoutOption>

View File

@ -34,7 +34,8 @@
</options> </options>
</hudson.plugins.git.extensions.impl.ChangelogToBranch> </hudson.plugins.git.extensions.impl.ChangelogToBranch>
<hudson.plugins.git.extensions.impl.CloneOption> <hudson.plugins.git.extensions.impl.CloneOption>
<shallow>false</shallow> <shallow>true</shallow>
<depth>3</depth>
<noTags>false</noTags> <noTags>false</noTags>
<timeout>20</timeout> <timeout>20</timeout>
</hudson.plugins.git.extensions.impl.CloneOption> </hudson.plugins.git.extensions.impl.CloneOption>

View File

@ -6,6 +6,8 @@ scm:
- stable - stable
browser: githubweb browser: githubweb
browser-url: http://github.com/foo/example.git browser-url: http://github.com/foo/example.git
shallow-clone: true
depth: 3
timeout: 20 timeout: 20
do-not-fetch-tags: false do-not-fetch-tags: false
changelog-against: changelog-against: