diff: load funcname patterns in "basic" config
The funcname patterns influence the "comment" on @@ lines of the diff. They are safe to use with plumbing since they don't fundamentally change the meaning of the diff in any way. Since all diff users call either diff_ui_config or diff_basic_config, we can get rid of the lazy reading of the config. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jan 4, 2008 at 04:16 UTC
e467193ff3f57171c5c3232b4ba3595970efbfb5
1 file changed
+8
-3
diff.c
+8
-3
@@ -174,8 +174,6 @@ int git_diff_ui_config(const char *var, const char *value)
174
if (ep != var + 4) {
175
if (!strcmp(ep, ".command"))
176
return parse_lldiff_command(var, ep, value);
177
- if (!strcmp(ep, ".funcname"))
178
- return parse_funcname_pattern(var, ep, value);
177
}
178
}
179
@@ -190,6 +188,14 @@ int git_diff_basic_config(const char *var, const char *value)
188
return 0;
189
}
190
191
+ if (!prefixcmp(var, "diff.")) {
192
+ const char *ep = strrchr(var, '.');
193
+ if (ep != var + 4) {
194
+ if (!strcmp(ep, ".funcname"))
195
+ return parse_funcname_pattern(var, ep, value);
196
+ }
197
+ }
198
+
199
return git_default_config(var, value);
200
}
201
@@ -1160,7 +1166,6 @@ static const char *funcname_pattern(const char *ident)
1166
{
1167
struct funcname_pattern *pp;
1168
1163
- read_config_if_needed();
1169
for (pp = funcname_pattern_list; pp; pp = pp->next)
1170
if (!strcmp(ident, pp->name))
1171
return pp->pattern;