git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH v7 2/3] git-remote-fd

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 13, 2010, 23:33 UTC
Message-ID
<7vzkuhfz1i.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1286901583-30088-3-git-send-email-ilari.liusvaara@elisanet.fi>
Ilari Liusvaara <ilari.liusvaara@elisanet.fi> writes:
Show 8 quoted lines
> diff --git a/Documentation/git-remote-fd.txt b/Documentation/git-remote-fd.txt
> new file mode 100644
> index 0000000..1c1a179
> --- /dev/null
> +++ b/Documentation/git-remote-fd.txt
> @@ -0,0 +1,59 @@
> +git-remote-fd(1)
> +=================

It appears to me that it has one equal sign too many. Does this format correctly?

> +ENVIRONMENT VARIABLES:
> +----------------------

I didn't follow the discussion closely but I recall somebody saying that the final colon is out of place, and I think I agree.

> +EXAMPLES:
> +---------
Likewise.
Show 41 quoted lines
> diff --git a/builtin/remote-fd.c b/builtin/remote-fd.c
> new file mode 100644
> index 0000000..7517f24
> --- /dev/null
> +++ b/builtin/remote-fd.c
> @@ -0,0 +1,79 @@
> +#include "git-compat-util.h"
> +#include "transport.h"
> +
> +/*
> + * URL syntax:
> + *	'fd::<inoutfd>[/<anything>]'		Read/write socket pair
> + *						<inoutfd>.
> + *	'fd::<infd>,<outfd>[/<anything>]'	Read pipe <infd> and write
> + *						pipe <outfd>.
> + *	[foo] indicates 'foo' is optional. <anything> is any string.
> + *
> + * The data output to <outfd>/<inoutfd> should be passed unmolested to
> + * git-receive-pack/git-upload-pack/git-upload-archive and output of
> + * git-receive-pack/git-upload-pack/git-upload-archive should be passed
> + * unmolested to <infd>/<inoutfd>.
> + *
> + */
> +
> +#define MAXCOMMAND 4096
> +
> +static void command_loop(int input_fd, int output_fd)
> +{
> +	char buffer[MAXCOMMAND];
> +
> +	while (1) {
> +		size_t i;
> +		if (!fgets(buffer, MAXCOMMAND - 1, stdin)) {
> +			if (ferror(stdin))
> +				die("Input error");
> +			return;
> +		}
> +		/* Strip end of line characters. */
> +		i = strlen(buffer);
> +		while (isspace(buffer[i - 1]))
> +			buffer[--i] = 0;

Hopefully you won't get a line with all space, going beyond the beginning of the buffer?

Show 8 quoted lines
> +int cmd_remote_fd(int argc, const char **argv, const char *prefix)
> +{
> +	int input_fd = -1;
> +	int output_fd = -1;
> +	char *end;
> +
> +	if (argc < 3)
> +		die("URL missing");
Is it Ok to have excess arguments to be ignored?
Previous: Ilari LiusvaaraNext: Ilari Liusvaara
Message 4 of 7 in “git-remote-fd & git-remote-ext”
  1. 0/3 git-remote-fd & git-remote-extIlari Liusvaara, Oct 12, 2010
  2. 1/3 Add bidirectional_transfer_loop()Ilari Liusvaara, Oct 12, 2010
  3. 2/3 git-remote-fdIlari Liusvaara, Oct 12, 2010
  4. Junio C HamanoOct 13, 2010
  5. 3/3 git-remote-extIlari Liusvaara, Oct 12, 2010
  6. Junio C HamanoOct 13, 2010
  7. remote-ext: do not segfault for blank linesJonathan Nieder, Jan 16, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.