diff options
author | Josef Weidendorfer <Josef.Weidendorfer@gmx.de> | 2005-10-25 14:20:45 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-10-25 22:50:49 -0700 |
commit | 05ff5649a4fd90c3c80f507165bbaf07dc0dbe8e (patch) | |
tree | 075bfd7b6fdb3863dac4f5b8592e49f1ea900cd4 /git-mv.perl | |
parent | 979e32fa1483a32faa4ec331e29b357e5eb5ef25 (diff) | |
download | git-05ff5649a4fd90c3c80f507165bbaf07dc0dbe8e.tar.gz git-05ff5649a4fd90c3c80f507165bbaf07dc0dbe8e.tar.xz |
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>
Diffstat (limited to 'git-mv.perl')
-rwxr-xr-x | git-mv.perl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/git-mv.perl b/git-mv.perl index 28bced959..17e35b0ac 100755 --- a/git-mv.perl +++ b/git-mv.perl @@ -77,7 +77,7 @@ else { my (@allfiles,@srcfiles,@dstfiles); my $safesrc; -my %overwritten; +my (%overwritten, %srcForDst); $/ = "\0"; 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 ($opt_k) { print "Warning: $bad; skipping\n"; |