Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
difftool: rename variables for consistency
author
David Aguilar
<davvid@gmail.com>
Fri, 9 Dec 2016 08:58:48 +0000
(
00:58
-0800)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 12 Dec 2016 00:18:59 +0000
(16:18 -0800)
Always call the list of files @files.
Always call the worktree $worktree.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-difftool.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
f242a03
)
diff --git
a/git-difftool.perl
b/git-difftool.perl
index 99b03949bf32bb7b0797303680d09fc197cf2cc8..4e4f5d8138a68e52e5ec0b787c1d7a09ba3e6658 100755
(executable)
--- a/
git-difftool.perl
+++ b/
git-difftool.perl
@@
-100,7
+100,7
@@
sub changed_files
sub setup_dir_diff
{
sub setup_dir_diff
{
- my ($work
dir
, $symlinks) = @_;
+ my ($work
tree
, $symlinks) = @_;
my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
my $diffrtn = Git::command_oneline(@gitargs);
exit(0) unless defined($diffrtn);
my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
my $diffrtn = Git::command_oneline(@gitargs);
exit(0) unless defined($diffrtn);
@@
-109,7
+109,7
@@
sub setup_dir_diff
# changed files. The paths returned by diff --raw are relative to the
# top-level of the repository, but we defer changing directories so
# that @ARGV can perform pathspec limiting in the current directory.
# changed files. The paths returned by diff --raw are relative to the
# top-level of the repository, but we defer changing directories so
# that @ARGV can perform pathspec limiting in the current directory.
- chdir($work
dir
);
+ chdir($work
tree
);
# Build index info for left and right sides of the diff
my $submodule_mode = '160000';
# Build index info for left and right sides of the diff
my $submodule_mode = '160000';
@@
-121,7
+121,7
@@
sub setup_dir_diff
my $wtindex = '';
my %submodule;
my %symlink;
my $wtindex = '';
my %submodule;
my %symlink;
- my @
working_tree
= ();
+ my @
files
= ();
my %working_tree_dups = ();
my @rawdiff = split('\0', $diffrtn);
my %working_tree_dups = ();
my @rawdiff = split('\0', $diffrtn);
@@
-173,14
+173,14
@@
sub setup_dir_diff
}
if ($rmode ne $null_mode) {
}
if ($rmode ne $null_mode) {
- # Avoid duplicate
working_tree
entries
+ # Avoid duplicate entries
if ($working_tree_dups{$dst_path}++) {
next;
}
my ($use, $wt_sha1) =
use_wt_file($dst_path, $rsha1);
if ($use) {
if ($working_tree_dups{$dst_path}++) {
next;
}
my ($use, $wt_sha1) =
use_wt_file($dst_path, $rsha1);
if ($use) {
- push @
working_tree
, $dst_path;
+ push @
files
, $dst_path;
$wtindex .= "$rmode $wt_sha1\t$dst_path\0";
} else {
$rindex .= "$rmode $rsha1\t$dst_path\0";
$wtindex .= "$rmode $wt_sha1\t$dst_path\0";
} else {
$rindex .= "$rmode $rsha1\t$dst_path\0";
@@
-227,14
+227,14
@@
sub setup_dir_diff
# Changes in the working tree need special treatment since they are
# not part of the index.
# Changes in the working tree need special treatment since they are
# not part of the index.
- for my $file (@
working_tree
) {
+ for my $file (@
files
) {
my $dir = dirname($file);
unless (-d "$rdir/$dir") {
mkpath("$rdir/$dir") or
exit_cleanup($tmpdir, 1);
}
if ($symlinks) {
my $dir = dirname($file);
unless (-d "$rdir/$dir") {
mkpath("$rdir/$dir") or
exit_cleanup($tmpdir, 1);
}
if ($symlinks) {
- symlink("$work
dir
/$file", "$rdir/$file") or
+ symlink("$work
tree
/$file", "$rdir/$file") or
exit_cleanup($tmpdir, 1);
} else {
copy($file, "$rdir/$file") or
exit_cleanup($tmpdir, 1);
} else {
copy($file, "$rdir/$file") or
@@
-278,7
+278,7
@@
sub setup_dir_diff
exit_cleanup($tmpdir, 1) if not $ok;
}
exit_cleanup($tmpdir, 1) if not $ok;
}
- return ($ldir, $rdir, $tmpdir, @
working_tree
);
+ return ($ldir, $rdir, $tmpdir, @
files
);
}
sub write_to_file
}
sub write_to_file
@@
-388,9
+388,9
@@
sub dir_diff
my $error = 0;
my $repo = Git->repository();
my $repo_path = $repo->repo_path();
my $error = 0;
my $repo = Git->repository();
my $repo_path = $repo->repo_path();
- my $work
dir
= $repo->wc_path();
- $work
dir
=~ s|/$||; # Avoid double slashes in symlink targets
- my ($a, $b, $tmpdir, @
worktree) = setup_dir_diff($workdir
, $symlinks);
+ my $work
tree
= $repo->wc_path();
+ $work
tree
=~ s|/$||; # Avoid double slashes in symlink targets
+ my ($a, $b, $tmpdir, @
files) = setup_dir_diff($worktree
, $symlinks);
if (defined($extcmd)) {
$rc = system($extcmd, $a, $b);
if (defined($extcmd)) {
$rc = system($extcmd, $a, $b);
@@
-411,13
+411,13
@@
sub dir_diff
my %tmp_modified;
my $indices_loaded = 0;
my %tmp_modified;
my $indices_loaded = 0;
- for my $file (@
worktree
) {
+ for my $file (@
files
) {
next if $symlinks && -l "$b/$file";
next if ! -f "$b/$file";
if (!$indices_loaded) {
%wt_modified = changed_files(
next if $symlinks && -l "$b/$file";
next if ! -f "$b/$file";
if (!$indices_loaded) {
%wt_modified = changed_files(
- $repo_path, "$tmpdir/wtindex", $work
dir
);
+ $repo_path, "$tmpdir/wtindex", $work
tree
);
%tmp_modified = changed_files(
$repo_path, "$tmpdir/wtindex", $b);
$indices_loaded = 1;
%tmp_modified = changed_files(
$repo_path, "$tmpdir/wtindex", $b);
$indices_loaded = 1;
@@
-425,7
+425,7
@@
sub dir_diff
if (exists $wt_modified{$file} and exists $tmp_modified{$file}) {
my $errmsg = "warning: Both files modified: ";
if (exists $wt_modified{$file} and exists $tmp_modified{$file}) {
my $errmsg = "warning: Both files modified: ";
- $errmsg .= "'$work
dir
/$file' and '$b/$file'.\n";
+ $errmsg .= "'$work
tree
/$file' and '$b/$file'.\n";
$errmsg .= "warning: Working tree file has been left.\n";
$errmsg .= "warning:\n";
warn $errmsg;
$errmsg .= "warning: Working tree file has been left.\n";
$errmsg .= "warning:\n";
warn $errmsg;