Further refine remote branch tracking in b1ec6e8
Move operations that are dependant on a remote branch under a if is_remote_branch() conditional. While at it, remove assignment to cmd string in same block that wasn't used when calling _run().
This commit is contained in:
parent
feb5705017
commit
84264009b5
1 changed files with 8 additions and 8 deletions
6
git
6
git
|
@ -197,10 +197,10 @@ def switch_version(module, dest, remote, version):
|
||||||
os.chdir(dest)
|
os.chdir(dest)
|
||||||
cmd = ''
|
cmd = ''
|
||||||
if version != 'HEAD':
|
if version != 'HEAD':
|
||||||
if not is_local_branch(module, dest, version) and is_remote_branch(module, dest, remote, version):
|
if is_remote_branch(module, dest, remote, version):
|
||||||
|
if not is_local_branch(module, dest, version):
|
||||||
cmd = "git checkout --track -b %s %s/%s" % (version, remote, version)
|
cmd = "git checkout --track -b %s %s/%s" % (version, remote, version)
|
||||||
elif is_local_branch(module, dest, version):
|
else:
|
||||||
cmd = "git checkout --force %s" % version
|
|
||||||
(rc, out, err) = _run("git checkout --force %s" % version)
|
(rc, out, err) = _run("git checkout --force %s" % version)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(msg="Failed to checkout branch %s" % version)
|
module.fail_json(msg="Failed to checkout branch %s" % version)
|
||||||
|
|
Loading…
Reference in a new issue