summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-05 13:12:57 -0800
committerJunio C Hamano <gitster@pobox.com>2015-03-05 13:12:57 -0800
commit6db0497e1a8913fdcb935fa50cc8971d64b347be (patch)
treebfc102f035b924fa5a18fe8425911affdba9867a /transport-helper.c
parentaaa90f5f077a2b5da2bb750566bf69b330441e0c (diff)
parent33cae5428ab504e318cfac880d59e0bda58590d7 (diff)
downloadgit-6db0497e1a8913fdcb935fa50cc8971d64b347be.tar.gz
Merge branch 'mh/deref-symref-over-helper-transport' into maint
"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
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 3652b164c3..3b90ebadb9 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -355,7 +355,8 @@ static int fetch_with_fetch(struct transport *transport,
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 +454,8 @@ static int fetch_with_import(struct transport *transport,
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);
}
@@ -486,14 +488,15 @@ static int fetch_with_import(struct transport *transport,
* 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);