threads / patch / 31307

patchdifftool: silence warning

Subject: [PATCH] difftool: silence warning

## tl;dr

One message between Aug 21, 2012 and Aug 21, 2012. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Ross Lagerwall· Aug 21, 2012, 10:21 UTC · lore

Silence a warning given when running git difftool --dir-diff and there are no changes. This is because command_oneline returns undef when the command has no output, not ''.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
---
 git-difftool.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to git-difftool.perl +1 −1
diff --git a/git-difftool.perl b/git-difftool.perl
index 17d4de6..edd0493 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -138,7 +138,7 @@ sub setup_dir_diff
 
 	my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
 	my $diffrtn = $diffrepo->command_oneline(@gitargs);
-	exit(0) if (length($diffrtn) == 0);
+	exit(0) unless defined($diffrtn);
 
 	# Build index info for left and right sides of the diff
 	my $submodule_mode = '160000';
-- 
1.7.11.4

← back to recent threads