fix(raw-dump): reverse commit order to prevent duplicate uploads

Add --reverse to git log in getCommitLog so commits are returned
oldest-first. Previously, git log defaulted to newest-first, causing
the loop in uploadCommits to overwrite state with the oldest commit.
The next run then queried git log <oldest>..HEAD, re-fetching all
already-uploaded commits and triggering infinite duplicate uploads.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
林凯90331 2026-05-15 15:38:08 +08:00
parent 4dc157e493
commit 47aa3271be

View File

@ -96,12 +96,12 @@ export async function getCommitLog(cwd: string, lastCommit?: string): Promise<st
if (lastCommit) {
return gitExec(
['log', `${lastCommit}..HEAD`, '--max-count=50', ...authorFilter, '--format=%H|%aI|%an|%ae|%s'],
['log', `${lastCommit}..HEAD`, '--reverse', '--max-count=50', ...authorFilter, '--format=%H|%aI|%an|%ae|%s'],
cwd,
)
}
return gitExec(
['log', '--since=1 day ago', '--max-count=50', ...authorFilter, '--format=%H|%aI|%an|%ae|%s'],
['log', '--since=1 day ago', '--reverse', '--max-count=50', ...authorFilter, '--format=%H|%aI|%an|%ae|%s'],
cwd,
)
}