]> granicus.if.org Git - git/commitdiff
Merge branch 'fc/transport-helper-no-refspec'
authorJunio C Hamano <gitster@pobox.com>
Thu, 6 Jun 2013 19:17:22 +0000 (12:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Jun 2013 19:17:22 +0000 (12:17 -0700)
With "export" remote-helper protocol,

 (1) a push that tries to update a remote ref whose name is
     different from the pushing side does not work yet, and

 (2) the helper may not know how to do --dry-run

Detect such problematic cases and disable them for now.

* fc/transport-helper-no-refspec:
  transport-helper: check if the dry-run is supported
  transport-helper: barf when user tries old:new

1  2 
transport-helper.c

index 2f5ac3fbeefd65c61c9e9c89f97896f9dfac89c5,f08eff0ab6172e36ed6b3e4dafe73c776f5868d9..06c08a1786391e7a04fa566af0cf42c659ed8aa9
@@@ -806,9 -789,11 +806,14 @@@ static int push_refs_with_export(struc
        struct string_list revlist_args = STRING_LIST_INIT_NODUP;
        struct strbuf buf = STRBUF_INIT;
  
 +      if (!data->refspecs)
 +              die("remote-helper doesn't support push; refspec needed");
 +
+       if (flags & TRANSPORT_PUSH_DRY_RUN) {
+               if (set_helper_option(transport, "dry-run", "true") != 0)
+                       die("helper %s does not support dry-run", data->name);
+       }
        helper = get_helper(transport);
  
        write_constant(helper->in, "export\n");
                }
                free(private);
  
-               if (ref->peer_ref)
 -              if (ref->deletion) {
++              if (ref->deletion)
+                       die("remote-helpers do not support ref deletion");
 -              }
+               if (ref->peer_ref) {
+                       if (strcmp(ref->peer_ref->name, ref->name))
+                               die("remote-helpers do not support old:new syntax");
                        string_list_append(&revlist_args, ref->peer_ref->name);
+               }
        }
  
        if (get_exporter(transport, &exporter, &revlist_args))