@@ -1255,25 +1255,25 @@ export class LocalGitProvider implements GitProvider, Disposable {
12551255 }
12561256
12571257 @log ( )
1258- createBranch ( repoPath : string , name : string , ref : string ) : Promise < void > {
1258+ async createBranch ( repoPath : string , name : string , ref : string ) : Promise < void > {
12591259 try {
1260- return void this . git . branch ( repoPath , name , ref ) ;
1260+ await this . git . branch ( repoPath , name , ref ) ;
12611261 } catch ( ex ) {
12621262 if ( ex instanceof BranchError ) {
1263- throw ex . WithBranch ( branch . name ) ;
1263+ throw ex . WithBranch ( name ) ;
12641264 }
12651265
12661266 throw ex ;
12671267 }
12681268 }
12691269
12701270 @log ( )
1271- renameBranch ( repoPath : string , oldName : string , newName : string ) : Promise < void > {
1271+ async renameBranch ( repoPath : string , oldName : string , newName : string ) : Promise < void > {
12721272 try {
1273- return void this . git . branch ( repoPath , '-m' , oldName , newName ) ;
1273+ await this . git . branch ( repoPath , '-m' , oldName , newName ) ;
12741274 } catch ( ex ) {
12751275 if ( ex instanceof BranchError ) {
1276- throw ex . WithBranch ( branch . name ) ;
1276+ throw ex . WithBranch ( oldName ) ;
12771277 }
12781278
12791279 throw ex ;
@@ -1308,7 +1308,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
13081308 }
13091309
13101310 const remote = getRemoteNameFromBranchName ( branch . upstream . name ) ;
1311- remoteCommit = await this . git . rev_list ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , {
1311+ const remoteCommit = await this . git . rev_list ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , {
13121312 maxResults : 1 ,
13131313 } ) ;
13141314
@@ -1318,8 +1318,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
13181318 await this . git . branch ( repoPath , ...args , branch . ref ) ;
13191319 } catch ( ex ) {
13201320 // If it fails, restore the remote branch
1321- await this . git . update_ref ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , commit ) ;
1322- await this . git . branch__set_upstream ( repoPath , branch , remote , branch ) ;
1321+ await this . git . update_ref ( repoPath , `refs/remotes/${ remote } /${ branch . ref } ` , remoteCommit ?. [ 0 ] ?? '' ) ;
1322+ await this . git . branch__set_upstream ( repoPath , branch . name , remote , branch . ref ) ;
13231323 throw ex ;
13241324 }
13251325
0 commit comments