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

[PATCH v2 1/4] difftool: silence uninitialized variable warning

From
David Aguilar <davvid@gmail.com>
Date
Feb 20, 2013, 05:35 UTC
Message-ID
<1361338528-17835-1-git-send-email-davvid@gmail.com>

Git::config() returns `undef` when given keys that do not exist. Check that the $guitool value is defined to prevent a noisy "Use of uninitialized variable $guitool in length" warning.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
Unchanged from last time but included in the series for convenience.
 git-difftool.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-difftool.perl b/git-difftool.perl
index 0a90de4..12231fb 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -336,7 +336,7 @@ sub main
 	}
 	if ($opts{gui}) {
 		my $guitool = Git::config('diff.guitool');
-		if (length($guitool) > 0) {
+		if (defined($guitool) && length($guitool) > 0) {
 			$ENV{GIT_DIFF_TOOL} = $guitool;
 		}
 	}
-- 
1.8.2.rc0.20.gf548dd7
Next: David Aguilar
Message 1 of 5 in “difftool: silence uninitialized variable warning”
  1. 1/4 difftool: silence uninitialized variable warningDavid Aguilar, Feb 20, 2013
  2. 2/4 t7800: update copyright noticeDavid Aguilar, Feb 20, 2013
  3. 3/4 t7800: modernize testsDavid Aguilar, Feb 20, 2013
  4. 4/4 t7800: "defaults" is no longer a builtin tool nameDavid Aguilar, Feb 20, 2013
  5. Junio C HamanoFeb 20, 2013

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.