On Wed, Feb 4, 2009 at 5:18 PM, Jeff King <peff@peff.net> wrote:
Show 38 quoted lines
> On Wed, Feb 04, 2009 at 05:03:22PM +0200, Felipe Contreras wrote:
>
>> > With this patch, won't I get different behavior from:
>> >
>> > git config -e --global
>> >
>> > versus
>> >
>> > git config --global -e
>>
>> Just like you get different behavior from:
>>
>> git config -l --global
>>
>> and
>>
>> git config --global -l
>
> Ugh. Personally I consider such interfaces poorly designed. I understand
> that the general way "git config" works is to have "git config [options]
> [action]". And when "[action]" is a variable name, or a variable name
> with a value, it is easy to see what's going on. But when the action
> looks like an option, it is just confusing that their ordering is
> important.
>
> However, the interface to "git config" is not going to change, so I
> think your following existing practice is reasonable here.
>
> _But_ there is one important difference between your "-e" and "-l". In
> the "-l" case, we detect that there is extra trailing cruft that will be
> ignored and give a usage message. So "git config -l --global"
> complains, but "git config -e --global" silently ignores the second
> argument. I think you just need to add
>
> if (argc != 2)
> usage(git_config_set_usage);
>
> as the "-l" code does.