@@ -1255,25 +1255,25 @@ export class LocalGitProvider implements GitProvider, Disposable {
1255
1255
}
1256
1256
1257
1257
@log ( )
1258
- createBranch ( repoPath : string , name : string , ref : string ) : Promise < void > {
1258
+ async createBranch ( repoPath : string , name : string , ref : string ) : Promise < void > {
1259
1259
try {
1260
- return void this . git . branch ( repoPath , name , ref ) ;
1260
+ await this . git . branch ( repoPath , name , ref ) ;
1261
1261
} catch ( ex ) {
1262
1262
if ( ex instanceof BranchError ) {
1263
- throw ex . WithBranch ( branch . name ) ;
1263
+ throw ex . WithBranch ( name ) ;
1264
1264
}
1265
1265
1266
1266
throw ex ;
1267
1267
}
1268
1268
}
1269
1269
1270
1270
@log ( )
1271
- renameBranch ( repoPath : string , oldName : string , newName : string ) : Promise < void > {
1271
+ async renameBranch ( repoPath : string , oldName : string , newName : string ) : Promise < void > {
1272
1272
try {
1273
- return void this . git . branch ( repoPath , '-m' , oldName , newName ) ;
1273
+ await this . git . branch ( repoPath , '-m' , oldName , newName ) ;
1274
1274
} catch ( ex ) {
1275
1275
if ( ex instanceof BranchError ) {
1276
- throw ex . WithBranch ( branch . name ) ;
1276
+ throw ex . WithBranch ( oldName ) ;
1277
1277
}
1278
1278
1279
1279
throw ex ;
@@ -1308,7 +1308,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
1308
1308
}
1309
1309
1310
1310
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 } ` , {
1312
1312
maxResults : 1 ,
1313
1313
} ) ;
1314
1314
@@ -1318,8 +1318,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
1318
1318
await this . git . branch ( repoPath , ...args , branch . ref ) ;
1319
1319
} catch ( ex ) {
1320
1320
// 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 ) ;
1323
1323
throw ex ;
1324
1324
}
1325
1325
0 commit comments