Merge branch 'mh/deref-symref-over-helper-transport' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2015 21:12:57 +0000 (13:12 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2015 21:12:57 +0000 (13:12 -0800)
"git fetch" over a remote-helper that cannot respond to "list"
command could not fetch from a symbolic reference e.g. HEAD.

* mh/deref-symref-over-helper-transport:
transport-helper: do not request symbolic refs to remote helpers

1  2 
transport-helper.c
diff --combined transport-helper.c
index 3652b164c3b87330ae074dacc8ee8e25c518ed60,27c82f73ace01c750325b9d6e4cb51b703642f15..3b90ebadb907de4f5f20177de560211d1e770ed6
@@@ -5,6 -5,7 +5,6 @@@
  #include "commit.h"
  #include "diff.h"
  #include "revision.h"
 -#include "quote.h"
  #include "remote.h"
  #include "string-list.h"
  #include "thread-utils.h"
@@@ -355,7 -356,8 +355,8 @@@ static int fetch_with_fetch(struct tran
                        continue;
  
                strbuf_addf(&buf, "fetch %s %s\n",
-                           sha1_to_hex(posn->old_sha1), posn->name);
+                           sha1_to_hex(posn->old_sha1),
+                           posn->symref ? posn->symref : posn->name);
        }
  
        strbuf_addch(&buf, '\n');
@@@ -453,7 -455,8 +454,8 @@@ static int fetch_with_import(struct tra
                if (posn->status & REF_STATUS_UPTODATE)
                        continue;
  
-               strbuf_addf(&buf, "import %s\n", posn->name);
+               strbuf_addf(&buf, "import %s\n",
+                           posn->symref ? posn->symref : posn->name);
                sendline(data, &buf);
                strbuf_reset(&buf);
        }
         * fast-forward or this is a forced update.
         */
        for (i = 0; i < nr_heads; i++) {
-               char *private;
+               char *private, *name;
                posn = to_fetch[i];
                if (posn->status & REF_STATUS_UPTODATE)
                        continue;
+               name = posn->symref ? posn->symref : posn->name;
                if (data->refspecs)
-                       private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
+                       private = apply_refspecs(data->refspecs, data->refspec_nr, name);
                else
-                       private = xstrdup(posn->name);
+                       private = xstrdup(name);
                if (private) {
                        read_ref(private, posn->old_sha1);
                        free(private);