From: "Shawn O. Pearce" <spearce@spearce.org>
To: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH v2 4/8] Support remote helpers implementing smart transports
Date: Fri, 4 Dec 2009 10:37:13 -0800 [thread overview]
Message-ID: <20091204183713.GE1483@spearce.org> (raw)
In-Reply-To: <1259942168-24869-7-git-send-email-ilari.liusvaara@elisanet.fi>
Ilari Liusvaara <ilari.liusvaara@elisanet.fi> wrote:
>
> +'connect' <service>::
> + Connects to given service. Stdin and stdout of helper are
> + connected to specified service (git prefix is included in service
> + name so e.g. fetching uses 'git-upload-pack' as service) on
> + remote side. Valid replies to this command are empty line
> + (connection established), 'FALLBACK' (no smart transport support,
Why not 'fallback' to remain consistent with this protocol and many
others in git where we stick to lowercase ASCII?
> + fall back to dumb transports) and just exiting with error message
> + printed (can't connect, don't bother trying to fall back). After
> + line feed terminating the positive (empty) response, the output
> + of service starts. After the connection ends, the remote
> + helper exits. Note that to prevent deadlocking, all read data
> + should be immediately flushed to outgoing connection (excepting
> + remote initial advertisments, which should be flushed on first
> + flush packet (0000 as length) encountered.
Why is the initial advertisement special? If the helper always
flushes both sides, it shouldn't ever deadlock the protocol. Also,
note that a helper should be able to implement a tiny delay like
Nagle's algorithm does in TCP. It just can't sit on a byte forever.
> @@ -72,7 +73,10 @@ static struct child_process *get_helper(struct transport *transport)
> helper->argv = xcalloc(4, sizeof(*helper->argv));
> strbuf_addf(&buf, "remote-%s", data->name);
> helper->argv[0] = strbuf_detach(&buf, NULL);
> - helper->argv[1] = transport->remote->name;
> + if(transport->remote)
> + helper->argv[1] = transport->remote->name;
> + else
> + helper->argv[1] = "";
This hunk appears to be unrelated. And actually, if transport has
no remote, shouldn't the arg here be NULL so the helper gets only
1 argument and not 2 arguments?
> +static int _process_connect(struct transport *transport,
> + const char *name, const char *exec)
> +{
> + struct helper_data *data = transport->data;
> + struct strbuf cmdbuf = STRBUF_INIT;
> + struct child_process *helper;
> + int r;
> +
> + helper = get_helper(transport);
> +
> + /* Handle --upload-pack and friends. This is fire and forget...
> + just warn if it fails. */
> + if(exec && strcmp(name, exec)) {
> + r = set_helper_option(transport, "servpath", exec);
> + if(r > 0)
> + fprintf(stderr, "Warning: Setting remote service path "
> + "not supported by protocol.\n");
> + else if(r < 0)
> + fprintf(stderr, "Warning: Invalid remote service "
> + "path.\n");
> + }
I think exec winds up defaulting to name if --upload-pack was not
used on the command line, and remote.$name.uploadpack was not set.
See transport.c where you initialize the git options struct, these
fields were defaulted in.
My point is, we shouldn't send option servpath to the helper if
name is equal to servpath, because the helper might not support
servpath and the option command will issue a warning above for no
reason at all.
--
Shawn.
next prev parent reply other threads:[~2009-12-04 18:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 15:55 [RFC PATCH v2 0/8] Remote helpers smart transport extensions Ilari Liusvaara
2009-12-04 15:55 ` Ilari Liusvaara
2009-12-04 15:56 ` Ilari Liusvaara
2009-12-04 15:56 ` [RFC PATCH v2 1/8] Pass unknown protocols to external protocol handlers Ilari Liusvaara
2009-12-04 16:01 ` Sverre Rabbelier
2009-12-04 17:55 ` Shawn O. Pearce
2009-12-05 13:17 ` Ilari Liusvaara
2009-12-04 15:56 ` [RFC PATCH v2 2/8] Refactor git transport options parsing Ilari Liusvaara
2009-12-04 15:56 ` [RFC PATCH v2 3/8] Support taking over transports Ilari Liusvaara
2009-12-04 18:27 ` Shawn O. Pearce
2009-12-05 13:18 ` Ilari Liusvaara
2009-12-04 15:56 ` [RFC PATCH v2 4/8] Support remote helpers implementing smart transports Ilari Liusvaara
2009-12-04 18:37 ` Shawn O. Pearce [this message]
2009-12-05 13:16 ` Ilari Liusvaara
2009-12-04 15:56 ` [RFC PATCH v2 5/8] Support remote archive from external protocol helpers Ilari Liusvaara
2009-12-04 15:56 ` [RFC PATCH v2 6/8] Remove special casing of http, https and ftp Ilari Liusvaara
2009-12-04 16:05 ` Sverre Rabbelier
2009-12-04 15:56 ` [RFC PATCH v2 7/8] Add remote helper debug mode Ilari Liusvaara
2009-12-04 16:03 ` Sverre Rabbelier
2009-12-04 15:56 ` [RFC PATCH v2 8/8] Support mandatory capabilities Ilari Liusvaara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091204183713.GE1483@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=ilari.liusvaara@elisanet.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).