transport-helper: check if the dry-run is supported

Certain remote-helpers (the ones with 'export') would try to push regardless. Obviously this is not what the user wants. Also, add a check for the 'dry-run' option, so remote-helpers can implement it. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed May 20, 2013 at 20:32 UTC 21457f5719b894a5997d66ff098b375bc2404260
1 file changed +5
transport-helper.c
+5
@@ -789,6 +789,11 @@ static int push_refs_with_export(struct transport *transport,
789 struct string_list revlist_args = STRING_LIST_INIT_NODUP;
790 struct strbuf buf = STRBUF_INIT;
791
792 + if (flags & TRANSPORT_PUSH_DRY_RUN) {
793 + if (set_helper_option(transport, "dry-run", "true") != 0)
794 + die("helper %s does not support dry-run", data->name);
795 + }
796 +
797 helper = get_helper(transport);
798
799 write_constant(helper->in, "export\n");