From 8f6ae92cf88beda287c6c11d8b4127239c3168e0 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 22 Dec 2014 15:08:25 -0800 Subject: [PATCH] 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 --- source_control/git.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source_control/git.py b/source_control/git.py index f67abe32fa2..44ebf06487a 100644 --- a/source_control/git.py +++ b/source_control/git.py @@ -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'])) + # 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])) + refspecs = ['+refs/tags/*:refs/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])) + 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)