diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2014-04-20 13:59:25 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-04-21 11:47:33 -0700 |
commit | d98c81538015630603fd20f6e08e960555a38c52 (patch) | |
tree | 5327b2a2ea3ae2c3443f039fde518baef347bbee /transport-helper.c | |
parent | 03e9010c66adfe5e1693eae039e6754d925b7bf4 (diff) | |
download | git-d98c81538015630603fd20f6e08e960555a38c52.tar.gz |
transport-helper: add support for old:new refspec
By using fast-export's new --refspec option.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/transport-helper.c b/transport-helper.c index 86e1679c1e..3f45c478fa 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -856,7 +856,7 @@ static int push_refs_with_export(struct transport *transport, struct ref *ref; struct child_process *helper, exporter; struct helper_data *data = transport->data; - struct string_list revlist_args = STRING_LIST_INIT_NODUP; + struct string_list revlist_args = STRING_LIST_INIT_DUP; struct strbuf buf = STRBUF_INIT; if (!data->refspecs) @@ -894,8 +894,13 @@ static int push_refs_with_export(struct transport *transport, free(private); if (ref->peer_ref) { - if (strcmp(ref->peer_ref->name, ref->name)) - die("remote-helpers do not support old:new syntax"); + if (strcmp(ref->name, ref->peer_ref->name)) { + struct strbuf buf = STRBUF_INIT; + strbuf_addf(&buf, "%s:%s", ref->peer_ref->name, ref->name); + string_list_append(&revlist_args, "--refspec"); + string_list_append(&revlist_args, buf.buf); + strbuf_release(&buf); + } string_list_append(&revlist_args, ref->peer_ref->name); } } @@ -903,6 +908,8 @@ static int push_refs_with_export(struct transport *transport, if (get_exporter(transport, &exporter, &revlist_args)) die("Couldn't run fast-export"); + string_list_clear(&revlist_args, 1); + if (finish_command(&exporter)) die("Error while running fast-export"); push_update_refs_status(data, remote_refs, flags); |