Commit 65413dc7 by Stephen Fromm

Merge pull request #1724 from sfromm/issue1722a

Further refine remote branch tracking in b1ec6e81
parents 1d910bb4 1bcfdd94
......@@ -197,14 +197,14 @@ def switch_version(module, dest, remote, version):
os.chdir(dest)
cmd = ''
if version != 'HEAD':
if not is_local_branch(module, dest, version) and is_remote_branch(module, dest, remote, version):
cmd = "git checkout --track -b %s %s/%s" % (version, remote, version)
elif is_local_branch(module, dest, version):
cmd = "git checkout --force %s" % version
(rc, out, err) = _run("git checkout --force %s" % version)
if rc != 0:
module.fail_json(msg="Failed to checkout branch %s" % version)
cmd = "git reset --hard %s/%s" % (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)
else:
(rc, out, err) = _run("git checkout --force %s" % version)
if rc != 0:
module.fail_json(msg="Failed to checkout branch %s" % version)
cmd = "git reset --hard %s/%s" % (remote, version)
else:
cmd = "git checkout --force %s" % version
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment