git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Lau <benlau@ust.hk>
To: git@vger.kernel.org
Subject: git-mv dest ending with slash would deletes file only
Date: Tue, 01 Nov 2005 12:20:01 +0800	[thread overview]
Message-ID: <4366ECF1.1010401@ust.hk> (raw)

[-- 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

             reply	other threads:[~2005-11-01  4:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01  4:20 Ben Lau [this message]
2005-11-01 22:46 ` git-mv dest ending with slash would deletes file only Josef Weidendorfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4366ECF1.1010401@ust.hk \
    --to=benlau@ust.hk \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).