{"thread":{"id":"35122","subject":"[PATCH v3 00/10] transport-helper: updates","startedAt":"2013-10-12T07:05:23Z","lastAt":"2013-10-27T06:23:45Z","messageCount":16,"participants":["Felipe Contreras","Eric Sunshine","Richard Hansen"],"isPatch":true,"patchVersion":3,"patchTotal":10},"messages":[{"id":"228800","messageId":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":null,"subject":"[PATCH v3 00/10] transport-helper: updates","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:23Z","receivedAt":"2013-10-12T07:05:23Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Hi,\n\nHere are the patches that allow transport helpers to be completely transparent;\nrenaming branches, deleting them, custom refspecs, --force, --dry-run,\nreporting forced update, everything works.\n\nSome of these were were sent before and rejected without a reason, but here\nthey are again in case anybody is interested.\n\nDiff from v2:\n\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -821,8 +821,10 @@ static int push_refs_with_export(struct transport *transport,\n                        die(\"helper %s does not support dry-run\", data->name);\n        }\n \n-       if (flags & TRANSPORT_PUSH_FORCE)\n-               set_helper_option(transport, \"force\", \"true\");\n+       if (flags & TRANSPORT_PUSH_FORCE) {\n+               if (set_helper_option(transport, \"force\", \"true\") != 0)\n+                       die(\"helper %s does not support 'force'\", data->name);\n+       }\n \n        helper = get_helper(transport);\n \n\nFelipe Contreras (10):\n  transport-helper: add 'force' to 'export' helpers\n  transport-helper: fix extra lines\n  transport-helper: check for 'forced update' message\n  fast-export: improve argument parsing\n  fast-export: add new --refspec option\n  transport-helper: add support for old:new refspec\n  fast-import: add support to delete refs\n  fast-export: add support to delete refs\n  transport-helper: add support to delete branches\n  transport-helper: don't update refs in dry-run\n\n Documentation/git-fast-export.txt |  4 ++++\n Documentation/git-fast-import.txt |  3 +++\n builtin/fast-export.c             | 47 ++++++++++++++++++++++++++++++++++++++-\n fast-import.c                     | 13 ++++++++---\n t/t5801-remote-helpers.sh         | 10 ++++++++-\n t/t9300-fast-import.sh            | 18 +++++++++++++++\n t/t9350-fast-export.sh            | 18 +++++++++++++++\n transport-helper.c                | 44 ++++++++++++++++++++++++++----------\n 8 files changed, 140 insertions(+), 17 deletions(-)\n\n-- \n1.8.4-fc\n"},{"id":"228802","messageId":"1381561533-20381-2-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 03/10] transport-helper: check for 'forced update' message","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:24Z","receivedAt":"2013-10-12T07:05:24Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"So the remote-helpers can tell us when a forced push was needed.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n transport-helper.c | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex ed3384e..46b3e57 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -630,7 +630,7 @@ static int push_update_ref_status(struct strbuf *buf,\n \t\t\t\t   struct ref *remote_refs)\n {\n \tchar *refname, *msg;\n-\tint status;\n+\tint status, forced = 0;\n \n \tif (!prefixcmp(buf->buf, \"ok \")) {\n \t\tstatus = REF_STATUS_OK;\n@@ -683,6 +683,11 @@ static int push_update_ref_status(struct strbuf *buf,\n \t\t\tfree(msg);\n \t\t\tmsg = NULL;\n \t\t}\n+\t\telse if (!strcmp(msg, \"forced update\")) {\n+\t\t\tforced = 1;\n+\t\t\tfree(msg);\n+\t\t\tmsg = NULL;\n+\t\t}\n \t}\n \n \tif (*ref)\n@@ -704,6 +709,7 @@ static int push_update_ref_status(struct strbuf *buf,\n \t}\n \n \t(*ref)->status = status;\n+\t(*ref)->forced_update = forced;\n \t(*ref)->remote_status = msg;\n \treturn !(status == REF_STATUS_OK);\n }\n-- \n1.8.4-fc\n"},{"id":"228801","messageId":"1381561533-20381-3-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 05/10] fast-export: add new --refspec option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:25Z","receivedAt":"2013-10-12T07:05:25Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"So that we can covert the exported ref names.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-fast-export.txt |  4 ++++\n builtin/fast-export.c             | 30 ++++++++++++++++++++++++++++++\n t/t9350-fast-export.sh            |  7 +++++++\n 3 files changed, 41 insertions(+)\n\ndiff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt\nindex 85f1f30..221506b 100644\n--- a/Documentation/git-fast-export.txt\n+++ b/Documentation/git-fast-export.txt\n@@ -105,6 +105,10 @@ marks the same across runs.\n \tin the commit (as opposed to just listing the files which are\n \tdifferent from the commit's first parent).\n \n+--refspec::\n+\tApply the specified refspec to each ref exported. Multiple of them can\n+\tbe specified.\n+\n [<git-rev-list-args>...]::\n \tA list of arguments, acceptable to 'git rev-parse' and\n \t'git rev-list', that specifies the specific objects and references\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 91114f4..7f314f0 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -17,6 +17,7 @@\n #include \"utf8.h\"\n #include \"parse-options.h\"\n #include \"quote.h\"\n+#include \"remote.h\"\n \n static const char *fast_export_usage[] = {\n \tN_(\"git fast-export [rev-list-opts]\"),\n@@ -30,6 +31,8 @@ static int fake_missing_tagger;\n static int use_done_feature;\n static int no_data;\n static int full_tree;\n+static struct refspec *refspecs;\n+static int refspecs_nr;\n \n static int parse_opt_signed_tag_mode(const struct option *opt,\n \t\t\t\t     const char *arg, int unset)\n@@ -502,6 +505,15 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info,\n \t\tif (dwim_ref(e->name, strlen(e->name), sha1, &full_name) != 1)\n \t\t\tcontinue;\n \n+\t\tif (refspecs) {\n+\t\t\tchar *private;\n+\t\t\tprivate = apply_refspecs(refspecs, refspecs_nr, full_name);\n+\t\t\tif (private) {\n+\t\t\t\tfree(full_name);\n+\t\t\t\tfull_name = private;\n+\t\t\t}\n+\t\t}\n+\n \t\tswitch (e->item->type) {\n \t\tcase OBJ_COMMIT:\n \t\t\tcommit = (struct commit *)e->item;\n@@ -661,6 +673,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)\n \tstruct commit *commit;\n \tchar *export_filename = NULL, *import_filename = NULL;\n \tuint32_t lastimportid;\n+\tstruct string_list refspecs_list;\n \tstruct option options[] = {\n \t\tOPT_INTEGER(0, \"progress\", &progress,\n \t\t\t    N_(\"show progress after <n> objects\")),\n@@ -681,6 +694,8 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)\n \t\tOPT_BOOLEAN(0, \"use-done-feature\", &use_done_feature,\n \t\t\t     N_(\"Use the done feature to terminate the stream\")),\n \t\tOPT_BOOL(0, \"no-data\", &no_data, N_(\"Skip output of blob data\")),\n+\t\tOPT_STRING_LIST(0, \"refspec\", &refspecs_list, N_(\"refspec\"),\n+\t\t\t     N_(\"Apply refspec to exported refs\")),\n \t\tOPT_END()\n \t};\n \n@@ -700,6 +715,19 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)\n \tif (argc > 1)\n \t\tusage_with_options (fast_export_usage, options);\n \n+\tif (refspecs_list.nr) {\n+\t\tconst char *refspecs_str[refspecs_list.nr];\n+\t\tint i;\n+\n+\t\tfor (i = 0; i < refspecs_list.nr; i++)\n+\t\t\trefspecs_str[i] = refspecs_list.items[i].string;\n+\n+\t\trefspecs_nr = refspecs_list.nr;\n+\t\trefspecs = parse_fetch_refspec(refspecs_nr, refspecs_str);\n+\n+\t\tstring_list_clear(&refspecs_list, 1);\n+\t}\n+\n \tif (use_done_feature)\n \t\tprintf(\"feature done\\n\");\n \n@@ -734,5 +762,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)\n \tif (use_done_feature)\n \t\tprintf(\"done\\n\");\n \n+\tfree_refspec(refspecs_nr, refspecs);\n+\n \treturn 0;\n }\ndiff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh\nindex 34c2d8f..dc6666f 100755\n--- a/t/t9350-fast-export.sh\n+++ b/t/t9350-fast-export.sh\n@@ -504,4 +504,11 @@ test_expect_success 'refs are updated even if no commits need to be exported' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'use refspec' '\n+\tgit fast-export --refspec refs/heads/master:refs/heads/foobar master | \\\n+\t\tgrep \"^commit \" | sort | uniq > actual &&\n+\techo \"commit refs/heads/foobar\" > expected &&\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n1.8.4-fc\n"},{"id":"228867","messageId":"1381561533-20381-4-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 06/10] transport-helper: add support for old:new refspec","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:26Z","receivedAt":"2013-10-12T07:05:26Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"By using fast-export's new --refspec option.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n t/t5801-remote-helpers.sh |  2 +-\n transport-helper.c        | 13 ++++++++++---\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh\nindex 8c4c539..8e2dd9f 100755\n--- a/t/t5801-remote-helpers.sh\n+++ b/t/t5801-remote-helpers.sh\n@@ -87,7 +87,7 @@ test_expect_success 'push new branch by name' '\n \tcompare_refs local HEAD server refs/heads/new-name\n '\n \n-test_expect_failure 'push new branch with old:new refspec' '\n+test_expect_success 'push new branch with old:new refspec' '\n \t(cd local &&\n \t git push origin new-name:new-refspec\n \t) &&\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 46b3e57..cffeb9a 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -809,7 +809,7 @@ static int push_refs_with_export(struct transport *transport,\n \tstruct ref *ref;\n \tstruct child_process *helper, exporter;\n \tstruct helper_data *data = transport->data;\n-\tstruct string_list revlist_args = STRING_LIST_INIT_NODUP;\n+\tstruct string_list revlist_args = STRING_LIST_INIT_DUP;\n \tstruct strbuf buf = STRBUF_INIT;\n \n \tif (!data->refspecs)\n@@ -847,8 +847,13 @@ static int push_refs_with_export(struct transport *transport,\n \t\tfree(private);\n \n \t\tif (ref->peer_ref) {\n-\t\t\tif (strcmp(ref->peer_ref->name, ref->name))\n-\t\t\t\tdie(\"remote-helpers do not support old:new syntax\");\n+\t\t\tif (strcmp(ref->name, ref->peer_ref->name)) {\n+\t\t\t\tstruct strbuf buf = STRBUF_INIT;\n+\t\t\t\tstrbuf_addf(&buf, \"%s:%s\", ref->peer_ref->name, ref->name);\n+\t\t\t\tstring_list_append(&revlist_args, \"--refspec\");\n+\t\t\t\tstring_list_append(&revlist_args, buf.buf);\n+\t\t\t\tstrbuf_release(&buf);\n+\t\t\t}\n \t\t\tstring_list_append(&revlist_args, ref->peer_ref->name);\n \t\t}\n \t}\n@@ -856,6 +861,8 @@ static int push_refs_with_export(struct transport *transport,\n \tif (get_exporter(transport, &exporter, &revlist_args))\n \t\tdie(\"Couldn't run fast-export\");\n \n+\tstring_list_clear(&revlist_args, 1);\n+\n \tif (finish_command(&exporter))\n \t\tdie(\"Error while running fast-export\");\n \tpush_update_refs_status(data, remote_refs);\n-- \n1.8.4-fc\n"},{"id":"228803","messageId":"1381561533-20381-5-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 02/10] transport-helper: fix extra lines","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:27Z","receivedAt":"2013-10-12T07:05:27Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Commit 9c51558 (transport-helper: trivial code shuffle) moved these\nlines above, but 99d9ec0 (Merge branch 'fc/transport-helper-no-refspec')\nhad a wrong merge conflict and readded them.\n\nReported-by: Richard Hansen <rhansen@bbn.com>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n transport-helper.c | 3 ---\n 1 file changed, 3 deletions(-)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex cd913af..ed3384e 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -840,9 +840,6 @@ static int push_refs_with_export(struct transport *transport,\n \t\t}\n \t\tfree(private);\n \n-\t\tif (ref->deletion)\n-\t\t\tdie(\"remote-helpers do not support ref deletion\");\n-\n \t\tif (ref->peer_ref) {\n \t\t\tif (strcmp(ref->peer_ref->name, ref->name))\n \t\t\t\tdie(\"remote-helpers do not support old:new syntax\");\n-- \n1.8.4-fc\n"},{"id":"228809","messageId":"1381561533-20381-6-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 09/10] transport-helper: add support to delete branches","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:28Z","receivedAt":"2013-10-12T07:05:28Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"For remote-helpers that use 'export' to push.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n t/t5801-remote-helpers.sh | 8 ++++++++\n transport-helper.c        | 8 ++++++--\n 2 files changed, 14 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh\nindex 8e2dd9f..a66a4e3 100755\n--- a/t/t5801-remote-helpers.sh\n+++ b/t/t5801-remote-helpers.sh\n@@ -94,6 +94,14 @@ test_expect_success 'push new branch with old:new refspec' '\n \tcompare_refs local HEAD server refs/heads/new-refspec\n '\n \n+test_expect_success 'push delete branch' '\n+\t(cd local &&\n+\t git push origin :new-name\n+\t) &&\n+\ttest_must_fail git --git-dir=\"server/.git\" \\\n+\t rev-parse --verify refs/heads/new-name\n+'\n+\n test_expect_success 'cloning without refspec' '\n \tGIT_REMOTE_TESTGIT_REFSPEC=\"\" \\\n \tgit clone \"testgit::${PWD}/server\" local2 2>error &&\ndiff --git a/transport-helper.c b/transport-helper.c\nindex cffeb9a..ddb3309 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -849,12 +849,16 @@ static int push_refs_with_export(struct transport *transport,\n \t\tif (ref->peer_ref) {\n \t\t\tif (strcmp(ref->name, ref->peer_ref->name)) {\n \t\t\t\tstruct strbuf buf = STRBUF_INIT;\n-\t\t\t\tstrbuf_addf(&buf, \"%s:%s\", ref->peer_ref->name, ref->name);\n+\t\t\t\tif (!ref->deletion)\n+\t\t\t\t\tstrbuf_addf(&buf, \"%s:%s\", ref->peer_ref->name, ref->name);\n+\t\t\t\telse\n+\t\t\t\t\tstrbuf_addf(&buf, \":%s\", ref->name);\n \t\t\t\tstring_list_append(&revlist_args, \"--refspec\");\n \t\t\t\tstring_list_append(&revlist_args, buf.buf);\n \t\t\t\tstrbuf_release(&buf);\n \t\t\t}\n-\t\t\tstring_list_append(&revlist_args, ref->peer_ref->name);\n+\t\t\tif (!ref->deletion)\n+\t\t\t\tstring_list_append(&revlist_args, ref->peer_ref->name);\n \t\t}\n \t}\n \n-- \n1.8.4-fc\n"},{"id":"228810","messageId":"1381561533-20381-7-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 01/10] transport-helper: add 'force' to 'export' helpers","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:29Z","receivedAt":"2013-10-12T07:05:29Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Otherwise they cannot know when to force the push or not (other than\nhacks).\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n transport-helper.c | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 63cabc3..cd913af 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -814,6 +814,11 @@ static int push_refs_with_export(struct transport *transport,\n \t\t\tdie(\"helper %s does not support dry-run\", data->name);\n \t}\n \n+\tif (flags & TRANSPORT_PUSH_FORCE) {\n+\t\tif (set_helper_option(transport, \"force\", \"true\") != 0)\n+\t\t\tdie(\"helper %s does not support 'force'\", data->name);\n+\t}\n+\n \thelper = get_helper(transport);\n \n \twrite_constant(helper->in, \"export\\n\");\n-- \n1.8.4-fc\n"},{"id":"228813","messageId":"1381561533-20381-8-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 08/10] fast-export: add support to delete refs","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:30Z","receivedAt":"2013-10-12T07:05:30Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n builtin/fast-export.c  | 14 ++++++++++++++\n t/t9350-fast-export.sh | 11 +++++++++++\n 2 files changed, 25 insertions(+)\n\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 7f314f0..9b728ca 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -665,6 +665,19 @@ static void import_marks(char *input_file)\n \tfclose(f);\n }\n \n+static void handle_deletes(void)\n+{\n+\tint i;\n+\tfor (i = 0; i < refspecs_nr; i++) {\n+\t\tstruct refspec *refspec = &refspecs[i];\n+\t\tif (*refspec->src)\n+\t\t\tcontinue;\n+\n+\t\tprintf(\"reset %s\\nfrom %s\\n\\n\",\n+\t\t\t\trefspec->dst, sha1_to_hex(null_sha1));\n+\t}\n+}\n+\n int cmd_fast_export(int argc, const char **argv, const char *prefix)\n {\n \tstruct rev_info revs;\n@@ -755,6 +768,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)\n \t}\n \n \thandle_tags_and_duplicates(&extra_refs);\n+\thandle_deletes();\n \n \tif (export_filename && lastimportid != last_idnum)\n \t\texport_marks(export_filename);\ndiff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh\nindex dc6666f..ea6c96c 100755\n--- a/t/t9350-fast-export.sh\n+++ b/t/t9350-fast-export.sh\n@@ -511,4 +511,15 @@ test_expect_success 'use refspec' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'delete refspec' '\n+\tgit branch to-delete &&\n+\tgit fast-export --refspec :refs/heads/to-delete to-delete ^to-delete > actual &&\n+\tcat > expected <<-EOF &&\n+\treset refs/heads/to-delete\n+\tfrom 0000000000000000000000000000000000000000\n+\n+\tEOF\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n1.8.4-fc\n"},{"id":"228815","messageId":"1381561533-20381-9-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 10/10] transport-helper: don't update refs in dry-run","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:31Z","receivedAt":"2013-10-12T07:05:31Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"The remote helper namespace should not be updated.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n transport-helper.c | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex ddb3309..d94eaf4 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -715,7 +715,8 @@ static int push_update_ref_status(struct strbuf *buf,\n }\n \n static void push_update_refs_status(struct helper_data *data,\n-\t\t\t\t    struct ref *remote_refs)\n+\t\t\t\t    struct ref *remote_refs,\n+\t\t\t\t    int flags)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n \tstruct ref *ref = remote_refs;\n@@ -729,7 +730,7 @@ static void push_update_refs_status(struct helper_data *data,\n \t\tif (push_update_ref_status(&buf, &ref, remote_refs))\n \t\t\tcontinue;\n \n-\t\tif (!data->refspecs)\n+\t\tif (flags & TRANSPORT_PUSH_DRY_RUN || !data->refspecs)\n \t\t\tcontinue;\n \n \t\t/* propagate back the update to the remote namespace */\n@@ -799,7 +800,7 @@ static int push_refs_with_push(struct transport *transport,\n \tsendline(data, &buf);\n \tstrbuf_release(&buf);\n \n-\tpush_update_refs_status(data, remote_refs);\n+\tpush_update_refs_status(data, remote_refs, flags);\n \treturn 0;\n }\n \n@@ -869,7 +870,7 @@ static int push_refs_with_export(struct transport *transport,\n \n \tif (finish_command(&exporter))\n \t\tdie(\"Error while running fast-export\");\n-\tpush_update_refs_status(data, remote_refs);\n+\tpush_update_refs_status(data, remote_refs, flags);\n \treturn 0;\n }\n \n-- \n1.8.4-fc\n"},{"id":"228812","messageId":"1381561533-20381-10-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 07/10] fast-import: add support to delete refs","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:32Z","receivedAt":"2013-10-12T07:05:32Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-fast-import.txt |  3 +++\n fast-import.c                     | 13 ++++++++++---\n t/t9300-fast-import.sh            | 18 ++++++++++++++++++\n 3 files changed, 31 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\nindex bf1a02a..fe5c952 100644\n--- a/Documentation/git-fast-import.txt\n+++ b/Documentation/git-fast-import.txt\n@@ -483,6 +483,9 @@ Marks must be declared (via `mark`) before they can be used.\n * Any valid Git SHA-1 expression that resolves to a commit.  See\n   ``SPECIFYING REVISIONS'' in linkgit:gitrevisions[7] for details.\n \n+* The special null SHA-1 (40 zeros) specifices that the branch is to be\n+  removed.\n+\n The special case of restarting an incremental import from the\n current branch value should be written as:\n ----\ndiff --git a/fast-import.c b/fast-import.c\nindex 23f625f..b6be7a7 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -248,6 +248,7 @@ struct branch {\n \tuintmax_t last_commit;\n \tuintmax_t num_notes;\n \tunsigned active : 1;\n+\tunsigned delete : 1;\n \tunsigned pack_id : PACK_ID_BITS;\n \tunsigned char sha1[20];\n };\n@@ -1674,10 +1675,13 @@ static int update_branch(struct branch *b)\n \tstruct ref_lock *lock;\n \tunsigned char old_sha1[20];\n \n-\tif (is_null_sha1(b->sha1))\n-\t\treturn 0;\n \tif (read_ref(b->name, old_sha1))\n \t\thashclr(old_sha1);\n+\tif (is_null_sha1(b->sha1)) {\n+\t\tif (b->delete)\n+\t\t\tdelete_ref(b->name, old_sha1, 0);\n+\t\treturn 0;\n+\t}\n \tlock = lock_any_ref_for_update(b->name, old_sha1, 0);\n \tif (!lock)\n \t\treturn error(\"Unable to lock %s\", b->name);\n@@ -2604,8 +2608,11 @@ static int parse_from(struct branch *b)\n \t\t\tfree(buf);\n \t\t} else\n \t\t\tparse_from_existing(b);\n-\t} else if (!get_sha1(from, b->sha1))\n+\t} else if (!get_sha1(from, b->sha1)) {\n \t\tparse_from_existing(b);\n+\t\tif (is_null_sha1(b->sha1))\n+\t\t\tb->delete = 1;\n+\t}\n \telse\n \t\tdie(\"Invalid ref name or SHA1 expression: %s\", from);\n \ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex ac6f3b6..0150aa6 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2934,4 +2934,22 @@ test_expect_success 'S: ls with garbage after sha1 must fail' '\n \ttest_i18ngrep \"space after tree-ish\" err\n '\n \n+test_expect_success 'T: delete branch' '\n+\tgit branch to-delete &&\n+\tgit fast-import <<-EOF &&\n+\treset refs/heads/to-delete\n+\tfrom 0000000000000000000000000000000000000000\n+\tEOF\n+\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n+'\n+\n+test_expect_success 'T: empty reset doesnt delete branch' '\n+\tgit branch not-to-delete &&\n+\tgit fast-import <<-EOF &&\n+\treset refs/heads/not-to-delete\n+\tEOF\n+\tgit show-ref &&\n+\tgit rev-parse --verify refs/heads/not-to-delete\n+'\n+\n test_done\n-- \n1.8.4-fc\n"},{"id":"228814","messageId":"1381561533-20381-11-git-send-email-felipe.contreras@gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 04/10] fast-export: improve argument parsing","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:05:33Z","receivedAt":"2013-10-12T07:05:33Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"We don't want to pass arguments specific to fast-export to\nsetup_revisions.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n builtin/fast-export.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 8e19058..91114f4 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -694,8 +694,9 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)\n \trevs.topo_order = 1;\n \trevs.show_source = 1;\n \trevs.rewrite_parents = 1;\n+\targc = parse_options(argc, argv, prefix, options, fast_export_usage,\n+\t\t\tPARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN);\n \targc = setup_revisions(argc, argv, &revs, NULL);\n-\targc = parse_options(argc, argv, prefix, options, fast_export_usage, 0);\n \tif (argc > 1)\n \t\tusage_with_options (fast_export_usage, options);\n \n-- \n1.8.4-fc\n"},{"id":"228943","messageId":"CAPig+cRQR=YXGY6kMhy6PfkAKkxwua5jQY7JaKth0_-8s2r-8g@mail.gmail.com","threadId":"35122","inReplyTo":"1381561533-20381-3-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v3 05/10] fast-export: add new --refspec option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-10-14T19:42:41Z","receivedAt":"2013-10-14T19:42:41Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Oct 12, 2013 at 3:05 AM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> So that we can covert the exported ref names.\n\ns/covert/convert/ [1]\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/225475/focus=225489\n\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n"},{"id":"229582","messageId":"1382848452-7953-1-git-send-email-rhansen@bbn.com","threadId":"35122","inReplyTo":"1381561533-20381-6-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v3 11/10] fixup! transport-helper: add support to delete branches","fromName":"Richard Hansen","fromEmail":"rhansen@bbn.com","sentAt":"2013-10-27T04:34:12Z","receivedAt":"2013-10-27T04:34:12Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Patch 2/10 (transport-helper: fix extra lines) deleted one copy of the\nlines; patch 9/10 (transport-helper: add support to delete branches)\nshould delete the other copy of the lines.\n\nSigned-off-by: Richard Hansen <rhansen@bbn.com>\n---\n transport-helper.c | 3 ---\n 1 file changed, 3 deletions(-)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 10db28e..23526de 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -878,9 +878,6 @@ static int push_refs_with_export(struct transport *transport,\n \t\tchar *private;\n \t\tunsigned char sha1[20];\n \n-\t\tif (ref->deletion)\n-\t\t\tdie(\"remote-helpers do not support ref deletion\");\n-\n \t\tprivate = apply_refspecs(data->refspecs, data->refspec_nr, ref->name);\n \t\tif (private && !get_sha1(private, sha1)) {\n \t\t\tstrbuf_addf(&buf, \"^%s\", private);\n-- \n1.8.4.1\n"},{"id":"229583","messageId":"CAMP44s142HB2t7wL8KYTyD4M=e7X5hvG1KeOBhJHwSEjegYM9Q@mail.gmail.com","threadId":"35122","inReplyTo":"1382848452-7953-1-git-send-email-rhansen@bbn.com","subject":"Re: [PATCH v3 11/10] fixup! transport-helper: add support to delete branches","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-27T04:55:33Z","receivedAt":"2013-10-27T04:55:33Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sat, Oct 26, 2013 at 11:34 PM, Richard Hansen <rhansen@bbn.com> wrote:\n> Patch 2/10 (transport-helper: fix extra lines) deleted one copy of the\n> lines; patch 9/10 (transport-helper: add support to delete branches)\n> should delete the other copy of the lines.\n\nLooks awfully familiar to:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/235973\n\nBut since the project does have double standards, you might have\nbetter luck by simply not using my name.\n\n-- \nFelipe Contreras\n"},{"id":"229584","messageId":"CAMP44s0RTahHMc4_zyf6U7-XKQm89fnP4owSHUSfqR0-8jti0Q@mail.gmail.com","threadId":"35122","inReplyTo":"CAMP44s142HB2t7wL8KYTyD4M=e7X5hvG1KeOBhJHwSEjegYM9Q@mail.gmail.com","subject":"Re: [PATCH v3 11/10] fixup! transport-helper: add support to delete branches","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-27T05:00:17Z","receivedAt":"2013-10-27T05:00:17Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sat, Oct 26, 2013 at 11:55 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> On Sat, Oct 26, 2013 at 11:34 PM, Richard Hansen <rhansen@bbn.com> wrote:\n>> Patch 2/10 (transport-helper: fix extra lines) deleted one copy of the\n>> lines; patch 9/10 (transport-helper: add support to delete branches)\n>> should delete the other copy of the lines.\n>\n> Looks awfully familiar to:\n>\n> http://article.gmane.org/gmane.comp.version-control.git/235973\n>\n> But since the project does have double standards, you might have\n> better luck by simply not using my name.\n\nAhh, nevermind, it's a fix on top of my patch. I actually found this\nand fixed it on my local branch, but didn't push it. Now I have.\n\nhttps://github.com/felipec/git/commit/4820caafc1f0b9e346b369bb2bc2b7bfdc8a1957\n\n-- \nFelipe Contreras\n"},{"id":"229587","messageId":"526CB171.5090300@bbn.com","threadId":"35122","inReplyTo":"1381561533-20381-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v3 00/10] transport-helper: updates","fromName":"Richard Hansen","fromEmail":"rhansen@bbn.com","sentAt":"2013-10-27T06:23:45Z","receivedAt":"2013-10-27T06:23:45Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 10/12/2013 03:05 AM, Felipe Contreras wrote:\n> Hi,\n> \n> Here are the patches that allow transport helpers to be completely transparent;\n> renaming branches, deleting them, custom refspecs, --force, --dry-run,\n> reporting forced update, everything works.\n\nThese patches don't cleanly apply to master anymore; would you be\nwilling to rebase and post a new version?\n\nI wanted to test these changes via git-remote-bzr on a bzr repository\nI'm working on, but unfortunately git-remote-bzr doesn't yet support\nforce pushes.  I may look into adding force push support to\ngit-remote-bzr, unless you beat me to it.  :)\n\nIn general these patches look good to me and I'd like to see them merged\nto master.\n\nThanks,\nRichard\n"}]}