git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Henigan <tim.henigan@gmail.com>
To: gitster@pobox.com, git@vger.kernel.org, davvid@gmail.com
Cc: Tim Henigan <tim.henigan@gmail.com>
Subject: [PATCH 2/2] difftool: handle uninitialized variable on empty diff
Date: Thu, 28 Jun 2012 15:39:55 -0400	[thread overview]
Message-ID: <1340912395-16990-2-git-send-email-tim.henigan@gmail.com> (raw)
In-Reply-To: <1340912395-16990-1-git-send-email-tim.henigan@gmail.com>

When 'difftool --dir-diff' finds no changes, it results in an
uninitialized variable warning.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
---
 git-difftool.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index 679a56d..c94557d 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -117,7 +117,7 @@ sub setup_dir_diff
 	# by Git->repository->command*.
 	my $diffrepo = Git->repository(Repository => $repo_path, WorkingCopy => $workdir);
 	my $diffrtn = $diffrepo->command_oneline('diff', '--raw', '--no-abbrev', '-z', @ARGV);
-	exit(0) if (length($diffrtn) == 0);
+	exit(0) if ((not defined($diffrtn)) or (length($diffrtn) == 0));
 
 	# Setup temp directories
 	my $tmpdir = tempdir('git-diffall.XXXXX', CLEANUP => 1, TMPDIR => 1);
-- 
1.7.11.1.134.gda62046

  reply	other threads:[~2012-06-28 19:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 19:39 [PATCH 1/2] difftool: only copy back files modified during directory diff Tim Henigan
2012-06-28 19:39 ` Tim Henigan [this message]
2012-06-28 20:00   ` [PATCH 2/2] difftool: handle uninitialized variable on empty diff Junio C Hamano
2012-06-28 19:51 ` [PATCH 1/2] difftool: only copy back files modified during directory diff Junio C Hamano
2012-07-19  8:11   ` David Aguilar
2012-07-19  8:27     ` [PATCH v2] " David Aguilar
2012-07-19 17:34       ` Junio C Hamano
2012-07-21  5:10         ` David Aguilar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340912395-16990-2-git-send-email-tim.henigan@gmail.com \
    --to=tim.henigan@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).