git fetch --tags overwrites normal fetching with git < 1.8.x so do a normal fetch followed by using the refspec format for fetching tags

This commit is contained in:
Toshio Kuratomi 2014-12-22 15:08:25 -08:00
parent 8a03af6608
commit 8f6ae92cf8

View file

@ -484,12 +484,14 @@ def fetch(git_path, module, repo, dest, version, remote, bare, refspec):
refspecs.append(refspec)
commands.append((fetch_str, [git_path, 'fetch', remote] + refspecs))
else:
commands.append((fetch_str, [git_path, 'fetch', '--tags']))
if refspec:
# unlike in bare mode, there's no way to combine the
# additional refspec with the default git fetch behavior,
# so use two commands
commands.append((fetch_str, [git_path, 'fetch', remote, refspec]))
commands.append((fetch_str, [git_path, 'fetch', remote]))
refspecs = ['+refs/tags/*:refs/tags/*']
if refspec:
refspecs.append(refspec)
commands.append((fetch_str, [git_path, 'fetch', remote] + refspecs))
for (label,command) in commands:
(rc,out,err) = module.run_command(command, cwd=dest)