Submodules: Use "ignore" settings from .gitmodules too for diff and status
The .gitmodules file is parsed for "submodule.<name>.ignore" entries before looking for them in .git/config. Thus settings found in .git/config will override those from .gitmodules, thereby allowing the local developer to ignore settings given by the remote side while also letting upstream set defaults for those users who don't have special needs. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
aee9c7d654
commit
302ad7a993
19
submodule.c
19
submodule.c
@ -62,6 +62,25 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
|
||||
}
|
||||
}
|
||||
|
||||
static int submodule_config(const char *var, const char *value, void *cb)
|
||||
{
|
||||
if (!prefixcmp(var, "submodule."))
|
||||
return parse_submodule_config_option(var, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gitmodules_config(void)
|
||||
{
|
||||
const char *work_tree = get_git_work_tree();
|
||||
if (work_tree) {
|
||||
struct strbuf gitmodules_path = STRBUF_INIT;
|
||||
strbuf_addstr(&gitmodules_path, work_tree);
|
||||
strbuf_addstr(&gitmodules_path, "/.gitmodules");
|
||||
git_config_from_file(submodule_config, gitmodules_path.buf, NULL);
|
||||
strbuf_release(&gitmodules_path);
|
||||
}
|
||||
}
|
||||
|
||||
int parse_submodule_config_option(const char *var, const char *value)
|
||||
{
|
||||
int len;
|
||||
|
Reference in New Issue
Block a user