Skip to content

Commit e467193

Browse files
peffgitster
authored andcommitted
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>
1 parent 9a1805a commit e467193

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

diff.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ int git_diff_ui_config(const char *var, const char *value)
174174
if (ep != var + 4) {
175175
if (!strcmp(ep, ".command"))
176176
return parse_lldiff_command(var, ep, value);
177-
if (!strcmp(ep, ".funcname"))
178-
return parse_funcname_pattern(var, ep, value);
179177
}
180178
}
181179

@@ -190,6 +188,14 @@ int git_diff_basic_config(const char *var, const char *value)
190188
return 0;
191189
}
192190

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+
193199
return git_default_config(var, value);
194200
}
195201

@@ -1160,7 +1166,6 @@ static const char *funcname_pattern(const char *ident)
11601166
{
11611167
struct funcname_pattern *pp;
11621168

1163-
read_config_if_needed();
11641169
for (pp = funcname_pattern_list; pp; pp = pp->next)
11651170
if (!strcmp(ident, pp->name))
11661171
return pp->pattern;

0 commit comments

Comments
 (0)