@@ -1442,10 +1442,8 @@ static int rename_fetch_refspecs(
1442
1442
if (spec -> push )
1443
1443
continue ;
1444
1444
1445
- /* Every refspec is a problem refspec for an anonymous remote, OR */
1446
1445
/* Does the dst part of the refspec follow the expected format? */
1447
- if (!remote -> name ||
1448
- strcmp (git_buf_cstr (& base ), spec -> string )) {
1446
+ if (strcmp (git_buf_cstr (& base ), spec -> string )) {
1449
1447
1450
1448
if ((error = callback (spec -> string , payload )) != 0 ) {
1451
1449
giterr_set_after_callback (error );
@@ -1497,49 +1495,20 @@ int git_remote_rename(
1497
1495
if ((error = ensure_remote_name_is_valid (new_name )) < 0 )
1498
1496
return error ;
1499
1497
1500
- if (remote -> repo ) {
1501
- if ((error = ensure_remote_doesnot_exist (remote -> repo , new_name )) < 0 )
1502
- return error ;
1498
+ if ((error = ensure_remote_doesnot_exist (remote -> repo , new_name )) < 0 )
1499
+ return error ;
1503
1500
1504
- if (!remote -> name ) {
1505
- if ((error = rename_fetch_refspecs (
1506
- remote ,
1507
- new_name ,
1508
- callback ,
1509
- payload )) < 0 )
1510
- return error ;
1501
+ if ((error = rename_remote_config_section (remote -> repo , remote -> name , new_name )) < 0 )
1502
+ return error ;
1511
1503
1512
- remote -> name = git__strdup ( new_name );
1513
- GITERR_CHECK_ALLOC ( remote -> name ) ;
1504
+ if (( error = update_branch_remote_config_entry ( remote -> repo , remote -> name , new_name )) < 0 )
1505
+ return error ;
1514
1506
1515
- return git_remote_save ( remote );
1516
- }
1507
+ if (( error = rename_remote_references ( remote -> repo , remote -> name , new_name )) < 0 )
1508
+ return error ;
1517
1509
1518
- if ((error = rename_remote_config_section (
1519
- remote -> repo ,
1520
- remote -> name ,
1521
- new_name )) < 0 )
1522
- return error ;
1523
-
1524
- if ((error = update_branch_remote_config_entry (
1525
- remote -> repo ,
1526
- remote -> name ,
1527
- new_name )) < 0 )
1528
- return error ;
1529
-
1530
- if ((error = rename_remote_references (
1531
- remote -> repo ,
1532
- remote -> name ,
1533
- new_name )) < 0 )
1534
- return error ;
1535
-
1536
- if ((error = rename_fetch_refspecs (
1537
- remote ,
1538
- new_name ,
1539
- callback ,
1540
- payload )) < 0 )
1541
- return error ;
1542
- }
1510
+ if ((error = rename_fetch_refspecs (remote , new_name , callback , payload )) < 0 )
1511
+ return error ;
1543
1512
1544
1513
git__free (remote -> name );
1545
1514
0 commit comments