* Fast-forward merge to latest origin/ after checkout. * Best-effort operation for existing branches that may be behind origin.
(
workspacePath: string,
trunkBranch: string,
initLogger: InitLogger,
noHooksEnv: GitExecOptions
)
| 336 | * Best-effort operation for existing branches that may be behind origin. |
| 337 | */ |
| 338 | private async fastForwardToOrigin( |
| 339 | workspacePath: string, |
| 340 | trunkBranch: string, |
| 341 | initLogger: InitLogger, |
| 342 | noHooksEnv: GitExecOptions |
| 343 | ): Promise<void> { |
| 344 | try { |
| 345 | initLogger.logStep("Fast-forward merging..."); |
| 346 | |
| 347 | using mergeProc = execFileAsync( |
| 348 | "git", |
| 349 | ["-C", workspacePath, "merge", "--ff-only", `origin/${trunkBranch}`], |
| 350 | noHooksEnv |
| 351 | ); |
| 352 | await mergeProc.result; |
| 353 | initLogger.logStep("Fast-forwarded to latest origin successfully"); |
| 354 | } catch (mergeError) { |
| 355 | if (isAbortError(mergeError, noHooksEnv?.signal)) { |
| 356 | throw mergeError; |
| 357 | } |
| 358 | // Fast-forward not possible (diverged branches) - just warn |
| 359 | const errorMsg = getErrorMessage(mergeError); |
| 360 | initLogger.logStderr(`Note: Fast-forward failed (${errorMsg}), using local branch state`); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | async renameWorkspace( |
| 365 | projectPath: string, |
no test coverage detected