{"thread":{"id":"26568","subject":"[BUG] git-svn fails to rename files with %20 in filename","startedAt":"2011-02-21T10:12:24Z","lastAt":"2011-03-02T15:27:29Z","messageCount":6,"participants":["Will Palmer","Jeff King","Steven Scott"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"161787","messageId":"1298283144.2772.7.camel@wpalmer.simply-domain","threadId":"26568","inReplyTo":null,"subject":"[BUG] git-svn fails to rename files with %20 in filename","fromName":"Will Palmer","fromEmail":"wmpalmer@gmail.com","sentAt":"2011-02-21T10:12:24Z","receivedAt":"2011-02-21T10:12:24Z","isPatch":false,"sender":{"key":"wmpalmer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/357044?v=4"},"body":"Someone accidentally checked some files containing \"%20\" in their names\ninto our svn repository, which is accessed with either svn or git-svn\ndepending on the developer.\nWhen I attempted to correct this by renaming the file, I received (on\ndcommit):\nFilesystem has no item: File not found: revision 1, path\n'/theBeginningOfTheOriginalFileName theRestOfTheOriginalFilename'\nat /home/wpalmer/libexec/git-core/git-svn line 576\n\n\nA recipe for reproducing this bug is as follows:\n#!/bin/bash\ntemp=\"$(mktemp -t -d 'git-svn.XXXXXXXXXX')\"\n[ -n \"$temp\" ] || { echo \"Failed to create temporary directory\" >&2;\nexit 1; }\nfunction _cleanup(){\n\trm -rf \"$temp\"\n}\ntrap _cleanup INT EXIT\ncd \"$temp\" || exit 1\n\nset -x\nsvnadmin create svn-repos &&\nsvn co file://$PWD/svn-repos svn-wc &&\ncd svn-wc &&\ntouch 'foo%20bar' &&\nsvn add 'foo%20bar' &&\nsvn ci -m 'add foo%20bar' &&\ncd .. &&\ngit svn clone file://$PWD/svn-repos git-wc &&\ncd git-wc &&\ngit mv 'foo%20bar' 'foo-bar' &&\ngit commit -m 's/%20/-/ in filename' &&\ngit svn dcommit # BUG HERE\n"},{"id":"161808","messageId":"20110221123115.GB23033@sigill.intra.peff.net","threadId":"26568","inReplyTo":"1298283144.2772.7.camel@wpalmer.simply-domain","subject":"Re: [BUG] git-svn fails to rename files with %20 in filename","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-02-21T12:31:16Z","receivedAt":"2011-02-21T12:31:16Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Feb 21, 2011 at 10:12:24AM +0000, Will Palmer wrote:\n\n> Someone accidentally checked some files containing \"%20\" in their names\n> into our svn repository, which is accessed with either svn or git-svn\n> depending on the developer.\n> When I attempted to correct this by renaming the file, I received (on\n> dcommit):\n> Filesystem has no item: File not found: revision 1, path\n> '/theBeginningOfTheOriginalFileName theRestOfTheOriginalFilename'\n> at /home/wpalmer/libexec/git-core/git-svn line 576\n> \n> A recipe for reproducing this bug is as follows:\n> [...]\n\nThanks for the thorough test case. It seems to pass for me if with this\napplied:\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 177dd25..7daf63c 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4556,9 +4556,7 @@ sub repo_path {\n \n sub url_path {\n \tmy ($self, $path) = @_;\n-\tif ($self->{url} =~ m#^https?://#) {\n-\t\t$path =~ s!([^~a-zA-Z0-9_./-])!uc sprintf(\"%%%02x\",ord($1))!eg;\n-\t}\n+\t$path =~ s!([^~a-zA-Z0-9_./-])!uc sprintf(\"%%%02x\",ord($1))!eg;\n \t$self->{url} . '/' . $self->repo_path($path);\n }\n \n\nIOW, it looks like the path we hand to svn needs url-encoding even for\nthe local case (which make sense, as it is a file:// url). But I know\nnothing about svn, so probably I am breaking some other weird non-url\nlocal case. :)\n\n-Peff\n"},{"id":"161820","messageId":"AANLkTi=kemr2dPGeE6Z+RDUgrrB8wHE1nM4Zte0EvYMO@mail.gmail.com","threadId":"26568","inReplyTo":"1298283144.2772.7.camel@wpalmer.simply-domain","subject":"Re: [BUG] git-svn fails to rename files with %20 in filename","fromName":"Steven Scott","fromEmail":"steven@codemettle.com","sentAt":"2011-02-21T15:26:46Z","receivedAt":"2011-02-21T15:26:46Z","isPatch":false,"sender":{"key":"steven@codemettle.com","avatar":"https://gravatar.com/avatar/445a12adde42e15e8c97f3d9271b52f70cd1bfcb4c7bf18bf47419fccb0ab209?d=mp&s=160"},"body":"On Mon, Feb 21, 2011 at 5:12 AM, Will Palmer <wmpalmer@gmail.com> wrote:\n> Someone accidentally checked some files containing \"%20\" in their names\n> into our svn repository, which is accessed with either svn or git-svn\n> depending on the developer.\n> When I attempted to correct this by renaming the file, I received (on\n> dcommit):\n> Filesystem has no item: File not found: revision 1, path\n> '/theBeginningOfTheOriginalFileName theRestOfTheOriginalFilename'\n> at /home/wpalmer/libexec/git-core/git-svn line 576\n\nThis is the same issue I've been seeing (except that the %20 is in a\nparent directory on the SVN server). It makes using git-svn fraught\nwith danger, since I never know when I'm going to be unable to checkin\ndays' worth of git commits.\n\n-- \nSteven Scott\n"},{"id":"161894","messageId":"1298393415.2286.18.camel@wpalmer.simply-domain","threadId":"26568","inReplyTo":"20110221123115.GB23033@sigill.intra.peff.net","subject":"Re: [BUG] git-svn fails to rename files with %20 in filename","fromName":"Will Palmer","fromEmail":"wmpalmer@gmail.com","sentAt":"2011-02-22T16:50:15Z","receivedAt":"2011-02-22T16:50:15Z","isPatch":false,"sender":{"key":"wmpalmer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/357044?v=4"},"body":"On Mon, 2011-02-21 at 07:31 -0500, Jeff King wrote:\n> On Mon, Feb 21, 2011 at 10:12:24AM +0000, Will Palmer wrote:\n> \n> > Someone accidentally checked some files containing \"%20\" in their names\n> > into our svn repository, which is accessed with either svn or git-svn\n> > depending on the developer.\n> > When I attempted to correct this by renaming the file, I received (on\n> > dcommit):\n> > Filesystem has no item: File not found: revision 1, path\n> > '/theBeginningOfTheOriginalFileName theRestOfTheOriginalFilename'\n> > at /home/wpalmer/libexec/git-core/git-svn line 576\n> > \n> > A recipe for reproducing this bug is as follows:\n> > [...]\n> \n> Thanks for the thorough test case. It seems to pass for me if with this\n> applied:\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 177dd25..7daf63c 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -4556,9 +4556,7 @@ sub repo_path {\n>  \n>  sub url_path {\n>  \tmy ($self, $path) = @_;\n> -\tif ($self->{url} =~ m#^https?://#) {\n> -\t\t$path =~ s!([^~a-zA-Z0-9_./-])!uc sprintf(\"%%%02x\",ord($1))!eg;\n> -\t}\n> +\t$path =~ s!([^~a-zA-Z0-9_./-])!uc sprintf(\"%%%02x\",ord($1))!eg;\n>  \t$self->{url} . '/' . $self->repo_path($path);\n>  }\n>  \n> \n> IOW, it looks like the path we hand to svn needs url-encoding even for\n> the local case (which make sense, as it is a file:// url). But I know\n> nothing about svn, so probably I am breaking some other weird non-url\n> local case. :)\n> \n> -Peff\n\nUnless I've got my line-numbers mixed up, the commit which introduced\nthe https-specific encoding behaviour,\n29633bb91c git-svn: fix commiting renames over DAV with funky file names\n\nseems to be of the opinion that the bug did not effect file:// and\nsvn:// URLs. Has something changed?\n"},{"id":"162016","messageId":"20110223100431.GD9222@sigill.intra.peff.net","threadId":"26568","inReplyTo":"1298393415.2286.18.camel@wpalmer.simply-domain","subject":"Re: [BUG] git-svn fails to rename files with %20 in filename","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-02-23T10:04:32Z","receivedAt":"2011-02-23T10:04:32Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 22, 2011 at 04:50:15PM +0000, Will Palmer wrote:\n\n> > IOW, it looks like the path we hand to svn needs url-encoding even for\n> > the local case (which make sense, as it is a file:// url). But I know\n> > nothing about svn, so probably I am breaking some other weird non-url\n> > local case. :)\n> > \n> \n> Unless I've got my line-numbers mixed up, the commit which introduced\n> the https-specific encoding behaviour,\n> 29633bb91c git-svn: fix commiting renames over DAV with funky file names\n> \n> seems to be of the opinion that the bug did not effect file:// and\n> svn:// URLs. Has something changed?\n\nYeah, what we are seeing definitely contradicts that commit. It's been\n3.5 years; maybe something was tweaked in the subversion library? I\ntried reading the code, but I got lost amidst all of the nasty perl\nbindings. I couldn't find anything relevant in svn's changelog or in\ngoogle, either.\n\n-Peff\n"},{"id":"162640","messageId":"AANLkTimQTwSPnyNBBNnSYLStZqQvBjWk0ydOpcw1UiwO@mail.gmail.com","threadId":"26568","inReplyTo":"20110223100431.GD9222@sigill.intra.peff.net","subject":"Re: [BUG] git-svn fails to rename files with %20 in filename","fromName":"Steven Scott","fromEmail":"steven@codemettle.com","sentAt":"2011-03-02T15:27:29Z","receivedAt":"2011-03-02T15:27:29Z","isPatch":false,"sender":{"key":"steven@codemettle.com","avatar":"https://gravatar.com/avatar/445a12adde42e15e8c97f3d9271b52f70cd1bfcb4c7bf18bf47419fccb0ab209?d=mp&s=160"},"body":"On Wed, Feb 23, 2011 at 5:04 AM, Jeff King <peff@peff.net> wrote:\n>\n> On Tue, Feb 22, 2011 at 04:50:15PM +0000, Will Palmer wrote:\n>\n> > > IOW, it looks like the path we hand to svn needs url-encoding even for\n> > > the local case (which make sense, as it is a file:// url). But I know\n> > > nothing about svn, so probably I am breaking some other weird non-url\n> > > local case. :)\n> > >\n> >\n> > Unless I've got my line-numbers mixed up, the commit which introduced\n> > the https-specific encoding behaviour,\n> > 29633bb91c git-svn: fix commiting renames over DAV with funky file names\n> >\n> > seems to be of the opinion that the bug did not effect file:// and\n> > svn:// URLs. Has something changed?\n>\n> Yeah, what we are seeing definitely contradicts that commit. It's been\n> 3.5 years; maybe something was tweaked in the subversion library? I\n> tried reading the code, but I got lost amidst all of the nasty perl\n> bindings. I couldn't find anything relevant in svn's changelog or in\n> google, either.\n>\n\n\nIn my case, I *was* using http://, and applying that patch (to remove\nthe HTTP check) didn't work. Same error as earlier in the thread. I\nthought it worked once, but I eventually saw it fail again. git-svn is\ndefinitely broken if the URL has a %20 in it, and it's quite useless\nwhen you never know when you'll be unable to dcommit and manually have\nto generate patches and apply them to a svn repository.\n\nThankfully I got my team to switch to git, so best of luck to the rest\nof you trying to use git-svn when a doofus put a space in the URL :)\n\n--\nSteven Scott\n"}]}