Skip to content

Commit 5ed6159

Browse files
Don't use DiffHighlight to get the colors because it shells out and is slow
1 parent e0e5af4 commit 5ed6159

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

diff-so-fancy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,19 +876,19 @@ sub color {
876876

877877
if ($str eq "meta") {
878878
# Default ANSI yellow
879-
$ret = DiffHighlight::color_config('color.diff.meta', color(11));
879+
$ret = git_ansi_color(git_config('color.diff.meta')) || color(11);
880880
} elsif ($str eq "reset") {
881881
$ret = color("reset");
882882
} elsif ($str eq "add_line") {
883883
# Default ANSI green
884-
$ret = DiffHighlight::color_config('color.diff.new', color('bold') . color(2));
884+
$ret = git_ansi_color(git_config('color.diff.new')) || color("2_bold");
885885
} elsif ($str eq "remove_line") {
886886
# Default ANSI red
887-
$ret = DiffHighlight::color_config('color.diff.old', color('bold') . color(1));
887+
$ret = git_ansi_color(git_config('color.diff.old')) || color("1_bold");
888888
} elsif ($str eq "fragment") {
889-
$ret = DiffHighlight::color_config('color.diff.frag', color('13_bold'));
889+
$ret = git_ansi_color(git_config('color.diff.frag')) || color("13_bold");
890890
} elsif ($str eq "last_function") {
891-
$ret = DiffHighlight::color_config('color.diff.func', color('bold') . color(146));
891+
$ret = git_ansi_color(git_config('color.diff.func')) || color("146_bold");
892892
}
893893

894894
# Cache (memoize) the entry for later

0 commit comments

Comments
 (0)