@@ -36,8 +36,7 @@ static int use_done_feature;
36
36
static int no_data ;
37
37
static int full_tree ;
38
38
static struct string_list extra_refs = STRING_LIST_INIT_NODUP ;
39
- static struct refspec_item * refspecs ;
40
- static int refspecs_nr ;
39
+ static struct refspec refspecs = REFSPEC_INIT_FETCH ;
41
40
static int anonymize ;
42
41
43
42
static int parse_opt_signed_tag_mode (const struct option * opt ,
@@ -830,9 +829,9 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
830
829
if (dwim_ref (e -> name , strlen (e -> name ), & oid , & full_name ) != 1 )
831
830
continue ;
832
831
833
- if (refspecs ) {
832
+ if (refspecs . nr ) {
834
833
char * private ;
835
- private = apply_refspecs (refspecs , refspecs_nr , full_name );
834
+ private = apply_refspecs (refspecs . items , refspecs . nr , full_name );
836
835
if (private ) {
837
836
free (full_name );
838
837
full_name = private ;
@@ -978,8 +977,8 @@ static void import_marks(char *input_file)
978
977
static void handle_deletes (void )
979
978
{
980
979
int i ;
981
- for (i = 0 ; i < refspecs_nr ; i ++ ) {
982
- struct refspec_item * refspec = & refspecs [i ];
980
+ for (i = 0 ; i < refspecs . nr ; i ++ ) {
981
+ struct refspec_item * refspec = & refspecs . items [i ];
983
982
if (* refspec -> src )
984
983
continue ;
985
984
@@ -1040,18 +1039,12 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
1040
1039
usage_with_options (fast_export_usage , options );
1041
1040
1042
1041
if (refspecs_list .nr ) {
1043
- const char * * refspecs_str ;
1044
1042
int i ;
1045
1043
1046
- ALLOC_ARRAY (refspecs_str , refspecs_list .nr );
1047
1044
for (i = 0 ; i < refspecs_list .nr ; i ++ )
1048
- refspecs_str [i ] = refspecs_list .items [i ].string ;
1049
-
1050
- refspecs_nr = refspecs_list .nr ;
1051
- refspecs = parse_fetch_refspec (refspecs_nr , refspecs_str );
1045
+ refspec_append (& refspecs , refspecs_list .items [i ].string );
1052
1046
1053
1047
string_list_clear (& refspecs_list , 1 );
1054
- free (refspecs_str );
1055
1048
}
1056
1049
1057
1050
if (use_done_feature )
@@ -1090,7 +1083,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
1090
1083
if (use_done_feature )
1091
1084
printf ("done\n" );
1092
1085
1093
- free_refspec ( refspecs_nr , refspecs );
1086
+ refspec_clear ( & refspecs );
1094
1087
1095
1088
return 0 ;
1096
1089
}
0 commit comments