difftool: initialize variables for readability

The code always goes into one of the two conditional blocks but make it clear that not doing so is an error condition by setting $ok to 0. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Aguilar committed May 16, 2016 at 11:05 UTC 951b551d0f349f145f8606b946d64fc452ad6a51
1 file changed +2 -2
git-difftool.perl
+2 -2
@@ -273,7 +273,7 @@ EOF
273 # temporary file to both the left and right directories to show the
274 # change in the recorded SHA1 for the submodule.
275 for my $path (keys %submodule) {
276 - my $ok;
276 + my $ok = 0;
277 if (defined($submodule{$path}{left})) {
278 $ok = write_to_file("$ldir/$path",
279 "Subproject commit $submodule{$path}{left}");
@@ -289,7 +289,7 @@ EOF
289 # shows only the link itself, not the contents of the link target.
290 # This loop replicates that behavior.
291 for my $path (keys %symlink) {
292 - my $ok;
292 + my $ok = 0;
293 if (defined($symlink{$path}{left})) {
294 $ok = write_to_file("$ldir/$path",
295 $symlink{$path}{left});