Skip to content

Commit 1e20fbd

Browse files
Don't change users colors, just offer the suggestion
1 parent 2873116 commit 1e20fbd

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

diff-so-fancy

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -690,40 +690,22 @@ sub check_first_run {
690690
# See if they're previously set SOME diff-highlight colors
691691
my $has_dh_colors = git_config_boolean('color.diff-highlight.oldnormal') || git_config_boolean('color.diff-highlight.newnormal');
692692

693+
#$first_run = 1; $has_dh_colors = 0;
694+
693695
if (!$first_run || $has_dh_colors) {
694696
return 0;
695697
} else {
696-
my $interactive_shell = !has_stdin();
697-
698-
# d-s-f run inside of LESS (can't prompt user)
699-
if (!$interactive_shell) {
700-
my $warn = color("yellow_on_red");
701-
my $bold = color("bold");
702-
my $blink = color("blink");
703-
my $reset = color("reset");
704-
705-
printf("\n%s%s%sWarning:%s This appears to be the first time you've run diff-so-fancy. Please note that the\n",$blink,$bold,$warn,$reset);
706-
printf("default colors may not be optimal. Please run 'diff-so-fancy --colors' to see our color recommendations.\n");
707-
printf("To silence this error run: 'git config --global diff-so-fancy.first-run false'.\n\n");
708-
709-
return 0;
710-
}
698+
print "This appears to be the first time you've run diff-so-fancy, please note\n";
699+
print "that the default git colors are not ideal. Diff-so-fancy recommends the\n";
700+
print "following colors.\n\n";
711701

712-
print "This appears to be the first time you've run diff-so-fancy, would you like to\n";
713-
print "configure git to use diff-so-fancy for all diff operations and use the\n";
714-
print "recommended color scheme (y/N)?\n";
702+
print get_default_colors();
715703

716-
my $input = <STDIN>;
717-
$input = uc(trim($input));
704+
# Set the first run flag to false
705+
my $cmd = 'git config --global diff-so-fancy.first-run false';
706+
system($cmd);
718707

719-
# Set the default colors and git alias
720-
if ($input eq "Y") {
721-
set_defaults();
722-
# Just set the first-run flag to false so we don't pop this up again
723-
} else {
724-
my $cmd = 'git config --global diff-so-fancy.first-run false';
725-
system($cmd);
726-
}
708+
exit;
727709
}
728710

729711
return 1;

0 commit comments

Comments
 (0)