diff --git a/connect.c b/connect.c
index 941bf296b0d5a8ded60cea0ed61770dc909d2d88..075683e83c48282dfbd2626e89047af398cc7e4d 100644 (file)
--- a/connect.c
+++ b/connect.c
#include "cache.h"
+#include "pkt-line.h"
#include <sys/wait.h>
+int get_ack(int fd, unsigned char *result_sha1)
+{
+ static char line[1000];
+ int len = packet_read_line(fd, line, sizeof(line));
+
+ if (!len)
+ die("git-fetch-pack: expected ACK/NAK, got EOF");
+ if (line[len-1] == '\n')
+ line[--len] = 0;
+ if (!strcmp(line, "NAK"))
+ return 0;
+ if (!strncmp(line, "ACK ", 3)) {
+ if (!get_sha1_hex(line+4, result_sha1))
+ return 1;
+ }
+ die("git-fetch_pack: expected ACK/NAK, got '%s'", line);
+}
+
int path_match(const char *path, int nr, char **match)
{
int i;