{"thread":{"id":"23720","subject":"[PATCH] git-svn: mangle refnames forbidden in git","startedAt":"2010-05-06T20:20:43Z","lastAt":"2010-07-08T20:38:09Z","messageCount":9,"participants":["Torsten Schmutzler","Eric Wong","Jonathan Nieder","Michael J Gruber","A Large Angry SCM"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"141088","messageId":"4BE3249B.7050100@theblacksun.eu","threadId":"23720","inReplyTo":null,"subject":"[PATCH] git-svn: mangle refnames forbidden in git","fromName":"Torsten Schmutzler","fromEmail":"git-ts@theblacksun.eu","sentAt":"2010-05-06T20:20:43Z","receivedAt":"2010-05-06T20:20:43Z","isPatch":true,"sender":{"key":"git-ts@theblacksun.eu","avatar":null},"body":"git-check-ref-format(1) describes names which\ncannot be used as refnames for git.  Some are\nlegal branchnames in subversion however.\nMangle the not yet handled cases.\n\nSigned-off-by: Torsten Schmutzler <git-ts@theblacksun.eu>\n---\n git-svn.perl                          |    8 ++++++++\n t/t9118-git-svn-funky-branch-names.sh |   21 +++++++++++++++++++++\n 2 files changed, 29 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 2c86ea2..57df509 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -2086,6 +2086,14 @@ sub refname {\n \t# .. becomes %2E%2E\n \t$refname =~ s{\\.\\.}{%2E%2E}g;\n \n+\t# trailing dots and .lock are not allowed\n+\t# .$ becomes %2E and .lock becomes %2Elock\n+\t$refname =~ s{\\.(?=$|lock$)}{%2E};\n+\n+\t# the sequence @{ is used to access the reflog\n+\t# @{ becomes %40{\n+\t$refname =~ s{\\@\\{}{%40\\{}g;\n+\n \treturn $refname;\n }\n \ndiff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh\nindex ac52bff..7d7acc3 100755\n--- a/t/t9118-git-svn-funky-branch-names.sh\n+++ b/t/t9118-git-svn-funky-branch-names.sh\n@@ -21,6 +21,14 @@ test_expect_success 'setup svnrepo' '\n \t                      \"$svnrepo/pr ject/branches/more fun plugin!\" &&\n \tsvn_cmd cp -m \"scary\" \"$svnrepo/pr ject/branches/fun plugin\" \\\n \t              \"$svnrepo/pr ject/branches/$scary_uri\" &&\n+\tsvn_cmd cp -m \"leading dot\" \"$svnrepo/pr ject/trunk\" \\\n+\t\t\t\"$svnrepo/pr ject/branches/.leading_dot\" &&\n+\tsvn_cmd cp -m \"trailing dot\" \"$svnrepo/pr ject/trunk\" \\\n+\t\t\t\"$svnrepo/pr ject/branches/trailing_dot.\" &&\n+\tsvn_cmd cp -m \"trailing .lock\" \"$svnrepo/pr ject/trunk\" \\\n+\t\t\t\"$svnrepo/pr ject/branches/trailing_dotlock.lock\" &&\n+\tsvn_cmd cp -m \"reflog\" \"$svnrepo/pr ject/trunk\" \\\n+\t\t\t\"$svnrepo/pr ject/branches/not-a@{0}reflog\" &&\n \tstart_httpd\n \t'\n \n@@ -30,6 +38,10 @@ test_expect_success 'test clone with funky branch names' '\n \t\tgit rev-parse \"refs/remotes/fun%20plugin\" &&\n \t\tgit rev-parse \"refs/remotes/more%20fun%20plugin!\" &&\n \t\tgit rev-parse \"refs/remotes/$scary_ref\" &&\n+\t\tgit rev-parse \"refs/remotes/%2Eleading_dot\" &&\n+\t\tgit rev-parse \"refs/remotes/trailing_dot%2E\" &&\n+\t\tgit rev-parse \"refs/remotes/trailing_dotlock%2Elock\" &&\n+\t\tgit rev-parse \"refs/remotes/not-a%40{0}reflog\" &&\n \tcd ..\n \t'\n \n@@ -51,6 +63,15 @@ test_expect_success 'test dcommit to scary branch' '\n \tcd ..\n \t'\n \n+test_expect_success 'test dcommit to trailing_dotlock branch' '\n+\tcd project &&\n+\tgit reset --hard \"refs/remotes/trailing_dotlock%2Elock\" &&\n+\techo who names branches like this anyway? >> foo &&\n+\tgit commit -m \"bar\" -- foo &&\n+\tgit svn dcommit &&\n+\tcd ..\n+\t'\n+\n stop_httpd\n \n test_done\n-- \n1.7.1.12.ge45de\n"},{"id":"141301","messageId":"20100509083500.GB12627@dcvr.yhbt.net","threadId":"23720","inReplyTo":"4BE3249B.7050100@theblacksun.eu","subject":"Re: [PATCH] git-svn: mangle refnames forbidden in git","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-05-09T08:35:00Z","receivedAt":"2010-05-09T08:35:00Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Torsten Schmutzler <git-ts@theblacksun.eu> wrote:\n> git-check-ref-format(1) describes names which\n> cannot be used as refnames for git.  Some are\n> legal branchnames in subversion however.\n> Mangle the not yet handled cases.\n> \n> Signed-off-by: Torsten Schmutzler <git-ts@theblacksun.eu>\n\nThanks,\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n...and pushed out to git://git.bogomips.org/git-svn\n\n-- \nEric Wong\n"},{"id":"145100","messageId":"20100708084356.GA29856@burratino","threadId":"23720","inReplyTo":"4BE3249B.7050100@theblacksun.eu","subject":"Re: [PATCH] git-svn: mangle refnames forbidden in git","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-08T08:43:57Z","receivedAt":"2010-07-08T08:43:57Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"t9118-git-svn-funky-branch-names.sh fails for me:\n\n [...]\n 3402a8497588142722deb77f6e4f42b6caaabc85\n refs/remotes/not-a%40{0}reflog\n fatal: ambiguous argument 'refs/remotes/not-a%40{0}reflog': unknown revision or path not in the working tree.\n Use '--' to separate paths from revisions\n not ok - 2 test clone with funky branch names\n\nMore precisely, the failure occurs in the\n\n \tsvn_cmd cp -m \"reflog\" \"$svnrepo/pr ject/trunk\" \\\n\t\t\t\"$svnrepo/pr ject/branches/not-a@{0}reflog\" &&\n\nline in that test: I think svn is handling the @ itself here.\n\n $ svnadmin create /tmp/foo\n $ svn checkout file:///tmp/foo wc\n Checked out revision 0.\n $ echo hello >wc/source\n $ (cd wc && svn add source)\n A         source\n $ (cd wc && svn commit -m one)\n Adding         source\n Transmitting file data .\n Committed revision 1.\n $ svn cp -m reflog file:///tmp/foo/source 'file:///tmp/foo/not-a@{0}reflog'\n Committed revision 2.\n $ (cd wc && svn update)\n A    not-a\n Updated to revision 2.\n\n $ svn --version\n svn, version 1.6.12 (r955767)\n    compiled Jun 21 2010, 20:24:54\n [...]\n\nIdeas?\n"},{"id":"145102","messageId":"20100708085814.GC10779@dcvr.yhbt.net","threadId":"23720","inReplyTo":"20100708084356.GA29856@burratino","subject":"Re: [PATCH] git-svn: mangle refnames forbidden in git","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-07-08T08:58:14Z","receivedAt":"2010-07-08T08:58:14Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Jonathan Nieder <jrnieder@gmail.com> wrote:\n> t9118-git-svn-funky-branch-names.sh fails for me:\n> \n>  [...]\n>  3402a8497588142722deb77f6e4f42b6caaabc85\n>  refs/remotes/not-a%40{0}reflog\n>  fatal: ambiguous argument 'refs/remotes/not-a%40{0}reflog': unknown revision or path not in the working tree.\n>  Use '--' to separate paths from revisions\n>  not ok - 2 test clone with funky branch names\n> \n> More precisely, the failure occurs in the\n> \n>  \tsvn_cmd cp -m \"reflog\" \"$svnrepo/pr ject/trunk\" \\\n> \t\t\t\"$svnrepo/pr ject/branches/not-a@{0}reflog\" &&\n> \n> line in that test: I think svn is handling the @ itself here.\n<snip>\n>  $ svn --version\n>  svn, version 1.6.12 (r955767)\n>     compiled Jun 21 2010, 20:24:54\n>  [...]\n> \n> Ideas?\n\nI can't reproduce it with 1.5.1 here, does URI-escaping the \"@{0}\"\nto \"%40%7B0%7D\" work?\n\n-- \nEric Wong\n"},{"id":"145122","messageId":"20100708130315.GA1529@burratino","threadId":"23720","inReplyTo":"20100708085814.GC10779@dcvr.yhbt.net","subject":"Re: [PATCH] git-svn: mangle refnames forbidden in git","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-08T13:03:15Z","receivedAt":"2010-07-08T13:03:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Eric Wong wrote:\n\n> I can't reproduce it with 1.5.1 here, does URI-escaping the \"@{0}\"\n> to \"%40%7B0%7D\" work?\n\nYes.\n\n ...\n $ svn cp -m reflog file:///tmp/foo/source 'file:///tmp/foo/not-a%40%7B0%7Dreflog'\n Committed revision 2.\n $ (cd wc && svn update)\n A    not-a@{0}reflog\n Updated to revision 2.\n\nDoes that work with svn 1.5.x?\n"},{"id":"145143","messageId":"4C361EB5.7010704@drmicha.warpmail.net","threadId":"23720","inReplyTo":"20100708130315.GA1529@burratino","subject":"Re: [PATCH] git-svn: mangle refnames forbidden in git","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-07-08T18:53:41Z","receivedAt":"2010-07-08T18:53:41Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jonathan Nieder venit, vidit, dixit 08.07.2010 15:03:\n> Eric Wong wrote:\n> \n>> I can't reproduce it with 1.5.1 here, does URI-escaping the \"@{0}\"\n>> to \"%40%7B0%7D\" work?\n> \n> Yes.\n> \n>  ...\n>  $ svn cp -m reflog file:///tmp/foo/source 'file:///tmp/foo/not-a%40%7B0%7Dreflog'\n>  Committed revision 2.\n>  $ (cd wc && svn update)\n>  A    not-a@{0}reflog\n>  Updated to revision 2.\n> \n> Does that work with svn 1.5.x?\n\nIt turns out this is not so much about general escaping but about the\ntreatment of so called svn PEG revisions (not so unsimilar to our @{}).\n\nsvn r954995 integrated r952973 (which implemented the eating of PEG\nrevisions) into the 1.6.x branch. It's considered a bug fix.\n\nThis \"fix\" is in 1.6.12 but not in 1.6.11.\n\nNow, git-svn adjusts its behaviour to the svn version for things like\ninfo. But I don't know if it's worth doing in this case - maybe we\nshould just change the test not to use the PEG revisions identifier \"@\".\n\nMichael\n"},{"id":"145150","messageId":"2f9f1bd8efb818456fcc386f419fc17f4e435e19.1278616418.git.git@drmicha.warpmail.net","threadId":"23720","inReplyTo":"4C361EB5.7010704@drmicha.warpmail.net","subject":"[PATCH] t9118: avoid PEG revision identifier in tests","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-07-08T19:16:35Z","receivedAt":"2010-07-08T19:16:35Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"@ is SVN's identifier for PEG revisions. But SVN's treatment of PEG\nidentifiers in copy target URLs changed in r954995/r952973, i.e. between\n1.6.11 and 1.6.12. They get eaten now (which is considered the right\nway).\n\nTherefore, avoid the @ in the tests with funky branch names.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nThis version is tested with svn 1.6.9 and 1.6.12.\n\n t/t9118-git-svn-funky-branch-names.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh\nindex 7d7acc3..45d5b2d 100755\n--- a/t/t9118-git-svn-funky-branch-names.sh\n+++ b/t/t9118-git-svn-funky-branch-names.sh\n@@ -28,7 +28,7 @@ test_expect_success 'setup svnrepo' '\n \tsvn_cmd cp -m \"trailing .lock\" \"$svnrepo/pr ject/trunk\" \\\n \t\t\t\"$svnrepo/pr ject/branches/trailing_dotlock.lock\" &&\n \tsvn_cmd cp -m \"reflog\" \"$svnrepo/pr ject/trunk\" \\\n-\t\t\t\"$svnrepo/pr ject/branches/not-a@{0}reflog\" &&\n+\t\t\t\"$svnrepo/pr ject/branches/not-a%40{0}reflog\" &&\n \tstart_httpd\n \t'\n \n-- \n1.7.2.rc1.212.g850a\n"},{"id":"145154","messageId":"4C362807.80703@gmail.com","threadId":"23720","inReplyTo":"2f9f1bd8efb818456fcc386f419fc17f4e435e19.1278616418.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] t9118: avoid PEG revision identifier in tests","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2010-07-08T19:33:27Z","receivedAt":"2010-07-08T19:33:27Z","isPatch":true,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"On 07/08/2010 03:16 PM, Michael J Gruber wrote:\n> @ is SVN's identifier for PEG revisions. But SVN's treatment of PEG\n> identifiers in copy target URLs changed in r954995/r952973, i.e. between\n> 1.6.11 and 1.6.12. They get eaten now (which is considered the right\n> way).\n>\n> Therefore, avoid the @ in the tests with funky branch names.\n>\n> Signed-off-by: Michael J Gruber<git@drmicha.warpmail.net>\n> ---\n> This version is tested with svn 1.6.9 and 1.6.12.\n>\n>   t/t9118-git-svn-funky-branch-names.sh |    2 +-\n>   1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh\n> index 7d7acc3..45d5b2d 100755\n> --- a/t/t9118-git-svn-funky-branch-names.sh\n> +++ b/t/t9118-git-svn-funky-branch-names.sh\n> @@ -28,7 +28,7 @@ test_expect_success 'setup svnrepo' '\n>   \tsvn_cmd cp -m \"trailing .lock\" \"$svnrepo/pr ject/trunk\" \\\n>   \t\t\t\"$svnrepo/pr ject/branches/trailing_dotlock.lock\"&&\n>   \tsvn_cmd cp -m \"reflog\" \"$svnrepo/pr ject/trunk\" \\\n> -\t\t\t\"$svnrepo/pr ject/branches/not-a@{0}reflog\"&&\n> +\t\t\t\"$svnrepo/pr ject/branches/not-a%40{0}reflog\"&&\n>   \tstart_httpd\n>   \t'\n>\n\nWith this patch, 'make test' now passes, and make -j4 test' does also.\n"},{"id":"145162","messageId":"20100708203809.GA2991@dcvr.yhbt.net","threadId":"23720","inReplyTo":"2f9f1bd8efb818456fcc386f419fc17f4e435e19.1278616418.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] t9118: avoid PEG revision identifier in tests","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-07-08T20:38:09Z","receivedAt":"2010-07-08T20:38:09Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Michael J Gruber <git@drmicha.warpmail.net> wrote:\n> @ is SVN's identifier for PEG revisions. But SVN's treatment of PEG\n> identifiers in copy target URLs changed in r954995/r952973, i.e. between\n> 1.6.11 and 1.6.12. They get eaten now (which is considered the right\n> way).\n> \n> Therefore, avoid the @ in the tests with funky branch names.\n> \n> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n> ---\n> This version is tested with svn 1.6.9 and 1.6.12.\n\nThanks Michael, also tested with svn 1.5.1.\nAcked and pushed up to git://git.bogomips.org/git-svn\n\n-- \nEric Wong\n"}]}