@@ -547,53 +547,6 @@ static int lookup_remote_prune_config(git_remote *remote, git_config *config, co
547547 return error ;
548548}
549549
550- static int update_config_refspec (const git_remote * remote , git_config * config , int direction )
551- {
552- git_buf name = GIT_BUF_INIT ;
553- unsigned int push ;
554- const char * dir ;
555- size_t i ;
556- int error = 0 ;
557- const char * cname ;
558-
559- push = direction == GIT_DIRECTION_PUSH ;
560- dir = push ? "push" : "fetch" ;
561-
562- if (git_buf_printf (& name , "remote.%s.%s" , remote -> name , dir ) < 0 )
563- return -1 ;
564- cname = git_buf_cstr (& name );
565-
566- /* Clear out the existing config */
567- while (!error )
568- error = git_config_delete_multivar (config , cname , ".*" );
569-
570- if (error != GIT_ENOTFOUND )
571- return error ;
572-
573- for (i = 0 ; i < remote -> refspecs .length ; i ++ ) {
574- git_refspec * spec = git_vector_get (& remote -> refspecs , i );
575-
576- if (spec -> push != push )
577- continue ;
578-
579- // "$^" is a unmatcheable regexp: it will not match anything at all, so
580- // all values will be considered new and we will not replace any
581- // present value.
582- if ((error = git_config_set_multivar (
583- config , cname , "$^" , spec -> string )) < 0 ) {
584- goto cleanup ;
585- }
586- }
587-
588- giterr_clear ();
589- error = 0 ;
590-
591- cleanup :
592- git_buf_free (& name );
593-
594- return error ;
595- }
596-
597550const char * git_remote_name (const git_remote * remote )
598551{
599552 assert (remote );
@@ -2103,34 +2056,6 @@ int git_remote_add_push(git_repository *repo, const char *remote, const char *re
21032056 return write_add_refspec (repo , remote , refspec , false);
21042057}
21052058
2106- static int set_refspecs (git_remote * remote , git_strarray * array , int push )
2107- {
2108- git_vector * vec = & remote -> refspecs ;
2109- git_refspec * spec ;
2110- size_t i ;
2111-
2112- /* Start by removing any refspecs of the same type */
2113- for (i = 0 ; i < vec -> length ; i ++ ) {
2114- spec = git_vector_get (vec , i );
2115- if (spec -> push != push )
2116- continue ;
2117-
2118- git_refspec__free (spec );
2119- git__free (spec );
2120- git_vector_remove (vec , i );
2121- i -- ;
2122- }
2123-
2124- /* And now we add the new ones */
2125-
2126- for (i = 0 ; i < array -> count ; i ++ ) {
2127- if (add_refspec (remote , array -> strings [i ], !push ) < 0 )
2128- return -1 ;
2129- }
2130-
2131- return 0 ;
2132- }
2133-
21342059static int copy_refspecs (git_strarray * array , const git_remote * remote , unsigned int push )
21352060{
21362061 size_t i ;
0 commit comments