{"thread":{"id":"20608","subject":"git-svn bug report: %20 in http:// should translate to a space ' ' automatically","startedAt":"2009-08-15T17:48:10Z","lastAt":"2009-08-16T21:22:12Z","messageCount":5,"participants":["Mike Smullin","Björn Steinbrink","Tony Finch","Daniel Stenberg","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"120721","messageId":"4A86F4DA.5090605@smullindesign.com","threadId":"20608","inReplyTo":null,"subject":"git-svn bug report: %20 in http:// should translate to a space ' ' automatically","fromName":"Mike Smullin","fromEmail":"mike@smullindesign.com","sentAt":"2009-08-15T17:48:10Z","receivedAt":"2009-08-15T17:48:10Z","isPatch":false,"sender":{"key":"mike@smullindesign.com","avatar":null},"body":"Hello,\n\nThis one took me over an hour to figure out with the help of doener in \n#git on irc.freenode.net:\n\n(10:11:15) jeanrussou: i am using git-svn clone to checkout individual \ndirectories from an svn repo as separate .git repos on my local hdd. \nsome of the git-svn clone attempts get all of svn repo history, this one \ngets only the last commit. an svn log of the same path returns a history \nof at least 5 commits. i only have the most recent one in my git log \nafter git svn clone. any idea why?\n...\n(10:18:37) charon: jeanrussou: git-svn only tracks svn rename/copy \noperations that are \"visible\" to it, i.e., happen entirely within the \npaths cloned\n(10:18:53) charon: jeanrussou: try 'svn log -v' to see if the directory \nwas moved\n(10:18:54) jeanrussou: charon: yes, i did move the path. is there a \nworkaround? can i tell git-svn the original path before the move, or \nsomething?\n(10:23:46) doener: jeanrussou: so what's the situation you have? Cloning \nrepo/foo and repo/foo/bar was repo/goo in the past?\n(10:23:56) doener: jeanrussou: or cloning repo/foo which was repo/bar in \nthe past?\n(10:24:59) jeanrussou: in the beginning there was \nhttp://repo/projects/Client%20Name/Project, then over time it became \nhttp://repo/projects/archive/Client%20Name/Project. i am now attempting \ngit-svn clone on the latter url\n(10:25:28) jeanrussou: there were no changes to the project after it \nwent into archive\n(10:25:36) jeanrussou: i believe this is why it appears to only be \ngrabbing the last commit (which was the move)\n(10:25:49) doener: jeanrussou: if that was a direct rename from one to \nthe other, git-svn should be able to follow that\n... (trying -T, also svn+ssh://) ... finally the cause is found ...\n(11:27:49) jeanrussou: i wrap it in double-quotes and replace %20 with a \nspace ' ' and it works\n(11:31:40) jeanrussou: oh if i just replace %20 with a space the http:// \nurl works too\n(11:31:48) doener: *lol*\n(11:31:57) jeanrussou: dangit\n(11:32:20) jeanrussou: thanks doener\n(11:32:23) jeanrussou: u rock\n(11:32:25) doener: you're welcome\n(11:33:10) doener: too bad that the bug reports I found didn't have the \nspace issue, would likely have saved some time ;-)\n(11:33:38) jeanrussou: ya we should make one\n(11:34:01) jeanrussou: that would be cool if git-svn could unescape the \nurl encodings for http:// paths\n(11:34:17) doener: well, the path could contain a literal %20\n(11:34:46) doener: not very common, but I guess the \"give me the plain \npath, please\" approach of git-svn is ok\n(11:35:39) jeanrussou: ya i could see that with svn+ssh:// and file:// \nbut with http:// its going over WebDAV and i'd have to read the RFCs but \nit might even be an HTTP thing about accessing URLs that % is not valid \nin URLs\n(11:36:37) doener: yeah, those need to be escaped as %25 (IIRC). And \nit's kinda weird that the one without -T works\n(11:36:49) jeanrussou: o ya definitely. that too\n(11:36:56) doener: so yeah, a bug report might be the right thing\n(11:36:57) jeanrussou: thats what threw me off. i thought the url was \nworking because of that\n(11:37:14) jeanrussou: okay cool lets see if i can find the git bug tracker\n\nHope this helps! :)\n\n--\nRespectfully,\n\nMike Smullin\nSenior Web Systems Director\nSmullin Design and Development, LLC\n\nhttp://www.smullindesign.com\nhttp://www.linkedin.com/in/mikesmullin\n\n2112 E. Frontier St.\nEagle Mountain, Utah 84005\nUnited States\n\ntoll-free: +1 800-819-7431\nmobile: +1 801-652-5849\nskype: smullindesign\n"},{"id":"120722","messageId":"20090815181637.GC19833@atjola.homenet","threadId":"20608","inReplyTo":"4A86F4DA.5090605@smullindesign.com","subject":"Re: git-svn bug report: %20 in http:// should translate to a space ' ' automatically","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-08-15T18:16:37Z","receivedAt":"2009-08-15T18:16:37Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.08.15 11:48:10 -0600, Mike Smullin wrote:\n> Hello,\n> \n> This one took me over an hour to figure out with the help of doener\n> in #git on irc.freenode.net:\n\n[IRC log omitted]\n\nTo wrap that up:\n\n1) git svn clone http://host/repo/path%20with%20spaces/foo/bar/goo\n\nWorks, but see below.\n\n2) git svn clone -Tgoo http://host/repo/path%20with%20spaces/foo/bar\n\nFails.\n\n3) git svn clone -Tgoo \"http://host/repo/path with spaces/foo/bar\"\n\nWorks.\n\n\nIn Mike's case, there was a rename from foo/goo to foo/bar/goo. 1) fails\nto follow that rename, 2) just completely fails and 3) works and follows\nthe rename.\n\nCloning via http:// didn't provide any interesting error messages, but\ncloning via svn+ssh:// showed:\n\nFor 1)\nW: Ignoring error from SVN, path probably does not exist: (160013):\nFilesystem has no item: File not found: revision 100, path\n'/path with spaces/foo/bar\"\n\nFor 2)\nW: Ignoring error from SVN, path probably does not exist: (160013):\nFilesystem has no item: File not found: revision 100, path\n'/path%20with%20spaces/foo/bar\"\n\n\nSo 2) somehow has the spaces escaped there, but 1) doesn't.\n\nI guess that 1) has it right, and the rename detection just doesn't work\nbecause the old name is outside of \"url\" for the svn-remote. And 2)\nsomehow gets it wrong, likely double-escaping the spaces or so. (I have\nno idea...)\n\nMy totally uneducated guess is that git-svn fails to unescaped the path\nwhen it splits it into the higher-level part for \"url\" and the rest of\nit for \"fetch\".\n\nHTH\nBjörn\n"},{"id":"120740","messageId":"alpine.LSU.2.00.0908152336240.449@hermes-2.csi.cam.ac.uk","threadId":"20608","inReplyTo":"20090815181637.GC19833@atjola.homenet","subject":"Re: git-svn bug report: %20 in http:// should translate to a space ' ' automatically","fromName":"Tony Finch","fromEmail":"dot@dotat.at","sentAt":"2009-08-15T22:37:09Z","receivedAt":"2009-08-15T22:37:09Z","isPatch":false,"sender":{"key":"dot@dotat.at","avatar":"https://avatars.githubusercontent.com/u/68429?v=4"},"body":"On Sat, 15 Aug 2009, Björn Steinbrink wrote:\n>\n> 3) git svn clone -Tgoo \"http://host/repo/path with spaces/foo/bar\"\n>\n> Works.\n\nSpaces are not permitted in URLs so this should be treated as a syntax\nerror.\n\nTony.\n-- \nf.anthony.n.finch  <dot@dotat.at>  http://dotat.at/\nGERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.\nMODERATE OR GOOD."},{"id":"120773","messageId":"alpine.DEB.2.00.0908162012190.13789@yvahk2.pbagnpgbe.fr","threadId":"20608","inReplyTo":"alpine.LSU.2.00.0908152336240.449@hermes-2.csi.cam.ac.uk","subject":"Re: git-svn bug report: %20 in http:// should translate to a space ' ' automatically","fromName":"Daniel Stenberg","fromEmail":"daniel@haxx.se","sentAt":"2009-08-16T18:13:31Z","receivedAt":"2009-08-16T18:13:31Z","isPatch":false,"sender":{"key":"daniel@haxx.se","avatar":"https://gravatar.com/avatar/69fdca87edd17cee21ca2e79fc2ff671d644603c3dc27167430f3cd3dbab7ba8?d=mp&s=160"},"body":"On Sat, 15 Aug 2009, Tony Finch wrote:\n\n> On Sat, 15 Aug 2009, Björn Steinbrink wrote:\n>>\n>> 3) git svn clone -Tgoo \"http://host/repo/path with spaces/foo/bar\"\n>>\n>> Works.\n>\n> Spaces are not permitted in URLs so this should be treated as a syntax \n> error.\n\nlibcurl OTOH doesn't verify the passed in data to be strict URLs but will \ninstead do its best to work with whatever is passed to it...\n\n-- \n\n  / daniel.haxx.se"},{"id":"120785","messageId":"20090816212212.GA19859@dcvr.yhbt.net","threadId":"20608","inReplyTo":"20090815181637.GC19833@atjola.homenet","subject":"[PATCH] svn: assume URLs from the command-line are URI-encoded","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-08-16T21:22:12Z","receivedAt":"2009-08-16T21:22:12Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"And then unescape them when writing to $GIT_CONFIG.\n\nSVN has different rules for repository URLs (usually the root)\nand for paths within that repository (below the HTTP layer).\nThus, for the request URI path at the HTTP level, the URI needs\nto be encoded.  However, in the body of the HTTP request (the\nwith underlying SVN XML protocol), those paths should not be\nURI-encoded[1].  For non-HTTP(S) requests, SVN appears to be\nmore flexible and will except weird characters in the URL as\nwell as URI-encoded ones.\n\nSince users are used to using URLs being entirely URI-encoded,\ngit svn will now attempt to unescape the path portion of URLs\nwhile leaving the actual repository URL untouched.\n\nThis change will be reflected in newly-created $GIT_CONFIG files\nonly.  This allows users to switch between svn(+ssh)://, file://\nand http(s):// urls without changing the fetch/branches/tags\nconfig keys.  This won't affect existing imports at all (since\nthings didn't work before this commit anyways), and will allow\nusers to force escaping into repository paths that look like\nthey're escaped (but are not).\n\nThanks to Mike Smullin for the original bug report and Björn\nSteinbrink for summarizing it into testable cases for me.\n\n[1] Except when committing copies/renames, see\n    commit 29633bb91c7bcff31ff3bb59378709e3e3ef627d\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n\n When I first wrote git svn back in early 2006, I remember\n telling a friend I hope I'd never have to deal with SVN ever\n again...\n\n git-svn.perl                                  |    2 +\n t/t9120-git-svn-clone-with-percent-escapes.sh |   52 +++++++++++++++++++++++++\n 2 files changed, 54 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex b0bfb74..5083c30 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1211,6 +1211,7 @@ sub complete_url_ls_init {\n \t}\n \tcommand_oneline('config', $k, $gs->{url}) unless $orig_url;\n \tmy $remote_path = \"$gs->{path}/$repo_path\";\n+\t$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t$remote_path =~ s#/+#/#g;\n \t$remote_path =~ s#^/##g;\n \t$remote_path .= \"/*\" if $remote_path !~ /\\*/;\n@@ -1879,6 +1880,7 @@ sub init_remote_config {\n \t\tcommand_noisy('config',\n \t\t\t      \"svn-remote.$self->{repo_id}.url\", $url);\n \t\t$self->{path} =~ s{^/}{};\n+\t\t$self->{path} =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t\tcommand_noisy('config', '--add',\n \t\t\t      \"svn-remote.$self->{repo_id}.fetch\",\n \t\t\t      \"$self->{path}:\".$self->refname);\ndiff --git a/t/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh\nindex f159ab6..9d9ebd5 100755\n--- a/t/t9120-git-svn-clone-with-percent-escapes.sh\n+++ b/t/t9120-git-svn-clone-with-percent-escapes.sh\n@@ -10,6 +10,10 @@ test_expect_success 'setup svnrepo' '\n \tmkdir project project/trunk project/branches project/tags &&\n \techo foo > project/trunk/foo &&\n \tsvn_cmd import -m \"$test_description\" project \"$svnrepo/pr ject\" &&\n+\tsvn_cmd cp -m \"branch\" \"$svnrepo/pr ject/trunk\" \\\n+\t  \"$svnrepo/pr ject/branches/b\" &&\n+\tsvn_cmd cp -m \"tag\" \"$svnrepo/pr ject/trunk\" \\\n+\t  \"$svnrepo/pr ject/tags/v1\" &&\n \trm -rf project &&\n \tstart_httpd\n '\n@@ -21,6 +25,54 @@ test_expect_success 'test clone with percent escapes' '\n \tcd ..\n '\n \n+# SVN works either way, so should we...\n+\n+test_expect_success 'svn checkout with percent escapes' '\n+\tsvn_cmd checkout \"$svnrepo/pr%20ject\" svn.percent &&\n+\tsvn_cmd checkout \"$svnrepo/pr%20ject/trunk\" svn.percent.trunk\n+'\n+\n+test_expect_success 'svn checkout with space' '\n+\tsvn_cmd checkout \"$svnrepo/pr ject\" svn.space &&\n+\tsvn_cmd checkout \"$svnrepo/pr ject/trunk\" svn.space.trunk\n+'\n+\n+test_expect_success 'test clone trunk with percent escapes and minimize-url' '\n+\tgit svn clone --minimize-url \"$svnrepo/pr%20ject/trunk\" minimize &&\n+\t(\n+\t\tcd minimize &&\n+\t\tgit rev-parse refs/${remotes_git_svn}\n+\t)\n+'\n+\n+test_expect_success 'test clone trunk with percent escapes' '\n+\tgit svn clone \"$svnrepo/pr%20ject/trunk\" trunk &&\n+\t(\n+\t\tcd trunk &&\n+\t\tgit rev-parse refs/${remotes_git_svn}\n+\t)\n+'\n+\n+test_expect_success 'test clone --stdlayout with percent escapes' '\n+\tgit svn clone --stdlayout \"$svnrepo/pr%20ject\" percent &&\n+\t(\n+\t\tcd percent &&\n+\t\tgit rev-parse refs/remotes/trunk^0 &&\n+\t\tgit rev-parse refs/remotes/b^0 &&\n+\t\tgit rev-parse refs/remotes/tags/v1^0\n+\t)\n+'\n+\n+test_expect_success 'test clone -s with unescaped space' '\n+\tgit svn clone -s \"$svnrepo/pr ject\" space &&\n+\t(\n+\t\tcd space &&\n+\t\tgit rev-parse refs/remotes/trunk^0 &&\n+\t\tgit rev-parse refs/remotes/b^0 &&\n+\t\tgit rev-parse refs/remotes/tags/v1^0\n+\t)\n+'\n+\n stop_httpd\n \n test_done\n-- \nEric Wong\n"}]}