Run git init only if there is no repo present

This commit is contained in:
Kristóf Tóth 2018-07-18 14:15:19 +02:00
parent 2f5e8d11f3
commit 49e0efa4c9

View File

@ -21,10 +21,14 @@ class SnapshotProvider:
self._branch = 'master'
self._branches = [self._branch]
self._init_repo()
self._init_repo_if_needed()
def _init_repo(self):
self._run(('git', 'init'))
def _init_repo_if_needed(self):
if not self._repo_is_initialized():
self._run(('git', 'init'))
def _repo_is_initialized(self):
return self._run(('git', 'status')).returncode == 0
def take_snapshot(self):
if self._head_detached: