From: Josef Weidendorfer Date: Sun, 27 Nov 2005 21:06:42 +0000 (+0100) Subject: git-mv: fully detect 'directory moved into itself' X-Git-Tag: v0.99.9l^2~50 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ca203ee7db708baa278950501f8d01f29c5190be;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/git-mv.perl b/git-mv.perl index ac19876f..8d294d65 100755 --- a/git-mv.perl +++ b/git-mv.perl @@ -108,7 +108,7 @@ while(scalar @srcArgs > 0) { } } - if (($bad eq "") && ($src eq $dstDir)) { + if (($bad eq "") && ($dst =~ /^$src\//)) { $bad = "can not move directory '$src' into itself"; }