git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-mv dest ending with slash would deletes file only
@ 2005-11-01  4:20 Ben Lau
  2005-11-01 22:46 ` Josef Weidendorfer
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Lau @ 2005-11-01  4:20 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 824 bytes --]

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.


[-- Attachment #2: git-mv-remove-multi-slashes.patch --]
[-- Type: text/x-patch, Size: 364 bytes --]

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-01 22:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-01  4:20 git-mv dest ending with slash would deletes file only Ben Lau
2005-11-01 22:46 ` Josef Weidendorfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).