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

[PATCH] Strip any trailing slash on destination argument

From
JWJosef Weidendorfer <josef.weidendorfer@gmx.de>
Date
Nov 1, 2005, 22:46 UTC
Message-ID
<200511012346.27393.Josef.Weidendorfer@gmx.de>

Needed because generating a target paths will add another slash. This fixes e.g. "git-mv file dir/", which removed "file" from version control by renaming it to "dir//file", as git-update-index does not accept such paths.

Thanks goes to Ben Lau for noting this bug.
Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
---
 git-mv.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

applies-to: e39c96179f2cc5064a0255057b8e8a8863594536 e91e743bdf6d246b279fc7f8f5f7ab733690249b

diff --git a/git-mv.perl b/git-mv.perl
index 17e35b0..a21d87e 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -54,6 +54,8 @@ my ($src, $dst, $base, $dstDir);
 my $argCount = scalar @ARGV;
 if (-d $ARGV[$argCount-1]) {
 	$dstDir = $ARGV[$argCount-1];
+	# remove any trailing slash
+	$dstDir =~ s/\/$//;
 	@srcArgs = @ARGV[0..$argCount-2];
 	
 	foreach $src (@srcArgs) {
---
0.99.9
Message 1 of 1 in “Strip any trailing slash on destination argument”
  1. Strip any trailing slash on destination argumentJosef Weidendorfer, Nov 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.