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')