summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-02-20 15:07:02 -0500
committerJunio C Hamano <gitster@pobox.com>2013-02-24 00:17:38 -0800
commit5dbf43602de31cac518607b4d9a04a40d7b154c8 (patch)
tree3906d79d888fb6938037d2cccc6d8d2399b66702 /remote-curl.c
parent85edf4f58b5368e2f2acc4bce0d10e1ca9d6c879 (diff)
downloadgit-5dbf43602de31cac518607b4d9a04a40d7b154c8.tar.gz
remote-curl: pass buffer straight to get_remote_heads
Until recently, get_remote_heads only knew how to read refs from a file descriptor. To hack around this, we spawned a thread (or forked a process) to write the buffer back to us. Now that we can just pass it our buffer directly, we don't have to use this hack anymore. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 24c86264d2..832f441b15 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -170,33 +170,11 @@ static struct discovery* discover_refs(const char *service)
return last;
}
-static int write_discovery(int in, int out, void *data)
-{
- struct discovery *heads = data;
- int err = 0;
- if (write_in_full(out, heads->buf, heads->len) != heads->len)
- err = 1;
- close(out);
- return err;
-}
-
static struct ref *parse_git_refs(struct discovery *heads, int for_push)
{
struct ref *list = NULL;
- struct async async;
-
- memset(&async, 0, sizeof(async));
- async.proc = write_discovery;
- async.data = heads;
- async.out = -1;
-
- if (start_async(&async))
- die("cannot start thread to parse advertised refs");
- get_remote_heads(async.out, NULL, 0, &list,
- for_push ? REF_NORMAL : 0, NULL);
- close(async.out);
- if (finish_async(&async))
- die("ref parsing thread failed");
+ get_remote_heads(-1, heads->buf, heads->len, &list,
+ for_push ? REF_NORMAL : 0, NULL);
return list;
}