"Glen Choo via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: Glen Choo <chooglen@xxxxxxxxxx> > > plumb "kvi" so that we can replace > nearly all calls to current_config_*(). (The exception is an edge case > where trace2/*.c calls current_config_scope(). Probably clearer to say: plumb "kvi" so that we can remove all calls of current_config_scope() except from trace2/*.c (which will be handled in a later commit), and remove all other current_config_*() (the functions themselves and their calls). > Plumbing "kvi" reveals a few places where we've been doing the wrong > thing: > > * git_config_parse_parameter() hasn't been setting config source > information, so plumb "kvi" there too. > > * "git config --get-urlmatch --show-scope" iterates config to collect > values, but then attempts to display the scope after config iteration. > Fix this by copying the "kvi" arg in the collection phase so that it > can be read back later. This means that we can now support "git config > --get-urlmatch --show-origin" (we don't allow this combination of args > because of this bug), but that is left unchanged for now. > > * "git config --default" doesn't have config source metadata when > displaying the default value. Fix this by treating the default value > as if it came from the command line (e.g. like we do with "git -c" or > "git config --file"), using kvi_from_param(). > > Signed-off-by: Glen Choo <chooglen@xxxxxxxxxx> Thanks for noticing and fixing these. > + memcpy(&matched->kvi, kvi, sizeof(struct key_value_info)); Can this just be matched->kvi = *kvi; ? If not, for the sizeof, use *kvi as the argument instead of struct key_value_info.