mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-10-31 13:02:54 +00:00 
			
		
		
		
	Fix restore_snapshot() choking on timestamps before initial commit
This commit is contained in:
		| @@ -129,13 +129,24 @@ class SnapshotProvider: | |||||||
|         self._checkout(commit) |         self._checkout(commit) | ||||||
|  |  | ||||||
|     def _get_commit_from_timestamp(self, date): |     def _get_commit_from_timestamp(self, date): | ||||||
|         return self._get_stdout(( |         commit = self._get_stdout(( | ||||||
|             'git', 'rev-list', |             'git', 'rev-list', | ||||||
|             '--date=iso', |             '--date=iso', | ||||||
|             '-n', '1', |             '-n', '1', | ||||||
|             f'--before="{date.isoformat()}"', |             f'--before="{date.isoformat()}"', | ||||||
|             self._last_valid_branch |             self._last_valid_branch | ||||||
|         )) |         )) | ||||||
|  |         if not commit: | ||||||
|  |             commit = self._get_oldest_parent_of_head() | ||||||
|  |         return commit | ||||||
|  |  | ||||||
|  |     def _get_oldest_parent_of_head(self): | ||||||
|  |         return self._get_stdout(( | ||||||
|  |             'git', | ||||||
|  |             'rev-list', | ||||||
|  |             '--max-parents=0', | ||||||
|  |             'HEAD' | ||||||
|  |         )) | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def _last_valid_branch(self): |     def _last_valid_branch(self): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user