summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-19 07:42:03 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-03-01 20:12:53 (GMT)
commit573464319f70bd54a7c48cfd7bed6a0f6f331f42 (patch)
tree1751afb9e3f6dfa8e37bef374279741512fd97c3
parentfeffaddce0cec7fd3f749d23e95579b683961002 (diff)
downloadgit-573464319f70bd54a7c48cfd7bed6a0f6f331f42.zip
git-573464319f70bd54a7c48cfd7bed6a0f6f331f42.tar.gz
git-573464319f70bd54a7c48cfd7bed6a0f6f331f42.tar.bz2
Allow git-mv to accept ./ in paths.
Signed-off-by: Junio C Hamano <junkio@cox.net> (cherry picked from 9a0e6731c632c841cd2de9dec0b9091b2f10c6fd commit)
-rwxr-xr-xgit-mv.perl9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-mv.perl b/git-mv.perl
index 83dc7e4..2ea852c 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -75,6 +75,15 @@ while(scalar @srcArgs > 0) {
$dst = shift @dstArgs;
$bad = "";
+ for ($src, $dst) {
+ # Be nicer to end-users by doing ".//a/./b/.//./c" ==> "a/b/c"
+ s|^\./||;
+ s|/\./|/| while (m|/\./|);
+ s|//+|/|g;
+ # Also "a/b/../c" ==> "a/c"
+ 1 while (s,(^|/)[^/]+/\.\./,$1,);
+ }
+
if ($opt_v) {
print "Checking rename of '$src' to '$dst'\n";
}