# git-mv dest ending with slash would deletes file only

2 messages from 2005-11-01 to 2005-11-01. Participants: Ben Lau, Josef Weidendorfer.
Thread: https://gitlist.dev/t/2288

## Ben Lau, 2005-11-01 04:20

Subject: git-mv dest ending with slash would deletes file only
Message-ID: <4366ECF1.1010401@ust.hk>
URL: https://gitlist.dev/e/4366ECF1.1010401%40ust.hk

```
Hi,

    I just tried to use the git-mv to move several files to another 
directory. As the bash's auto completetion leaves the dest path ending 
with slash, the command become:

$ git-mv entry.c Documentation/
Ignoring path Documentation//entry.c

$ git status
#
# Updated but not checked in:
#   (will commit)
#
#       deleted:  entry.c
#

   Checked from the source, git-update-index do not accept 
multiple-successive-slashes (verify_path()@update-index.c), which should 
be considered as one slash according to POSIX standard.

   However, changes the verify_path() function do not help. It seems 
that git consider file with single slash and multiple slashes as two 
different object. Therefore, I added a line inside git-mv script to 
replace multiple-successive-slashes as one and it works fine in my 
system now.



diff --git a/git-mv.perl b/git-mv.perl
index 17e35b0..283d7e1 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -92,6 +92,7 @@ while(scalar @srcArgs > 0) {
     $src = shift @srcArgs;
     $dst = shift @dstArgs;
     $bad = "";
+    $dst =~ s/\/+/\//g;
 
     if ($opt_v) {
 	print "Checking rename of '$src' to '$dst'\n";
diff --git a/update-index.c b/update-index.c

```

## Josef Weidendorfer, 2005-11-01 22:46

Subject: Re: git-mv dest ending with slash would deletes file only
Message-ID: <200511012346.42640.Josef.Weidendorfer@gmx.de>
URL: https://gitlist.dev/e/200511012346.42640.Josef.Weidendorfer%40gmx.de
In-Reply-To: <4366ECF1.1010401@ust.hk>

```
On Tuesday 01 November 2005 05:20, Ben Lau wrote:
> $ git-mv entry.c Documentation/
> Ignoring path Documentation//entry.c

Instead of mangling all destination paths, I only
would strip a trailing slash of the destination argument.
See my other mail with the patch.

Thanks for noting this bug,
Josef

```
