diff --git a/lib/tfw/components/snapshot_provider.py b/lib/tfw/components/snapshot_provider.py index 01c1624..ecc4d2a 100644 --- a/lib/tfw/components/snapshot_provider.py +++ b/lib/tfw/components/snapshot_provider.py @@ -6,6 +6,7 @@ from subprocess import run from getpass import getuser from os.path import isdir from datetime import datetime +from uuid import uuid4 class SnapshotProvider: @@ -73,18 +74,12 @@ class SnapshotProvider: )) def _checkout_new_branch_from_head(self): - head_hash = self._get_head_hash() + branch_name = uuid4() self._run(( 'git', 'branch', - head_hash - )) - self._checkout(head_hash) - - def _get_head_hash(self): - return self._get_stdout(( - 'git', 'rev-parse', - 'HEAD' + branch_name )) + self._checkout(branch_name) def restore_snapshot(self, date): commit = self._get_commit_from_timestamp(date)