static int receive_status(int in, struct ref *refs)
{
struct ref *hint;
- char line[1000];
int ret = 0;
- int len = packet_read_line(in, line, sizeof(line));
+ char *line = packet_read_line(in, NULL);
if (prefixcmp(line, "unpack "))
return error("did not receive remote status");
- if (strcmp(line, "unpack ok\n")) {
- char *p = line + strlen(line) - 1;
- if (*p == '\n')
- *p = '\0';
+ if (strcmp(line, "unpack ok")) {
error("unpack failed: %s", line + 7);
ret = -1;
}
while (1) {
char *refname;
char *msg;
- len = packet_read_line(in, line, sizeof(line));
- if (!len)
+ line = packet_read_line(in, NULL);
+ if (!line)
break;
if (prefixcmp(line, "ok ") && prefixcmp(line, "ng ")) {
error("invalid ref status from remote: %s", line);
break;
}
- line[strlen(line)-1] = '\0';
refname = line + 3;
msg = strchr(refname, ' ');
if (msg)