diff options
author | Chad Nelson <chadbnelson@gmail.com> | 2014-04-17 09:34:36 -0400 |
---|---|---|
committer | Chad Nelson <chadbnelson@gmail.com> | 2014-04-17 09:34:36 -0400 |
commit | 6aac9538a8a28fb1dce0e1d5045addb38b10d954 (patch) | |
tree | 4a8cee08a52b68a4b3162e013cb3bcc6c3bd233e /source_control | |
parent | afd0e78f169b99551c4ba07a36e960ca52dddd51 (diff) | |
download | ansible-modules-extras-6aac9538a8a28fb1dce0e1d5045addb38b10d954.tar.gz |
Only update submodules when recursive is true
Diffstat (limited to 'source_control')
-rw-r--r-- | source_control/git | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source_control/git b/source_control/git index 968b763b..6af4bd71 100644 --- a/source_control/git +++ b/source_control/git @@ -429,7 +429,7 @@ def submodule_update(git_path, module, dest): module.fail_json(msg="Failed to init/update submodules: %s" % 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 ''' cmd = '' 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)) else: module.fail_json(msg="Failed to checkout branch %s" % (branch)) - (rc, out2, err2) = submodule_update(git_path, module, dest) - return (rc, out1 + out2, err1 + err2) + if recursive: + (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 # we cloned or pulled 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 after = get_version(module, git_path, dest) |