Strip any trailing slash on destination argument
Needed because generating a target paths will add another slash. This fixes e.g. "git-mv file dir/", which removed "file" from version control by renaming it to "dir//file", as git-update-index does not accept such paths. Thanks goes to Ben Lau for noting this bug. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Josef Weidendorfer committed
Nov 1, 2005 at 23:46 UTC
f676fa76e26faed3ac02a9dae8f9f7addb9542a4
1 file changed
+2
git-mv.perl
+2
@@ -54,6 +54,8 @@ my ($src, $dst, $base, $dstDir);
54
my $argCount = scalar @ARGV;
55
if (-d $ARGV[$argCount-1]) {
56
$dstDir = $ARGV[$argCount-1];
57
+ # remove any trailing slash
58
+ $dstDir =~ s/\/$//;
59
@srcArgs = @ARGV[0..$argCount-2];
60
61
foreach $src (@srcArgs) {