@@ -207,7 +207,7 @@ static void filter_spec_append_urlencode(
207
207
struct strbuf buf = STRBUF_INIT ;
208
208
strbuf_addstr_urlencode (& buf , raw , allow_unencoded );
209
209
trace_printf ("Add to combine filter-spec: %s\n" , buf .buf );
210
- string_list_append (& filter -> filter_spec , strbuf_detach (& buf , NULL ));
210
+ string_list_append_nodup (& filter -> filter_spec , strbuf_detach (& buf , NULL ));
211
211
}
212
212
213
213
/*
@@ -226,12 +226,13 @@ static void transform_to_combine_type(
226
226
xcalloc (initial_sub_alloc , sizeof (* sub_array ));
227
227
sub_array [0 ] = * filter_options ;
228
228
memset (filter_options , 0 , sizeof (* filter_options ));
229
+ string_list_init_dup (& filter_options -> filter_spec );
229
230
filter_options -> sub = sub_array ;
230
231
filter_options -> sub_alloc = initial_sub_alloc ;
231
232
}
232
233
filter_options -> sub_nr = 1 ;
233
234
filter_options -> choice = LOFC_COMBINE ;
234
- string_list_append (& filter_options -> filter_spec , xstrdup ( "combine:" ) );
235
+ string_list_append (& filter_options -> filter_spec , "combine:" );
235
236
filter_spec_append_urlencode (
236
237
filter_options ,
237
238
list_objects_filter_spec (& filter_options -> sub [0 ]));
@@ -256,8 +257,14 @@ void parse_list_objects_filter(
256
257
struct strbuf errbuf = STRBUF_INIT ;
257
258
int parse_error ;
258
259
260
+ if (!filter_options -> filter_spec .strdup_strings ) {
261
+ if (filter_options -> filter_spec .nr )
262
+ BUG ("unexpected non-allocated string in filter_spec" );
263
+ filter_options -> filter_spec .strdup_strings = 1 ;
264
+ }
265
+
259
266
if (!filter_options -> choice ) {
260
- string_list_append (& filter_options -> filter_spec , xstrdup ( arg ) );
267
+ string_list_append (& filter_options -> filter_spec , arg );
261
268
262
269
parse_error = gently_parse_list_objects_filter (
263
270
filter_options , arg , & errbuf );
@@ -268,7 +275,7 @@ void parse_list_objects_filter(
268
275
*/
269
276
transform_to_combine_type (filter_options );
270
277
271
- string_list_append (& filter_options -> filter_spec , xstrdup ( "+" ) );
278
+ string_list_append (& filter_options -> filter_spec , "+" );
272
279
filter_spec_append_urlencode (filter_options , arg );
273
280
ALLOC_GROW_BY (filter_options -> sub , filter_options -> sub_nr , 1 ,
274
281
filter_options -> sub_alloc );
@@ -306,7 +313,7 @@ const char *list_objects_filter_spec(struct list_objects_filter_options *filter)
306
313
strbuf_add_separated_string_list (
307
314
& concatted , "" , & filter -> filter_spec );
308
315
string_list_clear (& filter -> filter_spec , /*free_util=*/ 0 );
309
- string_list_append (
316
+ string_list_append_nodup (
310
317
& filter -> filter_spec , strbuf_detach (& concatted , NULL ));
311
318
}
312
319
@@ -321,7 +328,7 @@ const char *expand_list_objects_filter_spec(
321
328
strbuf_addf (& expanded_spec , "blob:limit=%lu" ,
322
329
filter -> blob_limit_value );
323
330
string_list_clear (& filter -> filter_spec , /*free_util=*/ 0 );
324
- string_list_append (
331
+ string_list_append_nodup (
325
332
& filter -> filter_spec ,
326
333
strbuf_detach (& expanded_spec , NULL ));
327
334
}
@@ -418,6 +425,7 @@ void list_objects_filter_copy(
418
425
string_list_init_dup (& dest -> filter_spec );
419
426
for_each_string_list_item (item , & src -> filter_spec )
420
427
string_list_append (& dest -> filter_spec , item -> string );
428
+ dest -> sparse_oid_name = xstrdup_or_null (src -> sparse_oid_name );
421
429
422
430
ALLOC_ARRAY (dest -> sub , dest -> sub_alloc );
423
431
for (i = 0 ; i < src -> sub_nr ; i ++ )
0 commit comments