mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 12:51:32 +00:00
Fix broken init_git_dir logic 🐛
This commit is contained in:
parent
b140550686
commit
782df25bee
@ -4,8 +4,6 @@
|
||||
from os.path import join as joinpath
|
||||
from os.path import basename
|
||||
from os import makedirs
|
||||
from uuid import uuid4
|
||||
from glob import glob
|
||||
|
||||
from dateutil import parser as dateparser
|
||||
|
||||
@ -29,19 +27,16 @@ class DirectorySnapshottingEventHandler(EventHandlerBase):
|
||||
}
|
||||
|
||||
def init_snapshot_providers(self, directories):
|
||||
for directory in directories:
|
||||
git_dir = self.init_git_dir(directory)
|
||||
for index, directory in enumerate(directories):
|
||||
git_dir = self.init_git_dir(index, directory)
|
||||
self.snapshot_providers[directory] = SnapshotProvider(directory, git_dir)
|
||||
|
||||
@staticmethod
|
||||
def init_git_dir(directory):
|
||||
git_dir_prefix = joinpath(
|
||||
def init_git_dir(index, directory):
|
||||
git_dir = joinpath(
|
||||
TFWENV.SNAPSHOTS_DIR,
|
||||
f'{basename(directory)}-'
|
||||
f'{basename(directory)}-{index}'
|
||||
)
|
||||
potential_dirs = glob(f'{git_dir_prefix}*')
|
||||
|
||||
git_dir = potential_dirs[0] if potential_dirs else f'{git_dir_prefix}{str(uuid4())}'
|
||||
makedirs(git_dir, exist_ok=True)
|
||||
return git_dir
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user