Re: [PATCH v2 4/4] upload-archive: use start_command instead of fork
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Jul 28, 2011, 08:32 UTC
- Message-ID
- <CABPQNSYtpRpNQVW=QvyfFhmWge5-C+k85bs2EJeK8k0jdfHzrw@mail.gmail.com>
- In-Reply-To
- <7vmxga7zb9.fsf@alter.siamese.dyndns.org>
Sorry for the late reply. Things have been a bit hectic here in Oslo over the last week.
On Tue, Jul 19, 2011 at 11:09 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 45 quoted lines
> Erik Faye-Lund <kusmabite@gmail.com> writes:
>
>> @@ -18,28 +19,16 @@ static const char lostchild[] =
>>
>> #define MAX_ARGS (64)
>>
>> -static int run_upload_archive(int argc, const char **argv, const char *prefix)
>> +static void prepare_argv(const char **sent_argv, const char **argv)
>> {
>> - const char *sent_argv[MAX_ARGS];
>> const char *arg_cmd = "argument ";
>> char *p, buf[4096];
>> int sent_argc;
>> int len;
>>
>> - if (argc != 2)
>> - usage(upload_archive_usage);
>> -
>> - if (strlen(argv[1]) + 1 > sizeof(buf))
>> - die("insanely long repository name");
>> -
>> - strcpy(buf, argv[1]); /* enter-repo smudges its argument */
>> -
>> - if (!enter_repo(buf, 0))
>> - die("'%s' does not appear to be a git repository", buf);
>> -
>> /* put received options in sent_argv[] */
>> sent_argc = 1;
>> - sent_argv[0] = "git-upload-archive";
>> + sent_argv[0] = "archive";
>> for (p = buf;;) {
>> /* This will die if not enough free space in buf */
>> len = packet_read_line(0, p, (buf + sizeof buf) - p);
>> @@ -62,9 +51,6 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
>> *p++ = 0;
>> }
>> sent_argv[sent_argc] = NULL;
>> -
>> - /* parse all options sent by the client */
>> - return write_archive(sent_argc, sent_argv, prefix, 0);
>> }
>
> Hmm, how well would this change work with recent archive-filter work by
> Peff, especially with the "when remote, disable some features" bits?
>Thanks for the notice. And no, not at all :(
OK then. I'll probably have to rewrite this to use start_async + dup-bonanza instead of start_command...