Remove incorrect reversal of targetHistory

This commit is contained in:
Commit Report Sync Bot 2025-03-01 23:36:59 -08:00
parent 05aa726283
commit 74290d2101
8 changed files with 12 additions and 6 deletions

4
dist/index.js vendored
View File

@ -25830,7 +25830,7 @@ async function main(sourceRepo, targetRepo, dryRun, tokenForTargetRepo) {
// compared), albeit approximately-halved - but I'm gambling on the fact that that should still take
// negligible practical time at usual repo sizes - at least, the ones I'm
// this quadratic portion should be negligible, though - and, even if it isn't, it definitely will
targetCommitHistory = buildTargetCommitHistory(TARGET_DIR, sourceCommit.date).reverse();
targetCommitHistory = buildTargetCommitHistory(TARGET_DIR, sourceCommit.date);
}
}
console.log(`DEBUG - targetCommit: ${targetCommit.hash}`);
@ -25874,7 +25874,7 @@ function buildTargetCommitHistory(path, oldestDateInSourceCommitHistory) {
try {
const countingLogOutput = (0, child_process_1.execSync)(`git log --since=${oldestDateInSourceCommitHistory.toISOString()} --pretty=oneline`, { cwd: path });
const countedNumber = countingLogOutput.toString().split('\n').length;
console.log(`DEBUG - countedNumber: ${countedNumber}`);
console.log(`DEBUG - countedNumber (how many commits in target repo since oldest source commit) is: ${countedNumber}`);
const logOutput = (0, child_process_1.execSync)(`git log --max-count=${countedNumber + 1} --pretty=format:'{\"hash\":\"%h\",\"author_name\":\"%an\",\"author_email\":\"%ae\",\"date\":\"%ai\",\"message\":\"%s\",\"parentHashes\":\"%p\"}'`, { cwd: path });
const logLines = logOutput.toString().split('\n');
for (const line of logLines) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

10
run.sh
View File

@ -6,11 +6,17 @@
# would be my natural preference
rm -rf working
if [[ -z "$TOKEN" ]]; then
echo "TOKEN is not set"
exit 1
fi
INPUT_SOURCE_REPO_DOMAIN="gitea.scubbo.org" \
INPUT_SOURCE_REPO_OWNER="scubbo" \
INPUT_SOURCE_REPO_NAME="commit-report-sync" \
INPUT_TARGET_REPO_DOMAIN="gitea.scubbo.org" \
INPUT_TARGET_REPO_DOMAIN="github.com" \
INPUT_TARGET_REPO_OWNER="scubbo" \
INPUT_TARGET_REPO_NAME="commit-report-sync-testbed-destination" \
INPUT_TARGET_REPO_NAME="gitea-commit-mirror" \
INPUT_DRY_RUN="false" \
INPUT_TOKEN_FOR_TARGET_REPO="$TOKEN" \
npx ts-node src/index.ts

View File

@ -103,7 +103,7 @@ export async function main(sourceRepo: Repo, targetRepo: Repo, dryRun: boolean,
// compared), albeit approximately-halved - but I'm gambling on the fact that that should still take
// negligible practical time at usual repo sizes - at least, the ones I'm
// this quadratic portion should be negligible, though - and, even if it isn't, it definitely will
targetCommitHistory = buildTargetCommitHistory(TARGET_DIR, sourceCommit.date).reverse();
targetCommitHistory = buildTargetCommitHistory(TARGET_DIR, sourceCommit.date);
}
}
console.log(`DEBUG - targetCommit: ${targetCommit.hash}`);
@ -158,7 +158,7 @@ export function buildTargetCommitHistory(path: string, oldestDateInSourceCommitH
{ cwd: path }
);
const countedNumber = countingLogOutput.toString().split('\n').length;
console.log(`DEBUG - countedNumber: ${countedNumber}`);
console.log(`DEBUG - countedNumber (how many commits in target repo since oldest source commit) is: ${countedNumber}`);
const logOutput = execSync(
`git log --max-count=${countedNumber+1} --pretty=format:'{\"hash\":\"%h\",\"author_name\":\"%an\",\"author_email\":\"%ae\",\"date\":\"%ai\",\"message\":\"%s\",\"parentHashes\":\"%p\"}'`,
{ cwd: path }