summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorMatthew Rogers <mattr94@gmail.com>2020-02-10 00:30:54 +0000
committerJunio C Hamano <gitster@pobox.com>2020-02-10 10:32:20 -0800
commit6dc905d97431d683b418978819629a2626555b2e (patch)
treee0c0ccd015ec1f1471b40ed42d0fb8e562f8eb1f /remote.c
parenta5cb4204b63b57e99ae3a44f23a7945f146fe078 (diff)
downloadgit-6dc905d97431d683b418978819629a2626555b2e.tar.gz
config: split repo scope to local and worktree
Previously when iterating through git config variables, worktree config and local config were both considered "CONFIG_SCOPE_REPO". This was never a problem before as no one had needed to differentiate between the two cases, but future functionality may care whether or not the config options come from a worktree or from the repository's actual local config file. For example, the planned feature to add a '--show-scope' to config to allow a user to see which scope listed config options come from would confuse users if it just printed 'repo' rather than 'local' or 'worktree' as the documentation would lead them to expect. As well as the additional benefit of making the implementation look more like how the documentation describes the interface. To accomplish this we split out what was previously considered repo scope to be local and worktree. The clients of 'current_config_scope()' who cared about CONFIG_SCOPE_REPO are also modified to similarly care about CONFIG_SCOPE_WORKTREE and CONFIG_SCOPE_LOCAL to preserve previous behavior. Signed-off-by: Matthew Rogers <mattr94@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index 5c4666b53a..593ce297ed 100644
--- a/remote.c
+++ b/remote.c
@@ -369,7 +369,8 @@ static int handle_config(const char *key, const char *value, void *cb)
}
remote = make_remote(name, namelen);
remote->origin = REMOTE_CONFIG;
- if (current_config_scope() == CONFIG_SCOPE_REPO)
+ if (current_config_scope() == CONFIG_SCOPE_LOCAL ||
+ current_config_scope() == CONFIG_SCOPE_WORKTREE)
remote->configured_in_repo = 1;
if (!strcmp(subkey, "mirror"))
remote->mirror = git_config_bool(key, value);