Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Check another error condition in git-mv
author
Josef Weidendorfer
<Josef.Weidendorfer@gmx.de>
Tue, 25 Oct 2005 12:20:45 +0000
(14:20 +0200)
committer
Junio C Hamano
<junkio@cox.net>
Wed, 26 Oct 2005 05:50:49 +0000
(22:50 -0700)
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>
git-mv.perl
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
979e32f
)
diff --git
a/git-mv.perl
b/git-mv.perl
index 28bced95954e40273fc783977d857e5c74d44b51..17e35b0ac088f83bbcd6d104c77925cd69ded2bb 100755
(executable)
--- a/
git-mv.perl
+++ b/
git-mv.perl
@@
-77,7
+77,7
@@
()
my (@allfiles,@srcfiles,@dstfiles);
my $safesrc;
-my
%overwritten
;
+my
(%overwritten, %srcForDst)
;
$/ = "\0";
open(F,"-|","git-ls-files","-z")
@@
-123,6
+123,16
@@
()
}
}
+ 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";