summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2010-08-05 22:40:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-09 16:11:44 (GMT)
commit302ad7a9930a34413418b6436f96826070367647 (patch)
tree5cd126308137179d75632405e3c084950d8c4e34 /submodule.c
parentaee9c7d6540fe6f66fbbe7be420caa26ae0fa2d9 (diff)
downloadgit-302ad7a9930a34413418b6436f96826070367647.zip
git-302ad7a9930a34413418b6436f96826070367647.tar.gz
git-302ad7a9930a34413418b6436f96826070367647.tar.bz2
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>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index ff28630..dc0f95b 100644
--- a/submodule.c
+++ b/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;