@@ -1692,8 +1692,7 @@ int cmd_main(int argc, const char **argv)
16921692{
16931693 struct transfer_request * request ;
16941694 struct transfer_request * next_request ;
1695- int nr_refspec = 0 ;
1696- const char * * refspec = NULL ;
1695+ struct refspec rs = REFSPEC_INIT_PUSH ;
16971696 struct remote_lock * ref_lock = NULL ;
16981697 struct remote_lock * info_ref_lock = NULL ;
16991698 struct rev_info revs ;
@@ -1756,8 +1755,7 @@ int cmd_main(int argc, const char **argv)
17561755 }
17571756 continue ;
17581757 }
1759- refspec = argv ;
1760- nr_refspec = argc - i ;
1758+ refspec_appendn (& rs , argv , argc - i );
17611759 break ;
17621760 }
17631761
@@ -1768,7 +1766,7 @@ int cmd_main(int argc, const char **argv)
17681766 if (!repo -> url )
17691767 usage (http_push_usage );
17701768
1771- if (delete_branch && nr_refspec != 1 )
1769+ if (delete_branch && rs . nr != 1 )
17721770 die ("You must specify only one branch name when deleting a remote branch" );
17731771
17741772 setup_git_directory ();
@@ -1814,18 +1812,19 @@ int cmd_main(int argc, const char **argv)
18141812
18151813 /* Remove a remote branch if -d or -D was specified */
18161814 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 ) {
18181817 fprintf (stderr , "Unable to delete remote branch %s\n" ,
1819- refspec [ 0 ] );
1818+ branch );
18201819 if (helper_status )
1821- printf ("error %s cannot remove\n" , refspec [ 0 ] );
1820+ printf ("error %s cannot remove\n" , branch );
18221821 }
18231822 goto cleanup ;
18241823 }
18251824
18261825 /* match them up */
18271826 if (match_push_refs (local_refs , & remote_refs ,
1828- nr_refspec , ( const char * * ) refspec , push_all )) {
1827+ rs . raw_nr , rs . raw , push_all )) {
18291828 rc = -1 ;
18301829 goto cleanup ;
18311830 }
0 commit comments