Skip to content

Commit 951b551

Browse files
davvidgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d92347f commit 951b551

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git-difftool.perl

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ sub setup_dir_diff
273273
# temporary file to both the left and right directories to show the
274274
# change in the recorded SHA1 for the submodule.
275275
for my $path (keys %submodule) {
276-
my $ok;
276+
my $ok = 0;
277277
if (defined($submodule{$path}{left})) {
278278
$ok = write_to_file("$ldir/$path",
279279
"Subproject commit $submodule{$path}{left}");
@@ -289,7 +289,7 @@ sub setup_dir_diff
289289
# shows only the link itself, not the contents of the link target.
290290
# This loop replicates that behavior.
291291
for my $path (keys %symlink) {
292-
my $ok;
292+
my $ok = 0;
293293
if (defined($symlink{$path}{left})) {
294294
$ok = write_to_file("$ldir/$path",
295295
$symlink{$path}{left});

0 commit comments

Comments
 (0)