summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2014-04-20 13:59:29 -0500
committerJunio C Hamano <gitster@pobox.com>2014-04-21 11:47:34 -0700
commitf3d0376356756c55a85a3d745858a42c26956e74 (patch)
tree35a2238556cb99d2a1f43d30f8dafe4ba3b6a72d /transport-helper.c
parent60ed26438c909fd273528e67b399ee6ca4028e1e (diff)
downloadgit-f3d0376356756c55a85a3d745858a42c26956e74.tar.gz
transport-helper: add support to delete branches
For remote-helpers that use 'export' to push. 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.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/transport-helper.c b/transport-helper.c
index f74eb57046..36fbf9349e 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -882,9 +882,6 @@ static int push_refs_with_export(struct transport *transport,
char *private;
unsigned char sha1[20];
- if (ref->deletion)
- die("remote-helpers do not support ref deletion");
-
private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name);
if (private && !get_sha1(private, sha1)) {
strbuf_addf(&buf, "^%s", private);
@@ -896,21 +893,26 @@ static int push_refs_with_export(struct transport *transport,
if (ref->peer_ref) {
if (strcmp(ref->name, ref->peer_ref->name)) {
struct strbuf buf = STRBUF_INIT;
- const char *name;
- int flag;
- /* Follow symbolic refs (mainly for HEAD). */
- name = resolve_ref_unsafe(ref->peer_ref->name, sha1, 1, &flag);
- if (!name || !(flag & REF_ISSYMREF))
- name = ref->peer_ref->name;
+ if (!ref->deletion) {
+ const char *name;
+ int flag;
+
+ /* Follow symbolic refs (mainly for HEAD). */
+ name = resolve_ref_unsafe(ref->peer_ref->name, sha1, 1, &flag);
+ if (!name || !(flag & REF_ISSYMREF))
+ name = ref->peer_ref->name;
- strbuf_addf(&buf, "%s:%s", name, ref->name);
+ strbuf_addf(&buf, "%s:%s", name, ref->name);
+ } else
+ strbuf_addf(&buf, ":%s", 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);
+ if (!ref->deletion)
+ string_list_append(&revlist_args, ref->peer_ref->name);
}
}