feat: add source control action to abort merge (#2092)

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: brennanb2025 <brennankbenson@gmail.com>
This commit is contained in:
Leynier Gutiérrez González
2026-05-27 14:59:23 -07:00
committed by GitHub
co-authored by Orca brennanb2025
parent a65f7b4216
commit 659fe79226
25 changed files with 478 additions and 7 deletions
+15
View File
@@ -38,6 +38,7 @@ vi.mock('fs', () => ({
}))
import {
abortMerge,
bulkStageFiles,
bulkDiscardChanges,
bulkUnstageFiles,
@@ -647,6 +648,20 @@ describe('getStatus', () => {
})
})
describe('abortMerge', () => {
beforeEach(() => {
gitExecFileAsyncMock.mockReset()
})
it('runs git merge --abort in the worktree', async () => {
gitExecFileAsyncMock.mockResolvedValueOnce({ stdout: '' })
await abortMerge('/repo')
expect(gitExecFileAsyncMock).toHaveBeenCalledWith(['merge', '--abort'], { cwd: '/repo' })
})
})
describe('getStagedCommitContext', () => {
beforeEach(() => {
gitExecFileAsyncMock.mockReset()
+4
View File
@@ -459,6 +459,10 @@ export async function detectConflictOperation(worktreePath: string): Promise<Git
return 'unknown'
}
export async function abortMerge(worktreePath: string): Promise<void> {
await gitExecFileAsync(['merge', '--abort'], { cwd: worktreePath })
}
export async function resolveGitDir(worktreePath: string): Promise<string> {
const dotGitPath = path.join(worktreePath, '.git')