@@ -1253,25 +1253,25 @@ export class LocalGitProvider implements GitProvider, Disposable {
12531253 }
12541254
12551255 @log ( )
1256- createBranch ( repoPath : string , name : string , ref : string ) : Promise < void > {
1256+ async createBranch ( repoPath : string , name : string , ref : string ) : Promise < void > {
12571257 try {
1258- return void this . git . branch ( repoPath , name , ref ) ;
1258+ await this . git . branch ( repoPath , name , ref ) ;
12591259 } catch ( ex ) {
12601260 if ( ex instanceof BranchError ) {
1261- throw ex . WithBranch ( branch . name ) ;
1261+ throw ex . WithBranch ( name ) ;
12621262 }
12631263
12641264 throw ex ;
12651265 }
12661266 }
12671267
12681268 @log ( )
1269- renameBranch ( repoPath : string , oldName : string , newName : string ) : Promise < void > {
1269+ async renameBranch ( repoPath : string , oldName : string , newName : string ) : Promise < void > {
12701270 try {
1271- return void this . git . branch ( repoPath , '-m' , oldName , newName ) ;
1271+ await this . git . branch ( repoPath , '-m' , oldName , newName ) ;
12721272 } catch ( ex ) {
12731273 if ( ex instanceof BranchError ) {
1274- throw ex . WithBranch ( branch . name ) ;
1274+ throw ex . WithBranch ( oldName ) ;
12751275 }
12761276
12771277 throw ex ;
@@ -1306,7 +1306,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
13061306 }
13071307
13081308 const remote = getRemoteNameFromBranchName ( branch . upstream . name ) ;
1309- remoteCommit = await this . git . rev_list ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , {
1309+ const remoteCommit = await this . git . rev_list ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , {
13101310 maxResults : 1 ,
13111311 } ) ;
13121312
@@ -1316,8 +1316,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
13161316 await this . git . branch ( repoPath , ...args , branch . ref ) ;
13171317 } catch ( ex ) {
13181318 // If it fails, restore the remote branch
1319- await this . git . update_ref ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , commit ) ;
1320- await this . git . branch__set_upstream ( repoPath , branch , remote , branch ) ;
1319+ await this . git . update_ref ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , remoteCommit ?. [ 0 ] ?? '' ) ;
1320+ await this . git . branch__set_upstream ( repoPath , branch . name , remote , branch . ref ) ;
13211321 throw ex ;
13221322 }
13231323
0 commit comments