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; 33+ 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] 33+ messages in thread
* [PATCH v7 00/11] transport-helper: updates
@ 2013-11-12 20:56 Felipe Contreras
  2013-11-12 20:57 ` [PATCH v6 06/10] fast-export: add new --refspec option Felipe Contreras
  0 siblings, 1 reply; 33+ messages in thread
From: Felipe Contreras @ 2013-11-12 20:56 UTC (permalink / raw)
  To: git; +Cc: Richard Hansen, Felipe Contreras

Hi,

Here are the patches that allow transport helpers to be completely transparent;
renaming branches, deleting them, custom refspecs, --force, --dry-run,
reporting forced update, everything works.

Changes since v6:

diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 72f745d..aacd8a9 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -599,7 +599,7 @@ test_expect_success 'remote big push fetch first' '
 	)
 '
 
-test_expect_failure 'remote big push force' '
+test_expect_success 'remote big push force' '
 	test_when_finished "rm -rf hgrepo gitrepo*" &&
 
 	setup_big_push
@@ -629,7 +629,7 @@ test_expect_failure 'remote big push force' '
 	check_bookmark hgrepo new_bmark six
 '
 
-test_expect_failure 'remote big push dry-run' '
+test_expect_success 'remote big push dry-run' '
 	test_when_finished "rm -rf hgrepo gitrepo*" &&
 
 	setup_big_push
diff --git a/transport-helper.c b/transport-helper.c
index 2257588..7a95125 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -863,7 +863,7 @@ static int push_refs_with_export(struct transport *transport,
 
 	if (flags & TRANSPORT_PUSH_FORCE) {
 		if (set_helper_option(transport, "force", "true") != 0)
-			die("helper %s does not support 'force'", data->name);
+			warning("helper %s does not support 'force'", data->name);
 	}
 
 	helper = get_helper(transport);

Felipe Contreras (10):
  transport-helper: fix extra lines
  transport-helper: don't update refs in dry-run
  transport-helper: add 'force' to 'export' helpers
  transport-helper: check for 'forced update' message
  fast-export: improve argument parsing
  fast-export: add new --refspec option
  transport-helper: add support for old:new refspec
  fast-import: add support to delete refs
  fast-export: add support to delete refs
  transport-helper: add support to delete branches

Richard Hansen (1):
  test-hg.sh: tests are now expected to pass

 Documentation/git-fast-export.txt   |  4 +++
 Documentation/git-fast-import.txt   |  3 +++
 Documentation/gitremote-helpers.txt |  4 +++
 builtin/fast-export.c               | 49 ++++++++++++++++++++++++++++++++++++-
 contrib/remote-helpers/test-hg.sh   |  4 +--
 fast-import.c                       | 13 +++++++---
 git-remote-testgit.sh               | 18 ++++++++++++++
 t/t5801-remote-helpers.sh           | 23 ++++++++++++++++-
 t/t9300-fast-import.sh              | 18 ++++++++++++++
 t/t9350-fast-export.sh              | 18 ++++++++++++++
 transport-helper.c                  | 47 +++++++++++++++++++++++------------
 11 files changed, 179 insertions(+), 22 deletions(-)

-- 
1.8.4.2+fc1

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

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

Thread overview: 33+ 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
  -- strict thread matches above, loose matches on Subject: below --
2013-11-12 20:56 [PATCH v7 00/11] transport-helper: updates Felipe Contreras
2013-11-12 20:57 ` [PATCH v6 06/10] fast-export: add new --refspec option 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).