1477
}
1478
}
1479
1480
-
1480
sub cmd_info {
1482
- my $path = canonicalize_path(defined($_[0]) ? $_[0] : ".");
1483
- my $fullpath = canonicalize_path($cmd_dir_prefix . $path);
1481
+ my $path_arg = defined($_[0]) ? $_[0] : '.';
1482
+ my $path = $path_arg;
1483
+ if (File::Spec->file_name_is_absolute($path)) {
1484
+ $path = canonicalize_path($path);
1485
+
1486
+ my $toplevel = eval {
1487
+ my @cmd = qw/rev-parse --show-toplevel/;
1488
+ command_oneline(\@cmd, STDERR => 0);
1489
+ };
1490
+
1491
+ # remove $toplevel from the absolute path:
1492
+ my ($vol, $dirs, $file) = File::Spec->splitpath($path);
1493
+ my (undef, $tdirs, $tfile) = File::Spec->splitpath($toplevel);
1494
+ my @dirs = File::Spec->splitdir($dirs);
1495
+ my @tdirs = File::Spec->splitdir($tdirs);
1496
+ pop @dirs if $dirs[-1] eq '';
1497
+ pop @tdirs if $tdirs[-1] eq '';
1498
+ push @dirs, $file;
1499
+ push @tdirs, $tfile;
1500
+ while (@tdirs && @dirs && $tdirs[0] eq $dirs[0]) {
1501
+ shift @dirs;
1502
+ shift @tdirs;
1503
+ }
1504
+ $dirs = File::Spec->catdir(@dirs);
1505
+ $path = File::Spec->catpath($vol, $dirs);
1506
+
1507
+ $path = canonicalize_path($path);
1508
+ } else {
1509
+ $path = canonicalize_path($cmd_dir_prefix . $path);
1510
+ }
1511
if (exists $_[1]) {
1512
die "Too many arguments specified\n";
1513
}
1528
# canonicalize_path() will return "" to make libsvn 1.5.x happy,
1529
$path = "." if $path eq "";
1530
1504
- my $full_url = canonicalize_url( add_path_to_url( $url, $fullpath ) );
1531
+ my $full_url = canonicalize_url( add_path_to_url( $url, $path ) );
1532
1533
if ($_url) {
1534
print "$full_url\n";
1535
return;
1536
}
1537
1511
- my $result = "Path: $path\n";
1538
+ my $result = "Path: $path_arg\n";
1539
$result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
1540
$result .= "URL: $full_url\n";
1541
1566
}
1567
1568
my ($lc_author, $lc_rev, $lc_date_utc);
1542
- my @args = Git::SVN::Log::git_svn_log_cmd($rev, $rev, "--", $fullpath);
1569
+ my @args = Git::SVN::Log::git_svn_log_cmd($rev, $rev, "--", $path);
1570
my $log = command_output_pipe(@args);
1571
my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
1572
while (<$log>) {