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>
This commit is contained in:
parent
03e9010c66
commit
d98c815380
@ -87,7 +87,7 @@ test_expect_success 'push new branch by name' '
|
|||||||
compare_refs local HEAD server refs/heads/new-name
|
compare_refs local HEAD server refs/heads/new-name
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'push new branch with old:new refspec' '
|
test_expect_success 'push new branch with old:new refspec' '
|
||||||
(cd local &&
|
(cd local &&
|
||||||
git push origin new-name:new-refspec
|
git push origin new-name:new-refspec
|
||||||
) &&
|
) &&
|
||||||
|
@ -856,7 +856,7 @@ static int push_refs_with_export(struct transport *transport,
|
|||||||
struct ref *ref;
|
struct ref *ref;
|
||||||
struct child_process *helper, exporter;
|
struct child_process *helper, exporter;
|
||||||
struct helper_data *data = transport->data;
|
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;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
|
|
||||||
if (!data->refspecs)
|
if (!data->refspecs)
|
||||||
@ -894,8 +894,13 @@ static int push_refs_with_export(struct transport *transport,
|
|||||||
free(private);
|
free(private);
|
||||||
|
|
||||||
if (ref->peer_ref) {
|
if (ref->peer_ref) {
|
||||||
if (strcmp(ref->peer_ref->name, ref->name))
|
if (strcmp(ref->name, ref->peer_ref->name)) {
|
||||||
die("remote-helpers do not support old:new syntax");
|
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);
|
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))
|
if (get_exporter(transport, &exporter, &revlist_args))
|
||||||
die("Couldn't run fast-export");
|
die("Couldn't run fast-export");
|
||||||
|
|
||||||
|
string_list_clear(&revlist_args, 1);
|
||||||
|
|
||||||
if (finish_command(&exporter))
|
if (finish_command(&exporter))
|
||||||
die("Error while running fast-export");
|
die("Error while running fast-export");
|
||||||
push_update_refs_status(data, remote_refs, flags);
|
push_update_refs_status(data, remote_refs, flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user