diff options
author | Jeff King <peff@peff.net> | 2016-05-18 18:44:23 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-27 10:45:40 -0700 |
commit | 9acc5911119ec0209877fbaa0a1e68aa714c191e (patch) | |
tree | 9a5bb0455b12bfd3e6fb3fdf4a6c0aca1af0992c /t/t4018/README | |
parent | config: return configset value for current_config_ functions (diff) | |
download | tgif-9acc5911119ec0209877fbaa0a1e68aa714c191e.tar.xz |
config: add a notion of "scope"
A config callback passed to git_config() doesn't know very
much about the context in which it sees a variable. It can
ask whether the variable comes from a file, and get the file
name. But without analyzing the filename (which is hard to
do accurately), it cannot tell whether it is in system-level
config, user-level config, or repo-specific config.
Generally this doesn't matter; the point of not passing this
to the callback is that it should treat the config the same
no matter where it comes from. But some programs, like
upload-pack, are a special case: we should be able to run
them in an untrusted repository, which means we cannot use
any "dangerous" config from the repository config file (but
it is OK to use it from system or user config).
This patch teaches the config code to record the "scope" of
each variable, and make it available inside config
callbacks, similar to how we give access to the filename.
The scope is the starting source for a particular parsing
operation, and remains the same even if we include other
files (so a .git/config which includes another file will
remain CONFIG_SCOPE_REPO, as it would be similarly
untrusted).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018/README')
0 files changed, 0 insertions, 0 deletions