From: Greg Brockman Date: Wed, 14 Jul 2010 17:42:49 GMT Subject: Re: [PATCH/RFC 1/4] Allow creation of arbitrary git-shell commands Message-ID: In-Reply-To: <7vbpaaytfl.fsf@alter.siamese.dyndns.org> >> This provides a mechanism for the server to expose custom >> functionality to clients.  My particular use case is that I would like >> a way of discovering all repositories available for cloning.  A >> client that clones via >>   git clone user@example.com >> can invoke a command by >>   ssh user@example.com $command > > Please have a blank line above and below sample command display like these > for readability. Sounds good. >> +     /* Shell should be spawned with cwd in the git user's home directory */ >> +     if (chdir(COMMAND_DIR)) >> +             die("unrecognized command '%s'", prog); > > Hmm, could you justify "should be" above please? > > An example would be "All of the custom commands I wrote to give added > features to users at my installation wanted to be in that directory, not > at the user's home directory, as they mostly operated on files in that > directory", but please do not make me (or other reviewers) guess why. > > What I am getting at is that it may be more natural and useful to run > these custom commands in the user's $HOME directory---you would need to > make sure that execl() finds the command you get from the request, perhaps > by prefixing COMMAND_DIR / to the command name, though. Err, good point. The commands I wrote end up running 'cd ..' anyway :). Instead just running these commands in the user's $HOME does make a lot more sense. Thanks everyone for the comments thus far.