summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2016-05-16 11:05:36 -0700
committerJunio C Hamano <gitster@pobox.com>2016-05-16 14:53:03 -0700
commit951b551d0f349f145f8606b946d64fc452ad6a51 (patch)
tree5468f637c2254d4e33b961f4eb115f93dad13993
parentd92347f59fefb95a2d9240c007a44f408c216fa7 (diff)
downloadgit-951b551d0f349f145f8606b946d64fc452ad6a51.tar.gz
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>
-rwxr-xr-xgit-difftool.perl4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-difftool.perl b/git-difftool.perl
index 488d14b153..8cf0040590 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -273,7 +273,7 @@ EOF
# temporary file to both the left and right directories to show the
# change in the recorded SHA1 for the submodule.
for my $path (keys %submodule) {
- my $ok;
+ my $ok = 0;
if (defined($submodule{$path}{left})) {
$ok = write_to_file("$ldir/$path",
"Subproject commit $submodule{$path}{left}");
@@ -289,7 +289,7 @@ EOF
# shows only the link itself, not the contents of the link target.
# This loop replicates that behavior.
for my $path (keys %symlink) {
- my $ok;
+ my $ok = 0;
if (defined($symlink{$path}{left})) {
$ok = write_to_file("$ldir/$path",
$symlink{$path}{left});