Skip to content

Commit dd37624

Browse files
committed
submodule-config: add subomdule config scope
Before the changes to teach git_config_source to remember scope information submodule-config.c never needed to consider the question of config scope. Even though zeroing out git_config_source is still correct and preserved the previous behavior of setting the scope to CONFIG_SCOPE_UNKNOWN, it's better to be explicit about such situations by explicitly setting the scope. As none of the current config_scope enumerations make sense we create CONFIG_SCOPE_SUBMODULE to describe the situation. Signed-off-by: Matthew Rogers <[email protected]>
1 parent 6c59c5c commit dd37624

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

config.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3311,6 +3311,8 @@ const char *config_scope_name(enum config_scope scope)
33113311
return "worktree";
33123312
case CONFIG_SCOPE_COMMAND:
33133313
return "command";
3314+
case CONFIG_SCOPE_SUBMODULE:
3315+
return "submodule";
33143316
default:
33153317
return "unknown";
33163318
}

config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ enum config_scope {
4242
CONFIG_SCOPE_LOCAL,
4343
CONFIG_SCOPE_WORKTREE,
4444
CONFIG_SCOPE_COMMAND,
45+
CONFIG_SCOPE_SUBMODULE,
4546
};
4647
const char *config_scope_name(enum config_scope scope);
4748

submodule-config.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,9 @@ static void submodule_cache_check_init(struct repository *repo)
635635
static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void *data)
636636
{
637637
if (repo->worktree) {
638-
struct git_config_source config_source = { 0 };
638+
struct git_config_source config_source = {
639+
0, .scope = CONFIG_SCOPE_SUBMODULE
640+
};
639641
const struct config_options opts = { 0 };
640642
struct object_id oid;
641643
char *file;

0 commit comments

Comments
 (0)