Tanay Abhra <[email protected]> writes:
> I am searching for a more elegant solution to this problem.
The "efficient" (not sure about elegant) solution would be to keep one
configset per file, and re-parse only the files needed.
I find the solution I posted in the other thread relatively "elegant":
invalidate the config cache when things change.
The last test failure seems more tricky. This (dirty) patch fixes the
failure:
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -255,6 +255,8 @@ static int builtin_diff_files(struct rev_info *revs, int
argc, const char **argv
return run_diff_files(revs, options);
}
+int git_config_raw(config_fn_t fn, void *data);
+
int cmd_diff(int argc, const char **argv, const char *prefix)
{
int i;
@@ -317,7 +319,7 @@ int cmd_diff(int argc, const char **argv, const char
*prefix)
if (!no_index)
gitmodules_config();
- git_config(git_diff_ui_config, NULL);
+ git_config_raw(git_diff_ui_config, NULL);
init_revisions(&rev, prefix);
But this one does not:
diff --git a/builtin/diff.c b/builtin/diff.c
index 0f247d2..2012e81 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -317,7 +317,9 @@ int cmd_diff(int argc, const char **argv, const char
*prefix)
if (!no_index)
gitmodules_config();
+ git_config_clear();
git_config(git_diff_ui_config, NULL);
+ git_config_clear();
init_revisions(&rev, prefix);
So it's not just a matter of invalid cache not cleared, it's a real
difference between git_config() and git_config_raw(). The guilty part is
probably userdiff_config(const char *k, const char *v) in userdiff.c,
that parses the xfuncname config option.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html