teach get_remote_heads to read from a memory buffer
[gitweb.git] / builtin / fetch-pack.c
index 940ae35dc2ce4923a248896eb764f145312d71b4..03ed2caae33886078b8182ef46c33f07cf3d56a0 100644 (file)
@@ -100,14 +100,11 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
                        /* in stateless RPC mode we use pkt-line to read
                         * from stdin, until we get a flush packet
                         */
-                       static char line[1000];
                        for (;;) {
-                               int n = packet_read_line(0, line, sizeof(line));
-                               if (!n)
+                               char *line = packet_read_line(0, NULL);
+                               if (!line)
                                        break;
-                               if (line[n-1] == '\n')
-                                       n--;
-                               string_list_append(&sought, xmemdupz(line, n));
+                               string_list_append(&sought, xstrdup(line));
                        }
                }
                else {
@@ -128,7 +125,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
                                   args.verbose ? CONNECT_VERBOSE : 0);
        }
 
-       get_remote_heads(fd[0], &ref, 0, NULL);
+       get_remote_heads(fd[0], NULL, 0, &ref, 0, NULL);
 
        ref = fetch_pack(&args, fd, conn, ref, dest,
                         &sought, pack_lockfile_ptr);