diff --git a/scripts/af_click_gap_pipeline.py b/scripts/af_click_gap_pipeline.py index 28b7bba..61fd7b5 100755 --- a/scripts/af_click_gap_pipeline.py +++ b/scripts/af_click_gap_pipeline.py @@ -175,13 +175,15 @@ def git_run(repo: Path, args: list[str]) -> subprocess.CompletedProcess[str]: def git_publish(repo: Path, start: str, end: str, no_push: bool) -> str: if not (repo / ".git").exists(): raise RuntimeError("仓库尚未初始化") - status = git_run(repo, ["status", "--porcelain", "--untracked-files=all"]).stdout.strip().splitlines() + status_output = git_run(repo, ["status", "--porcelain", "--untracked-files=all"]).stdout + status = status_output.splitlines() allowed = re.compile(r"data/(?:index\.json|[0-9]{8}\.json)$") allowed_paths = [] unexpected = [] for line in status: - path = line[3:] if len(line) >= 4 else "" - if not allowed.fullmatch(path): + prefix = line[:2] if len(line) >= 2 else "" + path = line[3:] if len(line) >= 4 and line[2] == " " else "" + if prefix not in {" M", "M ", "??", "D ", " D"} or not allowed.fullmatch(path): unexpected.append(line) else: allowed_paths.append(path)