When moving multiple files at once, it can happen that
files get the same target name, like in
git-mv a/foo b/foo destdir
Both a/foo and b/foo target destdir/foo.
Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
my (@allfiles,@srcfiles,@dstfiles);
my $safesrc;
-my %overwritten;
+my (%overwritten, %srcForDst);
$/ = "\0";
open(F,"-|","git-ls-files","-z")
}
}
+ if ($bad eq "") {
+ if (defined $srcForDst{$dst}) {
+ $bad = "can not move '$src' to '$dst'; already target of ";
+ $bad .= "'".$srcForDst{$dst}."'";
+ }
+ else {
+ $srcForDst{$dst} = $src;
+ }
+ }
+
if ($bad ne "") {
if ($opt_k) {
print "Warning: $bad; skipping\n";