mirror of
https://github.com/git/git.git
synced 2025-03-27 18:39:31 +00:00
Check another error condition in git-mv
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>
This commit is contained in:
parent
979e32fa14
commit
05ff5649a4
12
git-mv.perl
12
git-mv.perl
@ -77,7 +77,7 @@ else {
|
|||||||
|
|
||||||
my (@allfiles,@srcfiles,@dstfiles);
|
my (@allfiles,@srcfiles,@dstfiles);
|
||||||
my $safesrc;
|
my $safesrc;
|
||||||
my %overwritten;
|
my (%overwritten, %srcForDst);
|
||||||
|
|
||||||
$/ = "\0";
|
$/ = "\0";
|
||||||
open(F,"-|","git-ls-files","-z")
|
open(F,"-|","git-ls-files","-z")
|
||||||
@ -123,6 +123,16 @@ while(scalar @srcArgs > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 ($bad ne "") {
|
||||||
if ($opt_k) {
|
if ($opt_k) {
|
||||||
print "Warning: $bad; skipping\n";
|
print "Warning: $bad; skipping\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user