mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-09 17:59:09 -07:00
[git] Fix switching branch of shallow clone (#18728)
* [git] Fix fetching branch of shallow clone * Use absolute file:// paths to make sure git uses shallow clones * Improve tests * Fix sanity errors * Match style according to other (depth) tests * Improve tests Now they will fail without the fix of this PR
This commit is contained in:
parent
098eac076d
commit
7225839bef
3 changed files with 62 additions and 3 deletions
|
@ -715,9 +715,7 @@ def fetch(git_path, module, repo, dest, version, remote, depth, bare, refspec, g
|
|||
# 1.8.3 is broken, 1.9.x works
|
||||
# ensure that remote branch is available as both local and remote ref
|
||||
refspecs.append('+refs/heads/%s:refs/heads/%s' % (version, version))
|
||||
refspecs.append('+refs/heads/%s:refs/remotes/%s/%s' % (version, remote, version))
|
||||
else:
|
||||
refspecs.append(version)
|
||||
refspecs.append('+refs/heads/%s:refs/remotes/%s/%s' % (version, remote, version))
|
||||
elif is_remote_tag(git_path, module, dest, repo, version):
|
||||
refspecs.append('+refs/tags/' + version + ':refs/tags/' + version)
|
||||
if refspecs:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue