git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 10/10] transport-helper: add support to delete branches
@ 2013-11-11 22:54 Felipe Contreras
  2013-11-11 22:54 ` [PATCH v6 00/10] transport-helper: updates Felipe Contreras
                   ` (9 more replies)
  0 siblings, 10 replies; 32+ messages in thread
From: Felipe Contreras @ 2013-11-11 22:54 UTC (permalink / raw)
  To: git; +Cc: Sverre Rabbelier, Richard Hansen, Felipe Contreras

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 454337e..c667965 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 'forced push' '
 	(cd local &&
 	git checkout -b force-test &&
diff --git a/transport-helper.c b/transport-helper.c
index 7411125..2257588 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -876,9 +876,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);
@@ -890,12 +887,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.2+fc1

^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2014-04-24  4:06 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 22:54 [PATCH v6 10/10] transport-helper: add support to delete branches Felipe Contreras
2013-11-11 22:54 ` [PATCH v6 00/10] transport-helper: updates Felipe Contreras
2013-11-11 23:33   ` Junio C Hamano
2013-11-11 23:44     ` Felipe Contreras
2013-11-11 23:37   ` Junio C Hamano
2013-11-12  6:21   ` Richard Hansen
2013-11-12 20:55     ` Felipe Contreras
2013-11-12  7:03   ` [PATCH v2] remote-bzr: support the new 'force' option Richard Hansen
2013-11-12 21:01     ` Felipe Contreras
2013-11-11 22:54 ` [PATCH v6 01/10] transport-helper: fix extra lines Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 08/10] fast-import: add support to delete refs Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 05/10] fast-export: improve argument parsing Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 06/10] fast-export: add new --refspec option Felipe Contreras
2013-11-11 23:25   ` Junio C Hamano
2013-11-11 23:50     ` Felipe Contreras
2013-11-12  7:39       ` Richard Hansen
2013-11-12 17:08         ` Junio C Hamano
2013-11-12 21:02         ` Felipe Contreras
2013-11-12 21:46           ` Junio C Hamano
2013-11-12 23:20             ` Felipe Contreras
2013-11-12 23:54             ` Junio C Hamano
2013-12-07 10:00               ` Felipe Contreras
2013-12-09 21:00                 ` Junio C Hamano
2013-12-09 21:11                   ` Junio C Hamano
2014-04-24  3:55                   ` Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 03/10] transport-helper: add 'force' to 'export' helpers Felipe Contreras
2013-11-11 23:28   ` Junio C Hamano
2013-11-11 23:47     ` Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 09/10] fast-export: add support to delete refs Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 07/10] transport-helper: add support for old:new refspec Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 04/10] transport-helper: check for 'forced update' message Felipe Contreras
2013-11-11 22:55 ` [PATCH v6 02/10] transport-helper: don't update refs in dry-run Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).