difftool: fix argument handling in subdirs
When in a subdirectory of a repository, path arguments should be interpreted relative to the current directory not the root of the working tree. The Git::repository object passed into setup_dir_diff() is configured to handle this correctly but we create a new Git::repository here without setting the WorkingSubdir argument. By simply using the existing repository, path arguments are handled relative to the current directory. Reported-by: Bernhard Kirchen <bernhard.kirchen@rwth-aachen.de> Signed-off-by: John Keeping <john@keeping.me.uk> Acked-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
05219a1276
commit
9ec26e7977
@ -115,16 +115,9 @@ sub setup_dir_diff
|
||||
{
|
||||
my ($repo, $workdir, $symlinks) = @_;
|
||||
|
||||
# Run the diff; exit immediately if no diff found
|
||||
# 'Repository' and 'WorkingCopy' must be explicitly set to insure that
|
||||
# if $GIT_DIR and $GIT_WORK_TREE are set in ENV, they are actually used
|
||||
# by Git->repository->command*.
|
||||
my $repo_path = $repo->repo_path();
|
||||
my %repo_args = (Repository => $repo_path, WorkingCopy => $workdir);
|
||||
my $diffrepo = Git->repository(%repo_args);
|
||||
|
||||
my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
|
||||
my $diffrtn = $diffrepo->command_oneline(@gitargs);
|
||||
my $diffrtn = $repo->command_oneline(@gitargs);
|
||||
exit(0) unless defined($diffrtn);
|
||||
|
||||
# Build index info for left and right sides of the diff
|
||||
@ -176,12 +169,12 @@ EOF
|
||||
|
||||
if ($lmode eq $symlink_mode) {
|
||||
$symlink{$src_path}{left} =
|
||||
$diffrepo->command_oneline('show', "$lsha1");
|
||||
$repo->command_oneline('show', "$lsha1");
|
||||
}
|
||||
|
||||
if ($rmode eq $symlink_mode) {
|
||||
$symlink{$dst_path}{right} =
|
||||
$diffrepo->command_oneline('show', "$rsha1");
|
||||
$repo->command_oneline('show', "$rsha1");
|
||||
}
|
||||
|
||||
if ($lmode ne $null_mode and $status !~ /^C/) {
|
||||
|
Loading…
Reference in New Issue
Block a user