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
(optional)
* **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
(default false)
* **sparse-checkout** (`dict`)
@ -381,8 +382,10 @@ def git(registry, xml_parent, data):
)
if any(key in data for key in clone_options):
clo = XML.SubElement(exts_node, impl_prefix + 'CloneOption')
XML.SubElement(clo, 'shallow').text = str(
data.get('shallow-clone', False)).lower()
clone_mapping = [
('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:
XML.SubElement(clo, 'noTags').text = str(
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.CloneOption>
<shallow>true</shallow>
<depth>1</depth>
</hudson.plugins.git.extensions.impl.CloneOption>
<hudson.plugins.git.extensions.impl.SubmoduleOption>
<disableSubmodules>false</disableSubmodules>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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