Junio C Hamano <gitster@xxxxxxxxx> writes: > > Lidong Yan <yldhome2d2@xxxxxxxxx> writes: > >> Bryan Lee <hi@xxxxxxxxxx> wrote: >>> >>> Would it be worthwhile to: >>> 1. Add a warning when users set non-existent configuration keys? >>> 2. Or at least document common misconceptions like `pull.autostash` in >>> the git-config man page? >> >> I think adding a subcommand like ‘git config verify’ might be a way to >> solve this problem. > > Yes, but I do not know if it is feasible. > > There always are end-user or third-party defined keys that are not > known to us, and we cannot tell if an unknown variable is such a > end-user defined one or a typo of a known one. For every git_xxx_config(), we could add a register function like git_xxx_config_register(), which looks like: int git_xxx_config_register() { struct key_ent ent; register_bool_key("key1"); register_int_key("key2”); register_date_key("key3”); ent.key = “key4”; ent.desp = “key4_desp"; ent.verify_fn = &verify_key4_value; register_key(ent); } And then end-user could define their own register function as well so that they could also use `git config verify` to verify their own config <key, value>. Or end-user could provide a .gitconfigspec and `git config verify` will load .gitconfigspec to verify whether there exists some invalid config <k, v> pair. - Lidong