diff --git a/lib/tfw/components/snapshot_provider.py b/lib/tfw/components/snapshot_provider.py index 65517e8..0ce8133 100644 --- a/lib/tfw/components/snapshot_provider.py +++ b/lib/tfw/components/snapshot_provider.py @@ -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: