diff --git a/apps/api/src/utils/git_history.py b/apps/api/src/utils/git_history.py index 9ac61c2..b7e459d 100644 --- a/apps/api/src/utils/git_history.py +++ b/apps/api/src/utils/git_history.py @@ -63,12 +63,11 @@ def get_commit_history(repo_path: str, branch: str | None = None, limit: int = 1 branches_output = _run_git_command(repo_path, ["branch", "-a", "--format=%(refname:short)"]) branches = [b.strip() for b in branches_output.strip().split("\n") if b.strip()] - # Build git log command + # Build git log command - use NULL bytes as separators to avoid parsing issues log_args = [ "log", "--all", - "--graph", - f"--format=%H|%P|%an|%ae|%at|%s", + "--format=%H%x00%P%x00%an%x00%ae%x00%at%x00%s", f"--max-count={limit}", f"--skip={offset}", ] @@ -82,13 +81,14 @@ def get_commit_history(repo_path: str, branch: str | None = None, limit: int = 1 tag_map = _get_tag_map(repo_path) commits = [] - graph_lines = log_output.strip().split("\n") if log_output.strip() else [] + log_lines = log_output.strip().split("\n") if log_output.strip() else [] - for line in graph_lines: - if "|" not in line: + for line in log_lines: + line = line.strip() + if not line: continue - parts = line.split("|") + parts = line.split("\x00") if len(parts) < 6: continue