Only update submodules when recursive is true
This commit is contained in:
parent
afd0e78f16
commit
6aac9538a8
1 changed files with 7 additions and 4 deletions
|
@ -429,7 +429,7 @@ def submodule_update(git_path, module, dest):
|
||||||
module.fail_json(msg="Failed to init/update submodules: %s" % out + err)
|
module.fail_json(msg="Failed to init/update submodules: %s" % out + err)
|
||||||
return (rc, out, err)
|
return (rc, out, err)
|
||||||
|
|
||||||
def switch_version(git_path, module, dest, remote, version):
|
def switch_version(git_path, module, dest, remote, version, recursive):
|
||||||
''' once pulled, switch to a particular SHA, tag, or branch '''
|
''' once pulled, switch to a particular SHA, tag, or branch '''
|
||||||
cmd = ''
|
cmd = ''
|
||||||
if version != 'HEAD':
|
if version != 'HEAD':
|
||||||
|
@ -455,8 +455,11 @@ def switch_version(git_path, module, dest, remote, version):
|
||||||
module.fail_json(msg="Failed to checkout %s" % (version))
|
module.fail_json(msg="Failed to checkout %s" % (version))
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="Failed to checkout branch %s" % (branch))
|
module.fail_json(msg="Failed to checkout branch %s" % (branch))
|
||||||
(rc, out2, err2) = submodule_update(git_path, module, dest)
|
if recursive:
|
||||||
return (rc, out1 + out2, err1 + err2)
|
(rc, out2, err2) = submodule_update(git_path, module, dest)
|
||||||
|
out1 += out2
|
||||||
|
err1 += err1
|
||||||
|
return (rc, out1, err1)
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
|
|
||||||
|
@ -565,7 +568,7 @@ def main():
|
||||||
# switch to version specified regardless of whether
|
# switch to version specified regardless of whether
|
||||||
# we cloned or pulled
|
# we cloned or pulled
|
||||||
if not bare:
|
if not bare:
|
||||||
switch_version(git_path, module, dest, remote, version)
|
switch_version(git_path, module, dest, remote, version, recursive)
|
||||||
|
|
||||||
# determine if we changed anything
|
# determine if we changed anything
|
||||||
after = get_version(module, git_path, dest)
|
after = get_version(module, git_path, dest)
|
||||||
|
|
Loading…
Reference in a new issue