summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8655158)
raw | patch | inline | side by side (parent: 8655158)
author | Julian Phillips <jp3@quantumfyre.co.uk> | |
Tue, 13 Feb 2007 01:21:39 +0000 (01:21 +0000) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 14 Feb 2007 05:43:53 +0000 (21:43 -0800) |
If the reflist is "-" then read the reflist data from stdin instead,
this will allow the passing of more than 128K of reflist data - which
won't fit in the environment passed by execve.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
this will allow the passing of more than 128K of reflist data - which
won't fit in the environment passed by execve.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-fetch--tool.c | patch | blob | history |
diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index 3090ffea205c625a05c02d78e94ab60ce0b765c7..48de08d858ca53fa369c44a79f73ec325566f36f 100644 (file)
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
#include "refs.h"
#include "commit.h"
+#define CHUNK_SIZE (1048576)
+
+static char *get_stdin(void)
+{
+ char *data = xmalloc(CHUNK_SIZE);
+ int offset = 0, read = 0;
+ read = xread(0, data, CHUNK_SIZE);
+ while (read == CHUNK_SIZE) {
+ offset += CHUNK_SIZE;
+ data = xrealloc(data, offset + CHUNK_SIZE);
+ read = xread(0, data + offset, CHUNK_SIZE);
+ }
+ return data;
+}
+
static void show_new(char *type, unsigned char *sha1_new)
{
fprintf(stderr, " %s: %s\n", type,
return result;
}
if (!strcmp("parse-reflist", argv[1])) {
+ const char *reflist;
if (argc != 3)
return error("parse-reflist takes 1 arg");
- return parse_reflist(argv[2]);
+ reflist = argv[2];
+ if (!strcmp(reflist, "-"))
+ reflist = get_stdin();
+ return parse_reflist(reflist);
}
if (!strcmp("expand-refs-wildcard", argv[1])) {
+ const char *reflist;
if (argc < 4)
return error("expand-refs-wildcard takes at least 2 args");
- return expand_refs_wildcard(argv[2], argc - 3, argv + 3);
+ reflist = argv[2];
+ if (!strcmp(reflist, "-"))
+ reflist = get_stdin();
+ return expand_refs_wildcard(reflist, argc - 3, argv + 3);
}
return error("Unknown subcommand: %s", argv[1]);