projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add test case for git-config-set
[git.git]
/
git-mv.perl
diff --git
a/git-mv.perl
b/git-mv.perl
index
28bced9
..
a21d87e
100755
(executable)
--- a/
git-mv.perl
+++ b/
git-mv.perl
@@
-54,6
+54,8
@@
my ($src, $dst, $base, $dstDir);
my $argCount = scalar @ARGV;
if (-d $ARGV[$argCount-1]) {
$dstDir = $ARGV[$argCount-1];
my $argCount = scalar @ARGV;
if (-d $ARGV[$argCount-1]) {
$dstDir = $ARGV[$argCount-1];
+ # remove any trailing slash
+ $dstDir =~ s/\/$//;
@srcArgs = @ARGV[0..$argCount-2];
foreach $src (@srcArgs) {
@srcArgs = @ARGV[0..$argCount-2];
foreach $src (@srcArgs) {
@@
-77,7
+79,7
@@
else {
my (@allfiles,@srcfiles,@dstfiles);
my $safesrc;
my (@allfiles,@srcfiles,@dstfiles);
my $safesrc;
-my
%overwritten
;
+my
(%overwritten, %srcForDst)
;
$/ = "\0";
open(F,"-|","git-ls-files","-z")
$/ = "\0";
open(F,"-|","git-ls-files","-z")
@@
-123,6
+125,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";
if ($bad ne "") {
if ($opt_k) {
print "Warning: $bad; skipping\n";