mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
git: git reset with branch
`git reset <ref>` can be ambiguous and fail to switch to the correct branch. To avoid it, specify branch as well.
This commit is contained in:
parent
79fa5ef4cb
commit
99ef1f3a9f
3 changed files with 33 additions and 1 deletions
|
@ -816,7 +816,7 @@ def switch_version(git_path, module, dest, remote, version, verify_commit, depth
|
|||
if rc != 0:
|
||||
module.fail_json(msg="Failed to checkout branch %s" % branch,
|
||||
stdout=out, stderr=err, rc=rc)
|
||||
cmd = "%s reset --hard %s --" % (git_path, remote)
|
||||
cmd = "%s reset --hard %s/%s --" % (git_path, remote, branch)
|
||||
else:
|
||||
# FIXME check for local_branch first, should have been fetched already
|
||||
if is_remote_branch(git_path, module, dest, remote, version):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue