fix: don't combine --all with branch name in git log
Using 'git log --all <branch>' creates ambiguous behavior. Now: - Without branch: uses --all to show all commits from all refs - With branch: shows only commits from that specific branch This ensures consistent commit counts between git CLI and API.
This commit is contained in:
@@ -67,13 +67,14 @@ def get_commit_history(repo_path: str, branch: str | None = None, limit: int = 1
|
||||
# Build git log command - use NULL bytes as separators to avoid parsing issues
|
||||
log_args = [
|
||||
"log",
|
||||
"--all",
|
||||
"--format=%H%x00%P%x00%an%x00%ae%x00%at%x00%s",
|
||||
f"--max-count={limit}",
|
||||
f"--skip={offset}",
|
||||
]
|
||||
if branch:
|
||||
log_args.append(branch)
|
||||
else:
|
||||
log_args.append("--all")
|
||||
|
||||
log_output = _run_git_command(repo_path, log_args)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user