From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Sverre Rabbelier <srabbelier@gmail.com>,
Richard Hansen <rhansen@bbn.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v4 09/10] transport-helper: add support to delete branches
Date: Sun, 27 Oct 2013 01:05:16 -0600 [thread overview]
Message-ID: <1382857521-7005-6-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1382857521-7005-1-git-send-email-felipe.contreras@gmail.com>
For remote-helpers that use 'export' to push.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
t/t5801-remote-helpers.sh | 8 ++++++++
transport-helper.c | 11 ++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index 407c18d..be543c0 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -94,6 +94,14 @@ test_expect_success 'push new branch with old:new refspec' '
compare_refs local HEAD server refs/heads/new-refspec
'
+test_expect_success 'push delete branch' '
+ (cd local &&
+ git push origin :new-name
+ ) &&
+ test_must_fail git --git-dir="server/.git" \
+ rev-parse --verify refs/heads/new-name
+'
+
test_expect_success 'cloning without refspec' '
GIT_REMOTE_TESTGIT_REFSPEC="" \
git clone "testgit::${PWD}/server" local2 2>error &&
diff --git a/transport-helper.c b/transport-helper.c
index 5454822..4f47bdd 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -874,9 +874,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);
@@ -888,12 +885,16 @@ 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;
- strbuf_addf(&buf, "%s:%s", ref->peer_ref->name, ref->name);
+ if (!ref->deletion)
+ strbuf_addf(&buf, "%s:%s", ref->peer_ref->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);
}
}
--
1.8.4-fc
next prev parent reply other threads:[~2013-10-27 7:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-27 7:05 [PATCH v4 00/10] transport-helper: updates Felipe Contreras
2013-10-27 7:05 ` [PATCH v4 03/10] transport-helper: check for 'forced update' message Felipe Contreras
2013-10-27 7:05 ` [PATCH v4 05/10] fast-export: add new --refspec option Felipe Contreras
2013-10-27 7:05 ` [PATCH v4 06/10] transport-helper: add support for old:new refspec Felipe Contreras
2013-10-27 7:05 ` [PATCH v4 02/10] transport-helper: fix extra lines Felipe Contreras
2013-10-27 7:05 ` Felipe Contreras [this message]
2013-10-27 7:05 ` [PATCH v4 01/10] transport-helper: add 'force' to 'export' helpers Felipe Contreras
2013-10-27 21:11 ` [PATCH v4 11/10] fixup! " Richard Hansen
2013-10-27 7:05 ` [PATCH v4 08/10] fast-export: add support to delete refs Felipe Contreras
2013-10-27 7:05 ` [PATCH v4 10/10] transport-helper: don't update refs in dry-run Felipe Contreras
2013-10-27 7:05 ` [PATCH v4 07/10] fast-import: add support to delete refs Felipe Contreras
2013-10-27 10:24 ` Eric Sunshine
2013-10-27 7:05 ` [PATCH v4 04/10] fast-export: improve argument parsing Felipe Contreras
2013-10-27 21:16 ` [PATCH v4 12/10] git-remote-testgit: support the new 'force' option Richard Hansen
2013-10-27 21:16 ` [PATCH v4 13/10] test: remote-helper: add test for force pushes Richard Hansen
2013-10-29 8:41 ` [PATCH v4 12/10] git-remote-testgit: support the new 'force' option Felipe Contreras
2013-11-10 22:46 ` Richard Hansen
2013-11-11 3:57 ` Felipe Contreras
2013-11-11 18:28 ` Junio C Hamano
2013-11-12 6:09 ` Richard Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382857521-7005-6-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=rhansen@bbn.com \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.