diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-03-18 13:49:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-18 13:49:33 -0700 |
commit | 90e6255a6d01760d13d8ac635cca5819b0b4dbc5 (patch) | |
tree | ae04f89b4316b70e09807479c3edd949751c4c20 /transport-helper.c | |
parent | decba94d2c664229d16ee7c3cc442c0ada6090b9 (diff) | |
parent | a7cb1276cc263446b19b43d3a7784cbc72f84e28 (diff) | |
download | git-90e6255a6d01760d13d8ac635cca5819b0b4dbc5.tar.gz |
Merge branch 'fc/transport-helper-fixes'
Updates transport-helper, fast-import and fast-export to allow the
ref mapping and ref deletion in a way similar to the natively
supported transports.
* fc/transport-helper-fixes:
remote-bzr: support the new 'force' option
test-hg.sh: tests are now expected to pass
transport-helper.c: do not overwrite forced bit
transport-helper: check for 'forced update' message
transport-helper: add 'force' to 'export' helpers
transport-helper: don't update refs in dry-run
transport-helper: mismerge fix
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/transport-helper.c b/transport-helper.c index ad72fbd53c..86e1679c1e 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -650,7 +650,7 @@ static int push_update_ref_status(struct strbuf *buf, struct ref *remote_refs) { char *refname, *msg; - int status; + int status, forced = 0; if (starts_with(buf->buf, "ok ")) { status = REF_STATUS_OK; @@ -708,6 +708,11 @@ static int push_update_ref_status(struct strbuf *buf, free(msg); msg = NULL; } + else if (!strcmp(msg, "forced update")) { + forced = 1; + free(msg); + msg = NULL; + } } if (*ref) @@ -729,12 +734,14 @@ static int push_update_ref_status(struct strbuf *buf, } (*ref)->status = status; + (*ref)->forced_update |= forced; (*ref)->remote_status = msg; return !(status == REF_STATUS_OK); } static void push_update_refs_status(struct helper_data *data, - struct ref *remote_refs) + struct ref *remote_refs, + int flags) { struct strbuf buf = STRBUF_INIT; struct ref *ref = remote_refs; @@ -748,7 +755,7 @@ static void push_update_refs_status(struct helper_data *data, if (push_update_ref_status(&buf, &ref, remote_refs)) continue; - if (!data->refspecs || data->no_private_update) + if (flags & TRANSPORT_PUSH_DRY_RUN || !data->refspecs || data->no_private_update) continue; /* propagate back the update to the remote namespace */ @@ -839,7 +846,7 @@ static int push_refs_with_push(struct transport *transport, sendline(data, &buf); strbuf_release(&buf); - push_update_refs_status(data, remote_refs); + push_update_refs_status(data, remote_refs, flags); return 0; } @@ -860,6 +867,11 @@ static int push_refs_with_export(struct transport *transport, die("helper %s does not support dry-run", data->name); } + if (flags & TRANSPORT_PUSH_FORCE) { + if (set_helper_option(transport, "force", "true") != 0) + warning("helper %s does not support 'force'", data->name); + } + helper = get_helper(transport); write_constant(helper->in, "export\n"); @@ -881,9 +893,6 @@ static int push_refs_with_export(struct transport *transport, } free(private); - if (ref->deletion) - die("remote-helpers do not support ref deletion"); - if (ref->peer_ref) { if (strcmp(ref->peer_ref->name, ref->name)) die("remote-helpers do not support old:new syntax"); @@ -896,7 +905,7 @@ static int push_refs_with_export(struct transport *transport, if (finish_command(&exporter)) die("Error while running fast-export"); - push_update_refs_status(data, remote_refs); + push_update_refs_status(data, remote_refs, flags); return 0; } |