summaryrefslogtreecommitdiff
path: root/builtin/fetch-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-01 15:59:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-01 15:59:37 (GMT)
commite013bdab0fd388ec3d9faf2c3cd4ff3ce2a104d7 (patch)
tree725ac65017cbd98290b76d32c683b8b2d27d62f9 /builtin/fetch-pack.c
parent900c8ecb5c98c3cae256dcc030476392fdf2bbf2 (diff)
parent2ad23273e71ff708936bd924502186b8789a7289 (diff)
downloadgit-e013bdab0fd388ec3d9faf2c3cd4ff3ce2a104d7.zip
git-e013bdab0fd388ec3d9faf2c3cd4ff3ce2a104d7.tar.gz
git-e013bdab0fd388ec3d9faf2c3cd4ff3ce2a104d7.tar.bz2
Merge branch 'jk/pkt-line-cleanup'
Clean up pkt-line API, implementation and its callers to make them more robust. * jk/pkt-line-cleanup: do not use GIT_TRACE_PACKET=3 in tests remote-curl: always parse incoming refs remote-curl: move ref-parsing code up in file remote-curl: pass buffer straight to get_remote_heads teach get_remote_heads to read from a memory buffer pkt-line: share buffer/descriptor reading implementation pkt-line: provide a LARGE_PACKET_MAX static buffer pkt-line: move LARGE_PACKET_MAX definition from sideband pkt-line: teach packet_read_line to chomp newlines pkt-line: provide a generic reading function with options pkt-line: drop safe_write function pkt-line: move a misplaced comment write_or_die: raise SIGPIPE when we get EPIPE upload-archive: use argv_array to store client arguments upload-archive: do not copy repo name send-pack: prefer prefixcmp over memcmp in receive_status fetch-pack: fix out-of-bounds buffer offset in get_ack upload-pack: remove packet debugging harness upload-pack: do not add duplicate objects to shallow list upload-pack: use get_sha1_hex to parse "shallow" lines
Diffstat (limited to 'builtin/fetch-pack.c')
-rw-r--r--builtin/fetch-pack.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 670e81f..aba4465 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -119,14 +119,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--;
- add_sought_entry_mem(&sought, &nr_sought, &alloc_sought, line, n);
+ add_sought_entry(&sought, &nr_sought, &alloc_sought, line);
}
}
else {
@@ -147,7 +144,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, nr_sought, pack_lockfile_ptr);