{"thread":{"id":"33883","subject":"[PATCH] transport-helper: barf when user tries --dry-run","startedAt":"2013-05-21T01:09:14Z","lastAt":"2013-05-21T01:31:49Z","messageCount":2,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"218028","messageId":"1369098554-11591-1-git-send-email-felipe.contreras@gmail.com","threadId":"33883","inReplyTo":null,"subject":"[PATCH] transport-helper: barf when user tries --dry-run","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-21T01:09:14Z","receivedAt":"2013-05-21T01:09:14Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Certain remote-helpers (the ones with 'export') would try to push\nregardless.\n\nObviously this is not what the user wants.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n transport-helper.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex 522d791..daebdd9 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -789,6 +789,9 @@ static int push_refs_with_export(struct transport *transport,\n \tstruct string_list revlist_args = STRING_LIST_INIT_NODUP;\n \tstruct strbuf buf = STRBUF_INIT;\n \n+\tif (flags & TRANSPORT_PUSH_DRY_RUN)\n+\t\tdie(\"helper %s does not support dry-run\", data->name);\n+\n \thelper = get_helper(transport);\n \n \twrite_constant(helper->in, \"export\\n\");\n-- \n1.8.3.rc3.dirty\n"},{"id":"218030","messageId":"CAMP44s0z1iuo+1gWU5dtp1vL1bneK72HrKWY91+ivavRHirgGg@mail.gmail.com","threadId":"33883","inReplyTo":"1369098554-11591-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH] transport-helper: barf when user tries --dry-run","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-05-21T01:31:49Z","receivedAt":"2013-05-21T01:31:49Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Mon, May 20, 2013 at 8:09 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> Certain remote-helpers (the ones with 'export') would try to push\n> regardless.\n>\n> Obviously this is not what the user wants.\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  transport-helper.c | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/transport-helper.c b/transport-helper.c\n> index 522d791..daebdd9 100644\n> --- a/transport-helper.c\n> +++ b/transport-helper.c\n> @@ -789,6 +789,9 @@ static int push_refs_with_export(struct transport *transport,\n>         struct string_list revlist_args = STRING_LIST_INIT_NODUP;\n>         struct strbuf buf = STRBUF_INIT;\n>\n> +       if (flags & TRANSPORT_PUSH_DRY_RUN)\n> +               die(\"helper %s does not support dry-run\", data->name);\n> +\n>         helper = get_helper(transport);\n>\n>         write_constant(helper->in, \"export\\n\");\n> --\n\nActually, looking to the future, there's nothing that prevents\nremote-helpers with 'export' to support dry-run, except this patch,\nso:\n\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -789,6 +789,11 @@ static int push_refs_with_export(struct transport\n*transport,\n        struct string_list revlist_args = STRING_LIST_INIT_NODUP;\n        struct strbuf buf = STRBUF_INIT;\n\n+       if (flags & TRANSPORT_PUSH_DRY_RUN) {\n+               if (set_helper_option(transport, \"dry-run\", \"true\") != 0)\n+                       die(\"helper %s does not support dry-run\", data->name);\n+       }\n+\n        helper = get_helper(transport);\n\n        write_constant(helper->in, \"export\\n\");\n\n-- \nFelipe Contreras\n"}]}