refactor #1

Open
roberto wants to merge 12 commits from feature/refactor-code into main
3 changed files with 4 additions and 4 deletions
Showing only changes of commit 1354e09831 - Show all commits

View File

@@ -61,7 +61,7 @@ def run_git_diff(repo: str, base: str, head: str) -> str:
def parse_diff(diff_text: str) -> list[FileDiff]: def parse_diff(diff_text: str) -> list[FileDiff]:
files: list[FileDiff] = [] files: list[FileDiff] = []
current_path: str | None = None current_path: str | None = None
header_ lines: list[str] = [] header_lines: list[str] = []
hunks: list[Hunk] = [] hunks: list[Hunk] = []
current_hunk_header: str | None = None current_hunk_header: str | None = None
current_hunk_lines: list[str] = [] current_hunk_lines: list[str] = []
@@ -89,9 +89,9 @@ def parse_diff(diff_text: str) -> list[FileDiff]:
if line.startswith("diff --git "): if line.startswith("diff --git "):
flush_file() flush_file()
header_lines = [line] header_lines = [line]
p = line.split() parts = line.split()
if len(parts) >= 4 and p[3].startswith("b/"): if len(parts) >= 4 and parts[3].startswith("b/"):
current_path = p[3][len("b/") :] current_path = parts[3][len("b/") :]
else: else:
current_path = None current_path = None
continue continue