git-mv: fully detect 'directory moved into itself'

This gives a better error message when trying to move a directory
into some subdirectory of itself; ie. no real bug fix: renaming
already failed before, but with a strange "invalid argument".

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Josef Weidendorfer 2005-11-27 22:06:42 +01:00 committed by Junio C Hamano
parent f6bc189a45
commit ca203ee7db

View file

@ -108,7 +108,7 @@ ()
}
}
if (($bad eq "") && ($src eq $dstDir)) {
if (($bad eq "") && ($dst =~ /^$src\//)) {
$bad = "can not move directory '$src' into itself";
}