Re: [RFC PATCH v7 2/3] git-remote-fd
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:47
Ilari Liusvaara [off-list ref] writes:
quoted hunk ↗ jump to hunk
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.
quoted hunk ↗ jump to hunk
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?
+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?