git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] add -p: get rid of Git.pm warnings about unitialized values

From
Stephan Beyer <s-beyer@gmx.net>
Date
Feb 8, 2009, 17:40 UTC
Message-ID
<1234114839-11958-1-git-send-email-s-beyer@gmx.net>
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>
---
 git-add--interactive.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index ec47888..5f129a4 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -14,7 +14,8 @@ my ($prompt_color, $header_color, $help_color) =
 	) : ();
 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);
 }
-- 
1.6.2.rc0.446.g760ba.dirty
Next: Thomas Rast
Message 1 of 2 in “add -p: get rid of Git.pm warnings about unitialized values”
  1. add -p: get rid of Git.pm warnings about unitialized valuesStephan Beyer, Feb 8, 2009
  2. Thomas RastFeb 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.