refactor: one git runner and main line fallback

core.gitclone gains required_git_lines, which raises GitRefused with
git's error, and fallback_lines, the remote lines tried when no remote
names the project. profile_sync and validate_pr use both.

profile_sync --changed without --base now also finds a clone whose main
line is upstream/master, upstream/v2, origin/master or origin/v2, as
validate_pr already did, before falling back to HEAD.
This commit is contained in:
Abdessamad Derraz committed 2026-11-20 20:03:26 +01:00
1 parent 97af05db9a
commit 2f8f78b6b5
3 files changed
+46 -20

No files matched your search

+2 -5
View File
@@ -34,7 +34,7 @@ try:
import yaml
except ImportError:
yaml = None
from core.gitclone import git_lines, project_main_line
from core.gitclone import fallback_lines, git_lines, project_main_line
from resolve.review import (
ValidationResult,
load_platform_hashes,
@@ -56,10 +56,7 @@ def get_changed_files() -> list[str]:
changed: list[str] = []
compared = False
project_base = project_main_line()
remotes = [[project_base]] if project_base else [
[f"{remote}/{base}" for base in ("main", "master", "v2")]
for remote in ("upstream", "origin")
]
remotes = [[project_base]] if project_base else fallback_lines()
for candidates in remotes:
for line in candidates:
committed = git_lines("diff", "--name-only", f"{line}...HEAD")