git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 10/10] transport-helper: add support to delete branches
@ 2013-10-31  9:36 Felipe Contreras
  2013-10-31  9:36 ` [PATCH v5 00/10] transport-helper: updates Felipe Contreras
                   ` (9 more replies)
  0 siblings, 10 replies; 45+ messages in thread
From: Felipe Contreras @ 2013-10-31  9:36 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 84ff578..ef91882 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -875,9 +875,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);
@@ -889,12 +886,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] 45+ messages in thread

end of thread, other threads:[~2013-11-11 18:16 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31  9:36 [PATCH v5 10/10] transport-helper: add support to delete branches Felipe Contreras
2013-10-31  9:36 ` [PATCH v5 00/10] transport-helper: updates Felipe Contreras
2013-10-31 17:59   ` Max Horn
2013-10-31 18:10     ` Junio C Hamano
2013-10-31 18:30       ` Felipe Contreras
2013-10-31 18:34       ` Junio C Hamano
2013-10-31 18:41       ` Max Horn
2013-11-11  5:09   ` [PATCH v5 11/10] test-hg.sh: tests are now expected to pass Richard Hansen
2013-11-11  5:10   ` [PATCH v5 12/10] remote-bzr: support the new 'force' option Richard Hansen
2013-11-11 11:51     ` Felipe Contreras
2013-11-11 18:12       ` Richard Hansen
2013-11-11 18:15         ` Felipe Contreras
2013-10-31  9:36 ` [PATCH v5 01/10] transport-helper: fix extra lines Felipe Contreras
2013-10-31 18:16   ` Junio C Hamano
2013-10-31  9:36 ` [PATCH v5 08/10] fast-import: add support to delete refs Felipe Contreras
2013-10-31 18:41   ` Max Horn
2013-10-31  9:36 ` [PATCH v5 05/10] fast-export: improve argument parsing Felipe Contreras
2013-10-31  9:36 ` [PATCH v5 06/10] fast-export: add new --refspec option Felipe Contreras
2013-10-31 18:26   ` Junio C Hamano
2013-10-31 18:41     ` Felipe Contreras
2013-11-06 21:00       ` Junio C Hamano
2013-11-06 22:14         ` Jeff King
2013-11-06 22:31           ` Junio C Hamano
2013-11-06 22:41             ` Junio C Hamano
2013-11-08 23:44           ` Junio C Hamano
2013-11-09  0:06             ` Jeff King
2013-11-07  1:00         ` Felipe Contreras
2013-10-31  9:36 ` [PATCH v5 03/10] transport-helper: add 'force' to 'export' helpers Felipe Contreras
2013-10-31 18:21   ` Junio C Hamano
2013-10-31 18:55     ` Felipe Contreras
2013-10-31 19:07       ` Junio C Hamano
2013-11-01 14:49         ` Junio C Hamano
2013-11-01 15:37           ` Felipe Contreras
2013-11-01 16:35             ` Junio C Hamano
2013-11-01 17:28               ` Eric Sunshine
2013-11-11  5:01   ` [PATCH] fixup! " Richard Hansen
2013-10-31  9:36 ` [PATCH v5 09/10] fast-export: add support to delete refs Felipe Contreras
2013-10-31 19:29   ` Max Horn
2013-10-31 19:41     ` Felipe Contreras
2013-10-31 19:47       ` Max Horn
2013-10-31 19:53         ` Felipe Contreras
2013-10-31 22:38           ` Max Horn
2013-10-31  9:36 ` [PATCH v5 07/10] transport-helper: add support for old:new refspec Felipe Contreras
2013-10-31  9:36 ` [PATCH v5 04/10] transport-helper: check for 'forced update' message Felipe Contreras
2013-10-31  9:36 ` [PATCH v5 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).