@@ -178,7 +178,6 @@ static const char tag_template_nocleanup[] =
178178static int git_tag_config (const char * var , const char * value , void * cb )
179179{
180180 int status ;
181- struct ref_sorting * * sorting_tail = (struct ref_sorting * * )cb ;
182181
183182 if (!strcmp (var , "tag.gpgsign" )) {
184183 config_sign_tag = git_config_bool (var , value );
@@ -188,7 +187,7 @@ static int git_tag_config(const char *var, const char *value, void *cb)
188187 if (!strcmp (var , "tag.sort" )) {
189188 if (!value )
190189 return config_error_nonbool (var );
191- parse_ref_sorting ( sorting_tail , value );
190+ string_list_append ( cb , value );
192191 return 0 ;
193192 }
194193
@@ -436,7 +435,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
436435 struct ref_transaction * transaction ;
437436 struct strbuf err = STRBUF_INIT ;
438437 struct ref_filter filter ;
439- static struct ref_sorting * sorting = NULL , * * sorting_tail = & sorting ;
438+ struct ref_sorting * sorting ;
439+ struct string_list sorting_options = STRING_LIST_INIT_DUP ;
440440 struct ref_format format = REF_FORMAT_INIT ;
441441 int icase = 0 ;
442442 int edit_flag = 0 ;
@@ -470,7 +470,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
470470 OPT_WITHOUT (& filter .no_commit , N_ ("print only tags that don't contain the commit" )),
471471 OPT_MERGED (& filter , N_ ("print only tags that are merged" )),
472472 OPT_NO_MERGED (& filter , N_ ("print only tags that are not merged" )),
473- OPT_REF_SORT (sorting_tail ),
473+ OPT_REF_SORT (& sorting_options ),
474474 {
475475 OPTION_CALLBACK , 0 , "points-at" , & filter .points_at , N_ ("object" ),
476476 N_ ("print only tags of the object" ), PARSE_OPT_LASTARG_DEFAULT ,
@@ -486,7 +486,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
486486
487487 setup_ref_filter_porcelain_msg ();
488488
489- git_config (git_tag_config , sorting_tail );
489+ git_config (git_tag_config , & sorting_options );
490490
491491 memset (& opt , 0 , sizeof (opt ));
492492 memset (& filter , 0 , sizeof (filter ));
@@ -525,8 +525,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
525525 die (_ ("--column and -n are incompatible" ));
526526 colopts = 0 ;
527527 }
528- if (!sorting )
529- sorting = ref_default_sorting ();
528+ sorting = ref_sorting_options (& sorting_options );
530529 ref_sorting_set_sort_flags_all (sorting , REF_SORTING_ICASE , icase );
531530 filter .ignore_case = icase ;
532531 if (cmdmode == 'l' ) {
0 commit comments