Skip to content

Commit

Permalink
add -p: get rid of Git.pm warnings about unitialized values
Browse files Browse the repository at this point in the history
After invoking git add -p I always got the warnings:

 Use of uninitialized value $_[3] in exec at Git.pm line 1282.
 Use of uninitialized value $args[2] in join or string at Git.pm line 1264.

A bisect showed that these warnings occur in a301973 "add -p: print errors
in separate color" the first time.

They can be reproduced by setting color.ui (or color.interactive) to "auto"
and unsetting color.interactive.help and color.interactive.error.
I am using Perl 5.10.0.

The reason of the warning is that color.interactive.error defaults to
color.interactive.help which defaults to nothing in the specific codepath.
It defaults to 'red bold' some lines above which could lead to the wrong
assumption that it always defaults to 'red bold' now.

This patch lets it default to 'red bold', blowing the warnings away.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Acked-By: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Stephan Beyer authored and Junio C Hamano committed Feb 8, 2009
1 parent 621f1b4 commit 9aad6cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
) : ();
my $error_color = ();
if ($menu_use_color) {
my $help_color_spec = $repo->config('color.interactive.help');
my $help_color_spec = ($repo->config('color.interactive.help') or
'red bold');
$error_color = $repo->get_color('color.interactive.error',
$help_color_spec);
}
Expand Down

0 comments on commit 9aad6cb

Please sign in to comment.