From 09272ae30731d501f336b4915b9921c2a2d190e5 Mon Sep 17 00:00:00 2001 From: Sean Bryan Date: Mon, 29 Apr 2024 11:22:37 +1000 Subject: [PATCH] Check if repository_path is already initialized --- src/benchcab/utils/repo.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/benchcab/utils/repo.py b/src/benchcab/utils/repo.py index bf31fea..8c1f20d 100644 --- a/src/benchcab/utils/repo.py +++ b/src/benchcab/utils/repo.py @@ -137,8 +137,11 @@ def __init__( """ self.url = url self.branch = branch + is_bare_directory = realisation_path.is_dir() and ( + not (realisation_path / ".git").exists() + ) self.realisation_path = ( - realisation_path / branch if realisation_path.is_dir() else realisation_path + realisation_path / branch if is_bare_directory else realisation_path ) self.commit = commit self.logger = get_logger() @@ -223,9 +226,12 @@ def __init__( self.svn_root = svn_root self.branch_path = branch_path self.revision = revision + is_bare_directory = realisation_path.is_dir() and ( + not (realisation_path / ".svn").exists() + ) self.realisation_path = ( realisation_path / Path(branch_path).name - if realisation_path.is_dir() + if is_bare_directory else realisation_path ) self.logger = get_logger()