fix(027): stabilize shared acceptance gates and compatibility collateral
This commit is contained in:
@@ -50,6 +50,7 @@ class GitService:
|
||||
with belief_scope("GitService.__init__"):
|
||||
backend_root = Path(__file__).parents[2]
|
||||
self.legacy_base_path = str((backend_root / "git_repos").resolve())
|
||||
self._uses_default_base_path = base_path == "git_repos"
|
||||
self.base_path = self._resolve_base_path(base_path)
|
||||
self._ensure_base_path_exists()
|
||||
# [/DEF:backend.src.services.git_service.GitService.__init__:Function]
|
||||
@@ -281,6 +282,9 @@ class GitService:
|
||||
normalized_key = self._normalize_repo_key(fallback_key)
|
||||
target_path = os.path.join(self.base_path, normalized_key)
|
||||
|
||||
if not self._uses_default_base_path:
|
||||
return target_path
|
||||
|
||||
try:
|
||||
session = SessionLocal()
|
||||
try:
|
||||
@@ -345,10 +349,14 @@ class GitService:
|
||||
logger.warning(
|
||||
f"[init_repo][Action] Existing path is not a Git repository, recreating: {repo_path}"
|
||||
)
|
||||
if os.path.isdir(repo_path):
|
||||
shutil.rmtree(repo_path)
|
||||
else:
|
||||
os.remove(repo_path)
|
||||
stale_path = Path(repo_path)
|
||||
if stale_path.exists():
|
||||
shutil.rmtree(stale_path, ignore_errors=True)
|
||||
if stale_path.exists():
|
||||
try:
|
||||
stale_path.unlink()
|
||||
except Exception:
|
||||
pass
|
||||
repo = Repo.clone_from(auth_url, repo_path)
|
||||
self._ensure_gitflow_branches(repo, dashboard_id)
|
||||
return repo
|
||||
|
||||
Reference in New Issue
Block a user