summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c13
-rw-r--r--config.h3
-rw-r--r--remote.c3
-rwxr-xr-xt/t1308-config-set.sh2
-rw-r--r--upload-pack.c3
5 files changed, 13 insertions, 11 deletions
diff --git a/config.c b/config.c
index a922b13..f68eec7 100644
--- a/config.c
+++ b/config.c
@@ -1724,15 +1724,12 @@ static int do_git_config_sequence(const struct config_options *opts,
if (user_config && !access_or_die(user_config, R_OK, ACCESS_EACCES_OK))
ret += git_config_from_file(fn, user_config, data);
- current_parsing_scope = CONFIG_SCOPE_REPO;
+ current_parsing_scope = CONFIG_SCOPE_LOCAL;
if (!opts->ignore_repo && repo_config &&
!access_or_die(repo_config, R_OK, 0))
ret += git_config_from_file(fn, repo_config, data);
- /*
- * Note: this should have a new scope, CONFIG_SCOPE_WORKTREE.
- * But let's not complicate things before it's actually needed.
- */
+ current_parsing_scope = CONFIG_SCOPE_WORKTREE;
if (!opts->ignore_worktree && repository_format_worktree_config) {
char *path = git_pathdup("config.worktree");
if (!access_or_die(path, R_OK, 0))
@@ -3304,8 +3301,10 @@ const char *config_scope_name(enum config_scope scope)
return "system";
case CONFIG_SCOPE_GLOBAL:
return "global";
- case CONFIG_SCOPE_REPO:
- return "repo";
+ case CONFIG_SCOPE_LOCAL:
+ return "local";
+ case CONFIG_SCOPE_WORKTREE:
+ return "worktree";
case CONFIG_SCOPE_CMDLINE:
return "cmdline";
default:
diff --git a/config.h b/config.h
index c063f33..49297b5 100644
--- a/config.h
+++ b/config.h
@@ -298,7 +298,8 @@ enum config_scope {
CONFIG_SCOPE_UNKNOWN = 0,
CONFIG_SCOPE_SYSTEM,
CONFIG_SCOPE_GLOBAL,
- CONFIG_SCOPE_REPO,
+ CONFIG_SCOPE_LOCAL,
+ CONFIG_SCOPE_WORKTREE,
CONFIG_SCOPE_CMDLINE,
};
const char *config_scope_name(enum config_scope scope);
diff --git a/remote.c b/remote.c
index 5c4666b..593ce29 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);
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index 7b4e1a6..90196e2 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -259,7 +259,7 @@ test_expect_success 'iteration shows correct origins' '
value=from-repo
origin=file
name=.git/config
- scope=repo
+ scope=local
key=foo.bar
value=from-cmdline
diff --git a/upload-pack.c b/upload-pack.c
index a00d7ec..c53249c 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1073,7 +1073,8 @@ static int upload_pack_config(const char *var, const char *value, void *unused)
precomposed_unicode = git_config_bool(var, value);
}
- if (current_config_scope() != CONFIG_SCOPE_REPO) {
+ if (current_config_scope() != CONFIG_SCOPE_LOCAL &&
+ current_config_scope() != CONFIG_SCOPE_WORKTREE) {
if (!strcmp("uploadpack.packobjectshook", var))
return git_config_string(&pack_objects_hook, var, value);
}