@@ -3,6 +3,7 @@ import { showError, showToast } from '$lib/notifications/toasts';
33import * as toasts from '$lib/utils/toasts' ;
44import posthog from 'posthog-js' ;
55import type { BaseBranchService } from '$lib/baseBranch/baseBranchService' ;
6+ import type { BranchListingService } from '$lib/branches/branchListing' ;
67import type { RemoteBranchService } from '$lib/stores/remoteBranches' ;
78import type { BranchPushResult , ForgeIdentifier , Hunk , LocalFile , StackOrder } from './types' ;
89import type { VirtualBranchService } from './virtualBranch' ;
@@ -14,7 +15,8 @@ export class BranchController {
1415 readonly projectId : string ,
1516 readonly vbranchService : VirtualBranchService ,
1617 readonly remoteBranchService : RemoteBranchService ,
17- readonly baseBranchService : BaseBranchService
18+ readonly baseBranchService : BaseBranchService ,
19+ private readonly branchListingService : BranchListingService
1820 ) { }
1921
2022 async setTarget ( branch : string , pushRemote : string | undefined = undefined ) {
@@ -51,19 +53,21 @@ export class BranchController {
5153 }
5254
5355 async commitBranch (
54- branch : string ,
56+ branchId : string ,
57+ branchName : string ,
5558 message : string ,
5659 ownership : string | undefined = undefined ,
5760 runHooks = false
5861 ) {
5962 try {
6063 await invoke < void > ( 'commit_virtual_branch' , {
6164 projectId : this . projectId ,
62- branch,
65+ branch : branchId ,
6366 message,
6467 ownership,
6568 runHooks : runHooks
6669 } ) ;
70+ this . branchListingService . refreshBranchListingDetails ( branchName ) ;
6771 posthog . capture ( 'Commit Successful' ) ;
6872 } catch ( err : any ) {
6973 if ( err . code === 'errors.commit.signing_failed' ) {
@@ -543,13 +547,14 @@ export class BranchController {
543547 }
544548 }
545549
546- async undoCommit ( branchId : string , commitOid : string ) {
550+ async undoCommit ( branchId : string , branchName : string , commitOid : string ) {
547551 try {
548552 await invoke < void > ( 'undo_commit' , {
549553 projectId : this . projectId ,
550554 branchId,
551555 commitOid
552556 } ) ;
557+ this . branchListingService . refreshBranchListingDetails ( branchName ) ;
553558 } catch ( err : any ) {
554559 showError ( 'Failed to amend commit' , err ) ;
555560 }
0 commit comments