This commit is contained in:
@@ -122,6 +122,20 @@ def get_controller_files_diff(base_sha: str, head_sha: str, changed_files: List[
|
||||
return ""
|
||||
|
||||
|
||||
def get_file_content_at_commit(commit_sha: str, file_path: str) -> Optional[str]:
|
||||
"""
|
||||
读取指定 commit 下某个文件的内容(无需 git worktree,更快)。
|
||||
|
||||
:param commit_sha: commit SHA
|
||||
:param file_path: 相对仓库根目录的文件路径
|
||||
:return: 文件内容;该 commit 中不存在则返回 None
|
||||
"""
|
||||
try:
|
||||
return run_git(["show", f"{commit_sha}:{file_path}"])
|
||||
except RuntimeError:
|
||||
return None
|
||||
|
||||
|
||||
def prepare_worktrees(repo_root: Path) -> tuple:
|
||||
"""
|
||||
准备新旧两个版本的代码工作目录,供 AST 解析器分别扫描。
|
||||
|
||||
Reference in New Issue
Block a user