File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,8 +131,9 @@ export class PullRequestViewProvider extends WebviewViewBase implements vscode.W
131131 try {
132132 const defaultBranch = await this . _folderRepositoryManager . getPullRequestRepositoryDefaultBranch ( this . _item ) ;
133133 const prBranch = this . _folderRepositoryManager . repository . state . HEAD ?. name ;
134- const shouldPopStash = this . _folderRepositoryManager . stashedOnCheckout ;
135134 await this . _folderRepositoryManager . checkoutDefaultBranch ( defaultBranch ) ;
135+ // Check if we should pop the stash after successful checkout
136+ const shouldPopStash = this . _folderRepositoryManager . stashedOnCheckout ;
136137 if ( shouldPopStash ) {
137138 try {
138139 Logger . appendLine ( 'Popping stash after returning to default branch' , 'ActivityBarViewProvider' ) ;
Original file line number Diff line number Diff line change @@ -652,8 +652,9 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
652652 private async checkoutDefaultBranch ( message : IRequestMessage < string > ) : Promise < void > {
653653 try {
654654 const prBranch = this . _folderRepositoryManager . repository . state . HEAD ?. name ;
655- const shouldPopStash = this . _folderRepositoryManager . stashedOnCheckout ;
656655 await this . _folderRepositoryManager . checkoutDefaultBranch ( message . args ) ;
656+ // Check if we should pop the stash after successful checkout
657+ const shouldPopStash = this . _folderRepositoryManager . stashedOnCheckout ;
657658 if ( shouldPopStash ) {
658659 try {
659660 Logger . appendLine ( 'Popping stash after returning to default branch' , PullRequestOverviewPanel . ID ) ;
Original file line number Diff line number Diff line change @@ -1100,13 +1100,10 @@ export class ReviewManager extends Disposable {
11001100 if ( hasChanges ) {
11011101 try {
11021102 Logger . appendLine ( 'Auto-stashing changes before PR checkout' , this . id ) ;
1103- // Add all tracked changes to staging area
1104- const allChangedFiles = [
1105- ...workingTreeChanges . map ( change => change . uri . fsPath ) ,
1106- ...indexChanges . map ( change => change . uri . fsPath ) ,
1107- ] ;
1108- if ( allChangedFiles . length > 0 ) {
1109- await this . _repository . add ( allChangedFiles ) ;
1103+ // Add only working tree changes to staging area (indexChanges are already staged)
1104+ if ( workingTreeChanges . length > 0 ) {
1105+ const workingTreeFiles = workingTreeChanges . map ( change => change . uri . fsPath ) ;
1106+ await this . _repository . add ( workingTreeFiles ) ;
11101107 }
11111108 // Stash the changes
11121109 await vscode . commands . executeCommand ( 'git.stash' , this . _repository ) ;
You can’t perform that action at this time.
0 commit comments