@@ -195,15 +195,9 @@ static struct child_process *get_helper(struct transport *transport)
195
195
} else if (!strcmp (capname , "signed-tags" )) {
196
196
data -> signed_tags = 1 ;
197
197
} else if (starts_with (capname , "export-marks " )) {
198
- struct strbuf arg = STRBUF_INIT ;
199
- strbuf_addstr (& arg , "--export-marks=" );
200
- strbuf_addstr (& arg , capname + strlen ("export-marks " ));
201
- data -> export_marks = strbuf_detach (& arg , NULL );
198
+ data -> export_marks = xstrdup (capname + strlen ("export-marks " ));
202
199
} else if (starts_with (capname , "import-marks" )) {
203
- struct strbuf arg = STRBUF_INIT ;
204
- strbuf_addstr (& arg , "--import-marks=" );
205
- strbuf_addstr (& arg , capname + strlen ("import-marks " ));
206
- data -> import_marks = strbuf_detach (& arg , NULL );
200
+ data -> import_marks = xstrdup (capname + strlen ("import-marks " ));
207
201
} else if (starts_with (capname , "no-private-update" )) {
208
202
data -> no_private_update = 1 ;
209
203
} else if (mandatory ) {
@@ -428,6 +422,8 @@ static int get_exporter(struct transport *transport,
428
422
struct helper_data * data = transport -> data ;
429
423
struct child_process * helper = get_helper (transport );
430
424
int argc = 0 , i ;
425
+ struct strbuf tmp = STRBUF_INIT ;
426
+
431
427
memset (fastexport , 0 , sizeof (* fastexport ));
432
428
433
429
/* we need to duplicate helper->in because we want to use it after
@@ -438,10 +434,14 @@ static int get_exporter(struct transport *transport,
438
434
fastexport -> argv [argc ++ ] = "--use-done-feature" ;
439
435
fastexport -> argv [argc ++ ] = data -> signed_tags ?
440
436
"--signed-tags=verbatim" : "--signed-tags=warn-strip" ;
441
- if (data -> export_marks )
442
- fastexport -> argv [argc ++ ] = data -> export_marks ;
443
- if (data -> import_marks )
444
- fastexport -> argv [argc ++ ] = data -> import_marks ;
437
+ if (data -> export_marks ) {
438
+ strbuf_addf (& tmp , "--export-marks=%s" , data -> export_marks );
439
+ fastexport -> argv [argc ++ ] = strbuf_detach (& tmp , NULL );
440
+ }
441
+ if (data -> import_marks ) {
442
+ strbuf_addf (& tmp , "--import-marks=%s" , data -> import_marks );
443
+ fastexport -> argv [argc ++ ] = strbuf_detach (& tmp , NULL );
444
+ }
445
445
446
446
for (i = 0 ; i < revlist_args -> nr ; i ++ )
447
447
fastexport -> argv [argc ++ ] = revlist_args -> items [i ].string ;
0 commit comments