@@ -23,6 +23,8 @@ struct helper_data {
2323 push : 1 ,
2424 connect : 1 ,
2525 no_disconnect_req : 1 ;
26+ char * export_marks ;
27+ char * import_marks ;
2628 /* These go from remote name (as in "list") to private name */
2729 struct refspec * refspecs ;
2830 int refspec_nr ;
@@ -184,6 +186,16 @@ static struct child_process *get_helper(struct transport *transport)
184186 refspecs [refspec_nr ++ ] = strdup (capname + strlen ("refspec " ));
185187 } else if (!strcmp (capname , "connect" )) {
186188 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 );
187199 } else if (mandatory ) {
188200 die ("Unknown mandatory capability %s. This remote "
189201 "helper probably needs newer version of Git.\n" ,
@@ -369,10 +381,9 @@ static int get_importer(struct transport *transport, struct child_process *fasti
369381
370382static int get_exporter (struct transport * transport ,
371383 struct child_process * fastexport ,
372- const char * export_marks ,
373- const char * import_marks ,
374384 struct string_list * revlist_args )
375385{
386+ struct helper_data * data = transport -> data ;
376387 struct child_process * helper = get_helper (transport );
377388 int argc = 0 , i ;
378389 memset (fastexport , 0 , sizeof (* fastexport ));
@@ -383,10 +394,10 @@ static int get_exporter(struct transport *transport,
383394 fastexport -> argv = xcalloc (5 + revlist_args -> nr , sizeof (* fastexport -> argv ));
384395 fastexport -> argv [argc ++ ] = "fast-export" ;
385396 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 ;
390401
391402 for (i = 0 ; i < revlist_args -> nr ; i ++ )
392403 fastexport -> argv [argc ++ ] = revlist_args -> items [i ].string ;
@@ -713,34 +724,13 @@ static int push_refs_with_export(struct transport *transport,
713724 struct ref * ref ;
714725 struct child_process * helper , exporter ;
715726 struct helper_data * data = transport -> data ;
716- char * export_marks = NULL , * import_marks = NULL ;
717727 struct string_list revlist_args = STRING_LIST_INIT_NODUP ;
718728 struct strbuf buf = STRBUF_INIT ;
719729
720730 helper = get_helper (transport );
721731
722732 write_constant (helper -> in , "export\n" );
723733
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-
744734 strbuf_reset (& buf );
745735
746736 for (ref = remote_refs ; ref ; ref = ref -> next ) {
@@ -761,8 +751,7 @@ static int push_refs_with_export(struct transport *transport,
761751
762752 }
763753
764- if (get_exporter (transport , & exporter ,
765- export_marks , import_marks , & revlist_args ))
754+ if (get_exporter (transport , & exporter , & revlist_args ))
766755 die ("Couldn't run fast-export" );
767756
768757 if (finish_command (& exporter ))
0 commit comments