@@ -23,6 +23,8 @@ struct helper_data {
23
23
push : 1 ,
24
24
connect : 1 ,
25
25
no_disconnect_req : 1 ;
26
+ char * export_marks ;
27
+ char * import_marks ;
26
28
/* These go from remote name (as in "list") to private name */
27
29
struct refspec * refspecs ;
28
30
int refspec_nr ;
@@ -184,6 +186,16 @@ static struct child_process *get_helper(struct transport *transport)
184
186
refspecs [refspec_nr ++ ] = strdup (capname + strlen ("refspec " ));
185
187
} else if (!strcmp (capname , "connect" )) {
186
188
data -> connect = 1 ;
189
+ } else if (!prefixcmp (capname , "export-marks " )) {
190
+ struct strbuf arg = STRBUF_INIT ;
191
+ strbuf_addstr (& arg , "--export-marks=" );
192
+ strbuf_addstr (& arg , capname + strlen ("export-marks " ));
193
+ data -> export_marks = strbuf_detach (& arg , NULL );
194
+ } else if (!prefixcmp (capname , "import-marks" )) {
195
+ struct strbuf arg = STRBUF_INIT ;
196
+ strbuf_addstr (& arg , "--import-marks=" );
197
+ strbuf_addstr (& arg , capname + strlen ("import-marks " ));
198
+ data -> import_marks = strbuf_detach (& arg , NULL );
187
199
} else if (mandatory ) {
188
200
die ("Unknown mandatory capability %s. This remote "
189
201
"helper probably needs newer version of Git.\n" ,
@@ -369,10 +381,9 @@ static int get_importer(struct transport *transport, struct child_process *fasti
369
381
370
382
static int get_exporter (struct transport * transport ,
371
383
struct child_process * fastexport ,
372
- const char * export_marks ,
373
- const char * import_marks ,
374
384
struct string_list * revlist_args )
375
385
{
386
+ struct helper_data * data = transport -> data ;
376
387
struct child_process * helper = get_helper (transport );
377
388
int argc = 0 , i ;
378
389
memset (fastexport , 0 , sizeof (* fastexport ));
@@ -383,10 +394,10 @@ static int get_exporter(struct transport *transport,
383
394
fastexport -> argv = xcalloc (5 + revlist_args -> nr , sizeof (* fastexport -> argv ));
384
395
fastexport -> argv [argc ++ ] = "fast-export" ;
385
396
fastexport -> argv [argc ++ ] = "--use-done-feature" ;
386
- if (export_marks )
387
- fastexport -> argv [argc ++ ] = export_marks ;
388
- if (import_marks )
389
- fastexport -> argv [argc ++ ] = import_marks ;
397
+ if (data -> export_marks )
398
+ fastexport -> argv [argc ++ ] = data -> export_marks ;
399
+ if (data -> import_marks )
400
+ fastexport -> argv [argc ++ ] = data -> import_marks ;
390
401
391
402
for (i = 0 ; i < revlist_args -> nr ; i ++ )
392
403
fastexport -> argv [argc ++ ] = revlist_args -> items [i ].string ;
@@ -713,34 +724,13 @@ static int push_refs_with_export(struct transport *transport,
713
724
struct ref * ref ;
714
725
struct child_process * helper , exporter ;
715
726
struct helper_data * data = transport -> data ;
716
- char * export_marks = NULL , * import_marks = NULL ;
717
727
struct string_list revlist_args = STRING_LIST_INIT_NODUP ;
718
728
struct strbuf buf = STRBUF_INIT ;
719
729
720
730
helper = get_helper (transport );
721
731
722
732
write_constant (helper -> in , "export\n" );
723
733
724
- recvline (data , & buf );
725
- if (debug )
726
- fprintf (stderr , "Debug: Got export_marks '%s'\n" , buf .buf );
727
- if (buf .len ) {
728
- struct strbuf arg = STRBUF_INIT ;
729
- strbuf_addstr (& arg , "--export-marks=" );
730
- strbuf_addbuf (& arg , & buf );
731
- export_marks = strbuf_detach (& arg , NULL );
732
- }
733
-
734
- recvline (data , & buf );
735
- if (debug )
736
- fprintf (stderr , "Debug: Got import_marks '%s'\n" , buf .buf );
737
- if (buf .len ) {
738
- struct strbuf arg = STRBUF_INIT ;
739
- strbuf_addstr (& arg , "--import-marks=" );
740
- strbuf_addbuf (& arg , & buf );
741
- import_marks = strbuf_detach (& arg , NULL );
742
- }
743
-
744
734
strbuf_reset (& buf );
745
735
746
736
for (ref = remote_refs ; ref ; ref = ref -> next ) {
@@ -761,8 +751,7 @@ static int push_refs_with_export(struct transport *transport,
761
751
762
752
}
763
753
764
- if (get_exporter (transport , & exporter ,
765
- export_marks , import_marks , & revlist_args ))
754
+ if (get_exporter (transport , & exporter , & revlist_args ))
766
755
die ("Couldn't run fast-export" );
767
756
768
757
if (finish_command (& exporter ))
0 commit comments