diff options
| author | Jeff King <peff@peff.net> | 2026-03-23 02:02:18 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-23 07:42:27 -0700 |
| commit | 6689a6ea493b484d6a43601f42c1633706c963d6 (patch) | |
| tree | 976e3ec50d3389b808bb16db6877d71ac446918b /git.c | |
| parent | bd958e91dffdba00ef94dc9bfc04b46599362f9a (diff) | |
| download | git-6689a6ea493b484d6a43601f42c1633706c963d6.tar.xz | |
diff-highlight: fetch all config with one process
When diff-highlight was written, there was no way to fetch multiple
config keys _and_ have them interpreted as colors. So we were stuck
with either invoking git-config once for each config key, or fetching
them all and converting human-readable color names into ANSI codes
ourselves.
I chose the former, but it means that diff-highlight kicks off 6
git-config processes (even if you haven't configured anything, it has to
check each one).
But since Git 2.18.0, we can do:
git config --type=color --get-regexp=^color\.diff-highlight\.
to get all of them in one shot.
Note that any callers which pass in colors directly to the module via
@OLD_HIGHLIGHT and @NEW_HIGHLIGHT (like diff-so-fancy plans to do) are
unaffected; those colors suppress any config lookup we'd do ourselves.
You can see the effect like:
# diff-highlight suppresses git-config's stderr, so dump
# trace through descriptor 3
git show d1f33c753d | GIT_TRACE=3 diff-highlight 3>&2 >/dev/null
which drops from 6 lines down to 1.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
0 files changed, 0 insertions, 0 deletions
