Cloner: correct fetch on pre-1.9 git

Commit 6c54b531a3 changed the cloner
to use 'fetch --tags' instead of update, however, 'fetch --tags'
does not actually update heads before git version 1.9.  So if we
are using old versions of git, run both commands so that we get
persistent behavior.

Change-Id: I8ea8ac2c6a8384845a3310da63974afc3279564f
This commit is contained in:
James E. Blair 2016-07-29 10:38:29 -07:00
parent 176431ec14
commit 84c4f94000
1 changed files with 7 additions and 0 deletions

View File

@ -182,6 +182,13 @@ class Repo(object):
repo = self.createRepoObject()
self.log.debug("Updating repository %s" % self.local_path)
origin = repo.remotes.origin
if repo.git.version_info[:2] < (1, 9):
# Before 1.9, 'git fetch --tags' did not include the
# behavior covered by 'git --fetch', so we run both
# commands in that case. Starting with 1.9, 'git fetch
# --tags' is all that is necessary. See
# https://github.com/git/git/blob/master/Documentation/RelNotes/1.9.0.txt#L18-L20
origin.fetch()
origin.fetch(tags=True)