git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-mv dest ending with slash would deletes file only

From
BLBen Lau <benlau@ust.hk>
Date
Nov 1, 2005, 04:20 UTC
Message-ID
<4366ECF1.1010401@ust.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
Next: Josef Weidendorfer
Message 1 of 2 in “git-mv dest ending with slash would deletes file only”
  1. Ben LauNov 1, 2005
  2. Josef WeidendorferNov 1, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.