From 6006bcb85ef40a2cb90c50f619831e5b07d0ceb1 Mon Sep 17 00:00:00 2001 From: chyoo Date: Tue, 7 Jul 2026 18:09:14 +0900 Subject: [PATCH] resolve release promotion unrelated-history conflicts by taking source side --- src/apps/apps.service.ts | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/apps/apps.service.ts b/src/apps/apps.service.ts index 120477a..2a5e26b 100644 --- a/src/apps/apps.service.ts +++ b/src/apps/apps.service.ts @@ -724,16 +724,7 @@ export class AppsService { commitSha, ], { cwd: workDir }); } catch { - await execFileAsync(gitBin, [ - ...mergeOptions, - 'merge', - '--allow-unrelated-histories', - '--no-ff', - '--no-edit', - '-X', - 'theirs', - commitSha, - ], { cwd: workDir }); + await this.resolveReleaseMergeByTakingSourceOnConflict(gitBin, workDir, mergeOptions, commitSha, repository); } } } else { @@ -759,6 +750,27 @@ export class AppsService { } } + private async resolveReleaseMergeByTakingSourceOnConflict( + gitBin: string, + workDir: string, + mergeOptions: string[], + commitSha: string, + repository: string, + ) { + await execFileAsync(gitBin, [ + ...mergeOptions, + 'merge', + '--allow-unrelated-histories', + '--no-ff', + '--no-edit', + '--no-commit', + commitSha, + ], { cwd: workDir }); + await execFileAsync(gitBin, ['checkout', '--theirs', '.'], { cwd: workDir }); + await execFileAsync(gitBin, ['add', '-A'], { cwd: workDir }); + await execFileAsync(gitBin, ['commit', '--allow-empty', '-m', `${repository} release promotion merge`], { cwd: workDir }); + } + private getHttpCloneUrl(repository: string) { return `${this.configService .get('GITEA_BASE_URL', 'http://localhost:3000')