summaryrefslogtreecommitdiff
path: root/git-mv.perl
diff options
context:
space:
mode:
Diffstat (limited to 'git-mv.perl')
-rwxr-xr-xgit-mv.perl12
1 files changed, 11 insertions, 1 deletions
diff --git a/git-mv.perl b/git-mv.perl
index 28bced9..17e35b0 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";