userdiff: add and use struct external_diff
Wrap the string specifying the external diff command in a new struct to simplify adding attributes, which the next patch will do. Make sure external_diff() still returns NULL if neither the environment variable GIT_EXTERNAL_DIFF nor the configuration option diff.external is set, to continue allowing its use in a boolean context. Use a designated initializer for the default builtin userdiff driver to adjust to the type change of the second struct member. Spelling out only the non-zero members improves readability as a nice side-effect. No functional change intended. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
33be6cf51a
commit
54443bbfc3
@ -333,7 +333,7 @@ PATTERNS("scheme",
|
||||
"|([^][)(}{[ \t])+"),
|
||||
PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
|
||||
"\\\\[a-zA-Z@]+|\\\\.|([a-zA-Z0-9]|[^\x01-\x7f])+"),
|
||||
{ "default", NULL, NULL, -1, { NULL, 0 } },
|
||||
{ .name = "default", .binary = -1 },
|
||||
};
|
||||
#undef PATTERNS
|
||||
#undef IPATTERN
|
||||
@ -445,7 +445,7 @@ int userdiff_config(const char *k, const char *v)
|
||||
if (!strcmp(type, "binary"))
|
||||
return parse_tristate(&drv->binary, k, v);
|
||||
if (!strcmp(type, "command"))
|
||||
return git_config_string(&drv->external, k, v);
|
||||
return git_config_string(&drv->external.cmd, k, v);
|
||||
if (!strcmp(type, "textconv"))
|
||||
return git_config_string(&drv->textconv, k, v);
|
||||
if (!strcmp(type, "cachetextconv"))
|
||||
|
Reference in New Issue
Block a user