Skip to content

Commit 3840295

Browse files
Merge branch 'next'
2 parents cb02c84 + afe977f commit 3840295

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

diff-so-fancy

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env perl
22

3-
my $VERSION = "1.1.0";
3+
my $VERSION = "1.1.1";
44

55
#################################################################################
66

@@ -367,13 +367,17 @@ sub get_git_config_hash {
367367
my %hash;
368368
foreach my $line (@$out) {
369369
my ($key,$value) = split("=",$line,2);
370-
$value =~ s/\s+$//;
371-
my @path = split(/\./,$key);
372370

373-
my $last = pop @path;
374-
my $p = \%hash;
375-
$p = $p->{$_} ||= {} for @path;
376-
$p->{$last} = $value;
371+
if ($key && $value) {
372+
$value =~ s/\s+$//;
373+
my @path = split(/\./,$key);
374+
my $last = pop @path;
375+
my $p = \%hash;
376+
377+
# Build the tree for each section
378+
$p = $p->{$_} ||= {} for @path;
379+
$p->{$last} = $value;
380+
}
377381
}
378382

379383
return \%hash;
@@ -612,13 +616,12 @@ sub is_windows {
612616

613617
# Return value is whether this is the first time they've run d-s-f
614618
sub check_first_run {
615-
my $i = get_git_config_hash();
616619
my $ret = 0;
617620

618621
# If first-run is not set, or it's set to "true"
619-
my $first_run = boolean(!$i->{'diff-so-fancy'}->{'first-run'} || ($i->{'diff-so-fancy'}->{'first-run'} eq "true"));
622+
my $first_run = git_config_boolean('diff-so-fancy.first-run');
620623
# See if they're previously set SOME diff-highlight colors
621-
my $has_dh_colors = boolean($i->{color}->{'diff-highlight'}->{oldnormal} || $i->{color}->{'diff-highlight'}->{newnormal});
624+
my $has_dh_colors = git_config_boolean('color.diff-highlight.oldnormal') || git_config_boolean('color.diff-highlight.newnormal');
622625

623626
if (!$first_run || $has_dh_colors) {
624627
return 0;

test/test_helper/util.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ set_env() {
1313

1414
# applying colors so ANSI color values will match
1515
# FIXME: not everyone will have these set, so we need to test for that.
16-
git config color.diff.meta "yellow bold"
17-
git config color.diff.commit "green bold"
16+
git config color.diff.meta "227"
1817
git config color.diff.frag "magenta bold"
18+
git config color.diff.commit "227 bold"
1919
git config color.diff.old "red bold"
2020
git config color.diff.new "green bold"
2121
git config color.diff.whitespace "red reverse"

0 commit comments

Comments
 (0)