#!/usr/bin/env python3 """Test script to check if git repository detection is working""" import os import json from pathlib import Path # Load projects with open('data/projects.json', 'r') as f: data = json.load(f) projects = data.get('projects', []) print("Testing Git repository detection:\n") for project in projects: if project['id'] not in ["vps-permanent", "admin-panel-permanent", "vps-docker-permanent"]: project_path = Path(project['path']) git_path = project_path / ".git" print(f"Project: {project['name']}") print(f" Path: {project_path}") print(f" Git repo exists: {git_path.exists()}") if git_path.exists(): # Check remote import subprocess try: result = subprocess.run( ["git", "remote", "-v"], cwd=project_path, capture_output=True, text=True, check=False ) if result.returncode == 0: print(f" Remotes: {result.stdout.strip()}") else: print(f" Error checking remotes: {result.stderr}") except Exception as e: print(f" Error: {e}") print()