Skip to content

Commit ce69269

Browse files
davvidgitster
authored andcommitted
difftool: rename variables for consistency
Always call the list of files @files. Always call the worktree $worktree. Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f242a03 commit ce69269

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

git-difftool.perl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ sub changed_files
100100

101101
sub setup_dir_diff
102102
{
103-
my ($workdir, $symlinks) = @_;
103+
my ($worktree, $symlinks) = @_;
104104
my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
105105
my $diffrtn = Git::command_oneline(@gitargs);
106106
exit(0) unless defined($diffrtn);
@@ -109,7 +109,7 @@ sub setup_dir_diff
109109
# changed files. The paths returned by diff --raw are relative to the
110110
# top-level of the repository, but we defer changing directories so
111111
# that @ARGV can perform pathspec limiting in the current directory.
112-
chdir($workdir);
112+
chdir($worktree);
113113

114114
# Build index info for left and right sides of the diff
115115
my $submodule_mode = '160000';
@@ -121,7 +121,7 @@ sub setup_dir_diff
121121
my $wtindex = '';
122122
my %submodule;
123123
my %symlink;
124-
my @working_tree = ();
124+
my @files = ();
125125
my %working_tree_dups = ();
126126
my @rawdiff = split('\0', $diffrtn);
127127

@@ -173,14 +173,14 @@ sub setup_dir_diff
173173
}
174174

175175
if ($rmode ne $null_mode) {
176-
# Avoid duplicate working_tree entries
176+
# Avoid duplicate entries
177177
if ($working_tree_dups{$dst_path}++) {
178178
next;
179179
}
180180
my ($use, $wt_sha1) =
181181
use_wt_file($dst_path, $rsha1);
182182
if ($use) {
183-
push @working_tree, $dst_path;
183+
push @files, $dst_path;
184184
$wtindex .= "$rmode $wt_sha1\t$dst_path\0";
185185
} else {
186186
$rindex .= "$rmode $rsha1\t$dst_path\0";
@@ -227,14 +227,14 @@ sub setup_dir_diff
227227

228228
# Changes in the working tree need special treatment since they are
229229
# not part of the index.
230-
for my $file (@working_tree) {
230+
for my $file (@files) {
231231
my $dir = dirname($file);
232232
unless (-d "$rdir/$dir") {
233233
mkpath("$rdir/$dir") or
234234
exit_cleanup($tmpdir, 1);
235235
}
236236
if ($symlinks) {
237-
symlink("$workdir/$file", "$rdir/$file") or
237+
symlink("$worktree/$file", "$rdir/$file") or
238238
exit_cleanup($tmpdir, 1);
239239
} else {
240240
copy($file, "$rdir/$file") or
@@ -278,7 +278,7 @@ sub setup_dir_diff
278278
exit_cleanup($tmpdir, 1) if not $ok;
279279
}
280280

281-
return ($ldir, $rdir, $tmpdir, @working_tree);
281+
return ($ldir, $rdir, $tmpdir, @files);
282282
}
283283

284284
sub write_to_file
@@ -388,9 +388,9 @@ sub dir_diff
388388
my $error = 0;
389389
my $repo = Git->repository();
390390
my $repo_path = $repo->repo_path();
391-
my $workdir = $repo->wc_path();
392-
$workdir =~ s|/$||; # Avoid double slashes in symlink targets
393-
my ($a, $b, $tmpdir, @worktree) = setup_dir_diff($workdir, $symlinks);
391+
my $worktree = $repo->wc_path();
392+
$worktree =~ s|/$||; # Avoid double slashes in symlink targets
393+
my ($a, $b, $tmpdir, @files) = setup_dir_diff($worktree, $symlinks);
394394

395395
if (defined($extcmd)) {
396396
$rc = system($extcmd, $a, $b);
@@ -411,21 +411,21 @@ sub dir_diff
411411
my %tmp_modified;
412412
my $indices_loaded = 0;
413413

414-
for my $file (@worktree) {
414+
for my $file (@files) {
415415
next if $symlinks && -l "$b/$file";
416416
next if ! -f "$b/$file";
417417

418418
if (!$indices_loaded) {
419419
%wt_modified = changed_files(
420-
$repo_path, "$tmpdir/wtindex", $workdir);
420+
$repo_path, "$tmpdir/wtindex", $worktree);
421421
%tmp_modified = changed_files(
422422
$repo_path, "$tmpdir/wtindex", $b);
423423
$indices_loaded = 1;
424424
}
425425

426426
if (exists $wt_modified{$file} and exists $tmp_modified{$file}) {
427427
my $errmsg = "warning: Both files modified: ";
428-
$errmsg .= "'$workdir/$file' and '$b/$file'.\n";
428+
$errmsg .= "'$worktree/$file' and '$b/$file'.\n";
429429
$errmsg .= "warning: Working tree file has been left.\n";
430430
$errmsg .= "warning:\n";
431431
warn $errmsg;

0 commit comments

Comments
 (0)