@@ -1692,8 +1692,7 @@ int cmd_main(int argc, const char **argv)
1692
1692
{
1693
1693
struct transfer_request * request ;
1694
1694
struct transfer_request * next_request ;
1695
- int nr_refspec = 0 ;
1696
- const char * * refspec = NULL ;
1695
+ struct refspec rs = REFSPEC_INIT_PUSH ;
1697
1696
struct remote_lock * ref_lock = NULL ;
1698
1697
struct remote_lock * info_ref_lock = NULL ;
1699
1698
struct rev_info revs ;
@@ -1756,8 +1755,7 @@ int cmd_main(int argc, const char **argv)
1756
1755
}
1757
1756
continue ;
1758
1757
}
1759
- refspec = argv ;
1760
- nr_refspec = argc - i ;
1758
+ refspec_appendn (& rs , argv , argc - i );
1761
1759
break ;
1762
1760
}
1763
1761
@@ -1768,7 +1766,7 @@ int cmd_main(int argc, const char **argv)
1768
1766
if (!repo -> url )
1769
1767
usage (http_push_usage );
1770
1768
1771
- if (delete_branch && nr_refspec != 1 )
1769
+ if (delete_branch && rs . nr != 1 )
1772
1770
die ("You must specify only one branch name when deleting a remote branch" );
1773
1771
1774
1772
setup_git_directory ();
@@ -1814,18 +1812,19 @@ int cmd_main(int argc, const char **argv)
1814
1812
1815
1813
/* Remove a remote branch if -d or -D was specified */
1816
1814
if (delete_branch ) {
1817
- if (delete_remote_branch (refspec [0 ], force_delete ) == -1 ) {
1815
+ const char * branch = rs .items [i ].src ;
1816
+ if (delete_remote_branch (branch , force_delete ) == -1 ) {
1818
1817
fprintf (stderr , "Unable to delete remote branch %s\n" ,
1819
- refspec [ 0 ] );
1818
+ branch );
1820
1819
if (helper_status )
1821
- printf ("error %s cannot remove\n" , refspec [ 0 ] );
1820
+ printf ("error %s cannot remove\n" , branch );
1822
1821
}
1823
1822
goto cleanup ;
1824
1823
}
1825
1824
1826
1825
/* match them up */
1827
1826
if (match_push_refs (local_refs , & remote_refs ,
1828
- nr_refspec , ( const char * * ) refspec , push_all )) {
1827
+ rs . raw_nr , rs . raw , push_all )) {
1829
1828
rc = -1 ;
1830
1829
goto cleanup ;
1831
1830
}
0 commit comments