"git foo_bar" prints two config errors

From: Mikael Magnusson <hidden>
Date: 2016-06-15 23:02:49

% git foo_bar
error: invalid key: pager.foo_bar
error: invalid key: alias.foo_bar
git: 'foo_bar' is not a git command. See 'git --help'.

git.c calls alias_lookup() and check_pager_config() resulting in calls
to git_config_parse_key() with the above keys. I looked at the code
and it's not immediately obvious how to suppress the error in this
particular case. You also get an error for the empty argument and
anything that isn't (isalnum || '-') (I discovered the _ case by
accidentally leaving out the 'grep' before searching for a function),

% git ''; git の
error: key does not contain variable name: pager.
error: key does not contain variable name: alias.
git: '' is not a git command. See 'git --help'.
error: invalid key: pager.の
error: invalid key: alias.の
git: 'の' is not a git command. See 'git --help'.

but,
% ln -s /bin/tty ~/bin/git-の; ln -s /bin/tty ~/bin/git-foo_bar
% git の
error: invalid key: pager.の
/dev/pts/51
% git foo_bar
error: invalid key: pager.foo_bar
/dev/pts/51

The command itself is accepted, so I think we shouldn't print the errors.

-- 
Mikael Magnusson
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help