Add progress indicator to conflict resolution
This commit is contained in:
parent
53a426778d
commit
90bb8da28e
|
|
@ -85,10 +85,11 @@ export async function teardownSession(root: string, branch: string, worktree: st
|
|||
export async function resolveConflicts(
|
||||
files: string[],
|
||||
cwd: string,
|
||||
onFile: (file: string) => void,
|
||||
onFile: (file: string, index: number, total: number) => void,
|
||||
): Promise<void> {
|
||||
for (const file of files) {
|
||||
onFile(file)
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i]
|
||||
onFile(file, i + 1, files.length)
|
||||
const content = await Bun.file(join(cwd, file)).text()
|
||||
|
||||
const resolved = await vm.claudePipe(
|
||||
|
|
@ -142,7 +143,9 @@ export async function mergeAndClose(branch: string, opts?: { squash?: boolean; f
|
|||
try {
|
||||
await vm.ensure((msg) => { spin.text = msg })
|
||||
if (session) await vm.setActivity(session.worktree, branch)
|
||||
await resolveConflicts(conflicts, root, (file) => { spin.text = `Resolving ${file}` })
|
||||
await resolveConflicts(conflicts, root, (file, i, total) => {
|
||||
spin.text = total > 1 ? `(${i}/${total}) Resolving ${file}` : `Resolving ${file}`
|
||||
})
|
||||
|
||||
if (opts?.squash) {
|
||||
await squashCommit(branch, root)
|
||||
|
|
|
|||
|
|
@ -41,8 +41,10 @@ export async function action(branch: string) {
|
|||
throw new Error(`Exceeded ${MAX_REBASE_ROUNDS} conflict resolution rounds — aborting rebase`)
|
||||
}
|
||||
|
||||
await resolveConflicts(conflicts, worktree, (file) => {
|
||||
resolveSpin.text = `Resolving ${file} (round ${round})`
|
||||
await resolveConflicts(conflicts, worktree, (file, i, total) => {
|
||||
resolveSpin.text = total > 1
|
||||
? `(${i}/${total}) Resolving ${file} (round ${round})`
|
||||
: `Resolving ${file} (round ${round})`
|
||||
})
|
||||
|
||||
conflicts = await git.rebaseContinue(worktree)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user