From 1897f2fece257cfc763c627a70454a0fd0f68d43 Mon Sep 17 00:00:00 2001 From: TianlongLiang Date: Thu, 7 May 2026 17:06:29 +0800 Subject: [PATCH] update command for analyzing new item names to use git diff instead of git show --- ci/coding_guidelines_check.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ci/coding_guidelines_check.py b/ci/coding_guidelines_check.py index be1002c00f..1901a48a97 100644 --- a/ci/coding_guidelines_check.py +++ b/ci/coding_guidelines_check.py @@ -219,20 +219,17 @@ def analysis_new_item_name(root: Path, commit: str) -> bool: For any directory name in the repo, it is required to use '-' to replace '_'. """ - GIT_SHOW_CMD = f"git show --oneline --name-status --diff-filter A {commit}" + GIT_DIFF_CMD = f"git diff --name-status --diff-filter=A {commit}" try: invalid_items = True output = subprocess.check_output( - shlex.split(GIT_SHOW_CMD), cwd=root, universal_newlines=True + shlex.split(GIT_DIFF_CMD), cwd=root, universal_newlines=True ) if not output: return True - NEW_FILE_PATTERN = "^A\s+(\S+)" - for line_no, line in enumerate(output.split("\n")): - # bypass the first line, usually it is the commit description - if line_no == 0: - continue + NEW_FILE_PATTERN = r"^A\s+(\S+)" + for line in output.split("\n"): if not line: continue