Fix SPACK-87: Tag checkout fails for older git versions.
This commit is contained in:
		| @@ -363,10 +363,6 @@ def __init__(self, **kwargs): | |||||||
|             'git', 'tag', 'branch', 'commit', **kwargs) |             'git', 'tag', 'branch', 'commit', **kwargs) | ||||||
|         self._git = None |         self._git = None | ||||||
|  |  | ||||||
|         # For git fetch branches and tags the same way. |  | ||||||
|         if not self.branch: |  | ||||||
|             self.branch = self.tag |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def git_version(self): |     def git_version(self): | ||||||
| @@ -422,6 +418,12 @@ def fetch(self): | |||||||
|             self.git(*args) |             self.git(*args) | ||||||
|             self.stage.chdir_to_source() |             self.stage.chdir_to_source() | ||||||
|  |  | ||||||
|  |             # For tags, be conservative and check them out AFTER | ||||||
|  |             # cloning.  Later git versions can do this with clone | ||||||
|  |             # --branch, but older ones fail. | ||||||
|  |             if self.tag: | ||||||
|  |                 self.git('checkout', self.tag) | ||||||
|  |  | ||||||
|  |  | ||||||
|     def archive(self, destination): |     def archive(self, destination): | ||||||
|         super(GitFetchStrategy, self).archive(destination, exclude='.git') |         super(GitFetchStrategy, self).archive(destination, exclude='.git') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin