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