edsger 0.13.3 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/git-branch-manager.js +20 -20
- package/package.json +1 -1
|
@@ -409,42 +409,42 @@ export async function syncFeatBranchWithMain(featureId, githubToken, owner, repo
|
|
|
409
409
|
branch: featBranch,
|
|
410
410
|
});
|
|
411
411
|
const featSha = featBranchData.commit.sha;
|
|
412
|
-
// Check if feat branch is already up to date
|
|
413
|
-
// We need to merge main into feat to keep it updated
|
|
412
|
+
// Check if feat branch is already up to date
|
|
414
413
|
if (verbose) {
|
|
415
414
|
logInfo(`📥 Syncing ${featBranch} with ${baseBranch}...`);
|
|
416
415
|
logInfo(` ${baseBranch} SHA: ${mainSha.substring(0, 7)}`);
|
|
417
416
|
logInfo(` ${featBranch} SHA: ${featSha.substring(0, 7)}`);
|
|
418
417
|
}
|
|
419
|
-
//
|
|
418
|
+
// If already at the same SHA, no need to update
|
|
419
|
+
if (mainSha === featSha) {
|
|
420
|
+
if (verbose) {
|
|
421
|
+
logInfo(`ℹ️ ${featBranch} is already up to date with ${baseBranch}`);
|
|
422
|
+
}
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
// Use git.updateRef to fast-forward feat branch to main's SHA
|
|
426
|
+
// This avoids creating a merge commit
|
|
420
427
|
try {
|
|
421
|
-
await octokit.
|
|
428
|
+
await octokit.git.updateRef({
|
|
422
429
|
owner,
|
|
423
430
|
repo,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
431
|
+
ref: `heads/${featBranch}`,
|
|
432
|
+
sha: mainSha,
|
|
433
|
+
force: true, // Force update since feat branch may have diverged
|
|
427
434
|
});
|
|
428
435
|
if (verbose) {
|
|
429
|
-
logInfo(`✅ Successfully synced ${featBranch}
|
|
436
|
+
logInfo(`✅ Successfully synced ${featBranch} to ${baseBranch} (${mainSha.substring(0, 7)})`);
|
|
430
437
|
}
|
|
431
438
|
}
|
|
432
|
-
catch (
|
|
433
|
-
//
|
|
434
|
-
if (
|
|
435
|
-
if (verbose) {
|
|
436
|
-
logInfo(`ℹ️ ${featBranch} is already up to date with ${baseBranch}`);
|
|
437
|
-
}
|
|
438
|
-
return true;
|
|
439
|
-
}
|
|
440
|
-
// 404 means branch doesn't exist (shouldn't happen since we checked above)
|
|
441
|
-
if (mergeError.status === 404) {
|
|
439
|
+
catch (updateError) {
|
|
440
|
+
// 422 means the ref doesn't exist or other validation error
|
|
441
|
+
if (updateError.status === 422 || updateError.status === 404) {
|
|
442
442
|
if (verbose) {
|
|
443
|
-
logInfo(`ℹ️ ${featBranch}
|
|
443
|
+
logInfo(`ℹ️ Could not update ${featBranch} ref, skipping sync`);
|
|
444
444
|
}
|
|
445
445
|
return true;
|
|
446
446
|
}
|
|
447
|
-
throw
|
|
447
|
+
throw updateError;
|
|
448
448
|
}
|
|
449
449
|
return true;
|
|
450
450
|
}
|