Re: [PATCH/RFC 1/4] Allow creation of arbitrary git-shell commands
- From
Greg Brockman <gdb@mit.edu>
- Date
- Jul 14, 2010, 17:42 UTC
- Message-ID
- <AANLkTimAkSB1bysyE6R3CWp-U3vk_S5L0CbMhIWXJfHE@mail.gmail.com>
- In-Reply-To
- <7vbpaaytfl.fsf@alter.siamese.dyndns.org>
Show 10 quoted lines
>> 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.
Show 15 quoted lines
>> + /* 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.