From: Gabriel Filion Date: Mon, 22 Feb 2010 04:42:54 GMT Subject: Re: RFD: git-bzr: anyone interested? Message-ID: <4B820B4E.7050405@gmail.com> In-Reply-To: <20100219135549.GA31796@Knoppix> On 2010-02-19 08:55, Ilari Liusvaara wrote: > On Fri, Feb 19, 2010 at 02:05:58AM -0500, Gabriel Filion wrote: >> >> The Documentation/git-remote-helpers.txt file wasn't really of much help >> .. It really only barely scratches the subject, but it does not mention >> how remote-helpers really work internally (e.g. how do they get called: >> based on protocol used in URLs?) >> >> I'm still trying to dig up information about how to actually build, test >> and use a remote helper. I'll probably be reading code for examples. > > The remote helper is invoked with one or two parameters. > > There are five cases to consider (as rule, first argument is name of > remote [pseudo-remote in case URL was used] and the second argument is > URL to use, if any): > > 1) Remote without URL line but with VCS line value was used. > > The called program: git-remote- [search $PATH for it]. > Number of arguements: 1 > 1st argument: > > 2) Remote with URL using :: syntax was used. > > The called program: git-remote- [search $PATH for it]. > Number of arguments: 2 > 1st argument: > 2st argument: > > 3) Remote with URL using :// syntax was used. > > The called program: git-remote- [serch $PATH for it]. > Number of arguments: 2 > 1st argument: > 2st argument: :// > > 4) URL using :: syntax was used directly on command line. > > The called program: git-remote- [serch $PATH for it]. > Number of arguments: 2 > 1st argument: :: > 2st argument: > > 5) URL using :// syntax was used directly on command > line. > > The called program: git-remote- [serch $PATH for it]. > Number of arguments: 2 > 1st argument: :// > 2st argument: :// > > > Notes: > > - For 2) and 4), the helper name can only contain alphanumeric characters > 0-9, A-Z and a-z. > - For 3) and 5), the helper name can't be any of builtin protocols: > 'rsync', 'file', 'git', 'ssh', 'git+ssh' nor 'ssh+git'. > - :: is the strongest, followed by VCS line, > ::// is weakest. > This will prove quite useful! This summary should be inspired upon to add details about how remote helpers are called in the documentation. I created a dummy remote helper script to test how things are called. I was successful in having a remote created with URL bzr://some.server/path to be handed down to the script git-remote-bzr. However, when I tried creating a git-remote-bzr+ssh link pointing to the git-remote-bzr script so that URLs like bzr+ssh://something/somewhere (this is how ssh is used with Bazaar) got handed down to the dummy script, it kept saying the "bzr+ssh" protocol wasn't handled. So, it would seem I can't have special characters in the helper script name. How could I get this protocol to be handled by the remote helper? Having to type bzr::bzr+ssh://something/somewhere looks like a really awkward thing to write. Also, requiring users to add something to a protocol that already identifies the type of remote repository (and, that is already well known and used by users of bzr) is not interesting in a usability point of view. -- Gabriel Filion