{"thread":{"id":"26989","subject":"[PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config","startedAt":"2011-04-04T19:09:06Z","lastAt":"2011-04-22T19:40:13Z","messageCount":33,"participants":["Alejandro R. Sedeño","Eric Wong","James Y Knight","Junio C Hamano","Michael J Gruber","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"165135","messageId":"1301944148-7950-1-git-send-email-asedeno@mit.edu","threadId":"26989","inReplyTo":null,"subject":"[PATCHv2 0/2] a couple of git-svn patches","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-04T19:09:06Z","receivedAt":"2011-04-04T19:09:06Z","isPatch":false,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"(The patches themselves haven't changed since I sent them to the list\non Friday, but this does clean up attribution and sign-offs in the\ncommit messages.)\n\nHere are two independent git-svn patches that my co-worker handed off\nto me back in January.\n\nThe first changes the behavior of commit_url to be like that of url so\nthat you can commit to multiple branches.\n\nThe second uses Memoize to cache the results of shelling out to\ngit-config, which has good performance benefits for git-svn fetch.\n"},{"id":"165134","messageId":"1301944148-7950-2-git-send-email-asedeno@mit.edu","threadId":"26989","inReplyTo":"1301944148-7950-1-git-send-email-asedeno@mit.edu","subject":"[PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-04T19:09:07Z","receivedAt":"2011-04-04T19:09:07Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"From: James Y Knight <jknight@itasoftware.com>\n\nThis is necessary if you want to be able to commit to multiple branches.\n\nSigned-off-by: James Y Knight <jknight@itasoftware.com>\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n---\n git-svn.perl |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex a5857c1..aa41896 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -523,12 +523,14 @@ sub cmd_dcommit {\n \t}\n \n \tif (defined $_commit_url) {\n-\t\t$url = $_commit_url;\n+\t\t$url = $_commit_url . (length $gs->{path} ? '/' . $gs->{path} : '');\n \t} else {\n \t\t$url = eval { command_oneline('config', '--get',\n \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n \t\tif (!$url) {\n \t\t\t$url = $gs->full_url\n+\t\t} else {\n+\t\t\t$url = $url . (length $gs->{path} ? '/' . $gs->{path} : '');\n \t\t}\n \t}\n \n-- \n1.7.4.2.1.gd6f1f\n"},{"id":"165136","messageId":"1301944148-7950-3-git-send-email-asedeno@mit.edu","threadId":"26989","inReplyTo":"1301944148-7950-1-git-send-email-asedeno@mit.edu","subject":"[PATCH 2/2] git-svn: Cache results of running the executable \"git config\"","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-04T19:09:08Z","receivedAt":"2011-04-04T19:09:08Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"From: James Y Knight <jknight@itasoftware.com>\n\nRunning programs is not cheap!\n\nSigned-off-by: James Y Knight <jknight@itasoftware.com>\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n---\n git-svn.perl |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex aa41896..e47e04c 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -59,6 +59,7 @@ use File::Find;\n use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;\n use IPC::Open3;\n use Git;\n+use Memoize;  # core since 5.8.0, Jul 2002\n \n BEGIN {\n \t# import functions from Git into our packages, en masse\n@@ -72,6 +73,8 @@ BEGIN {\n \t\t\t*{\"${package}::$_\"} = \\&{\"Git::$_\"};\n \t\t}\n \t}\n+\tMemoize::memoize 'Git::config';\n+\tMemoize::memoize 'Git::config_bool';\n }\n \n my ($SVN);\n@@ -3199,6 +3202,8 @@ sub has_no_changes {\n \t\tMemoize::unmemoize 'check_cherry_pick';\n \t\tMemoize::unmemoize 'has_no_changes';\n \t}\n+\n+\tMemoize::memoize 'Git::SVN::repos_root';\n }\n \n END {\n-- \n1.7.4.2.1.gd6f1f\n"},{"id":"165138","messageId":"20110404215227.GA4224@dcvr.yhbt.net","threadId":"26989","inReplyTo":"1301944148-7950-2-git-send-email-asedeno@mit.edu","subject":"Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-04-04T21:52:27Z","receivedAt":"2011-04-04T21:52:27Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Alejandro R. Sedeño\" <asedeno@mit.edu> wrote:\n> From: James Y Knight <jknight@itasoftware.com>\n> \n> This is necessary if you want to be able to commit to multiple branches.\n\nI'm not sure I understand the need for this patch, see below.\n\n> @@ -523,12 +523,14 @@ sub cmd_dcommit {\n>  \t}\n>  \n>  \tif (defined $_commit_url) {\n> -\t\t$url = $_commit_url;\n> +\t\t$url = $_commit_url . (length $gs->{path} ? '/' . $gs->{path} : '');\n\n$_commit_url is a user-specified parameter from the --commit-url switch.\nIf they want to override it it's the user's perogative.  It's not the\ndefault and not commonly used.\n\n>  \t} else {\n>  \t\t$url = eval { command_oneline('config', '--get',\n>  \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n>  \t\tif (!$url) {\n>  \t\t\t$url = $gs->full_url\n\nIf unspecified, we always fall back to the gs->full_url case anyways\nwhich just duplicates the logic you've added.  Again, commitUrl usually\ndoes not need to be specified since it is autodetected.\n\n> +\t\t} else {\n> +\t\t\t$url = $url . (length $gs->{path} ? '/' . $gs->{path} : '');\n>  \t\t}\n>  \t}\n\n-- \nEric Wong\n"},{"id":"165139","messageId":"20110404215331.GB4224@dcvr.yhbt.net","threadId":"26989","inReplyTo":"1301944148-7950-3-git-send-email-asedeno@mit.edu","subject":"Re: [PATCH 2/2] git-svn: Cache results of running the executable \"git config\"","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-04-04T21:53:31Z","receivedAt":"2011-04-04T21:53:31Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Alejandro R. Sedeño\" <asedeno@mit.edu> wrote:\n> From: James Y Knight <jknight@itasoftware.com>\n> \n> Running programs is not cheap!\n> \n> Signed-off-by: James Y Knight <jknight@itasoftware.com>\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n\nThanks, acked and pushed out to git://bogomips.org/git-svn.git\n\n-- \nEric Wong\n"},{"id":"165142","messageId":"F8E6CFA4-79F6-41AC-8266-09B3B46C8520@itasoftware.com","threadId":"26989","inReplyTo":"20110404215227.GA4224@dcvr.yhbt.net","subject":"Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config","fromName":"James Y Knight","fromEmail":"jknight@itasoftware.com","sentAt":"2011-04-04T22:16:04Z","receivedAt":"2011-04-04T22:16:04Z","isPatch":true,"sender":{"key":"jknight@itasoftware.com","avatar":null},"body":"On Apr 4, 2011, at 5:52 PM, Eric Wong wrote:\n> $_commit_url is a user-specified parameter from the --commit-url switch.\n> If they want to override it it's the user's perogative.  It's not the\n> default and not commonly used.\n\nIn .git/config:\n\n[svn-remote \"svn\"]\n        url = http://hostname/svnrepo/\n        commiturl = svn+ssh://hostname/svnrepo\n        branches = branches/*:refs/remotes/origin/*\n        fetch = trunk:refs/remotes/origin/master\n\nThe commiturl configuration is necessary so that the canonical URL is the http:// url (which can be used for read-only access), but if you want to commit, you have to use svn+ssh. This is a fairly common way of setting up access to an svn repository, so I'm surprised to be the first one to hit this issue.\n\nWithout the patch, you need:\n        commiturl = svn+ssh://hostname/svnrepo/trunk\nwhich of course then doesn't allow you to commit to other branches.\n\nJames"},{"id":"165145","messageId":"20110404225442.GA9307@dcvr.yhbt.net","threadId":"26989","inReplyTo":"F8E6CFA4-79F6-41AC-8266-09B3B46C8520@itasoftware.com","subject":"Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-04-04T22:54:42Z","receivedAt":"2011-04-04T22:54:42Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"James Y Knight <jknight@itasoftware.com> wrote:\n> On Apr 4, 2011, at 5:52 PM, Eric Wong wrote:\n> > $_commit_url is a user-specified parameter from the --commit-url switch.\n> > If they want to override it it's the user's perogative.  It's not the\n> > default and not commonly used.\n> \n> In .git/config:\n> \n> [svn-remote \"svn\"]\n>         url = http://hostname/svnrepo/\n>         commiturl = svn+ssh://hostname/svnrepo\n>         branches = branches/*:refs/remotes/origin/*\n>         fetch = trunk:refs/remotes/origin/master\n> \n> The commiturl configuration is necessary so that the canonical URL is the http:// url (which can be used for read-only access), but if you want to commit, you have to use svn+ssh. This is a fairly common way of setting up access to an svn repository, so I'm surprised to be the first one to hit this issue.\n> \n> Without the patch, you need:\n>         commiturl = svn+ssh://hostname/svnrepo/trunk\n> which of course then doesn't allow you to commit to other branches.\n\nOriginally --commit-url was only intended to be a command-line option\nand for overriding specific cases and also for dealing with permission\nmismatches (limited commit access to a branch, unlimited read access\nto the repo).\n\nYour patch breaks existing use cases, I think.\n\nI think Junio's suggestion for a pushurl config which does what you\nthink commitUrl does would be what you're after...\n\nThanks\n\n\n-- \nEric Wong\n"},{"id":"165173","messageId":"7vd3l15d1i.fsf@alter.siamese.dyndns.org","threadId":"26989","inReplyTo":"7voc4l5hm5.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] git-svn: Cache results of running the executable \"git config\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-05T08:15:53Z","receivedAt":"2011-04-05T08:15:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> \"Alejandro R. Sedeño\" <asedeno@mit.edu> wrote:\n>> From: James Y Knight <jknight@itasoftware.com>\n>> \n>> Running programs is not cheap!\n>> \n>> Signed-off-by: James Y Knight <jknight@itasoftware.com>\n>> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n>\n> Thanks, acked and pushed out to git://bogomips.org/git-svn.git\n\nHmph, any comment on 1/2 of the series?\n"},{"id":"165179","messageId":"4D9B310A.9020203@mit.edu","threadId":"26989","inReplyTo":"20110404225442.GA9307@dcvr.yhbt.net","subject":"Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-05T15:11:06Z","receivedAt":"2011-04-05T15:11:06Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"On 04/04/2011 06:54 PM, Eric Wong wrote:\n> James Y Knight <jknight@itasoftware.com> wrote:\n>> > On Apr 4, 2011, at 5:52 PM, Eric Wong wrote:\n>>> > > $_commit_url is a user-specified parameter from the --commit-url switch.\n>>> > > If they want to override it it's the user's perogative.  It's not the\n>>> > > default and not commonly used.\n>> > \n>> > In .git/config:\n>> > \n>> > [svn-remote \"svn\"]\n>> >         url = http://hostname/svnrepo/\n>> >         commiturl = svn+ssh://hostname/svnrepo\n>> >         branches = branches/*:refs/remotes/origin/*\n>> >         fetch = trunk:refs/remotes/origin/master\n>> > \n>> > The commiturl configuration is necessary so that the canonical URL is the http:// url (which can be used for read-only access), but if you want to commit, you have to use svn+ssh. This is a fairly common way of setting up access to an svn repository, so I'm surprised to be the first one to hit this issue.\n>> > \n>> > Without the patch, you need:\n>> >         commiturl = svn+ssh://hostname/svnrepo/trunk\n>> > which of course then doesn't allow you to commit to other branches.\n> Originally --commit-url was only intended to be a command-line option\n> and for overriding specific cases and also for dealing with permission\n> mismatches (limited commit access to a branch, unlimited read access\n> to the repo).\n> \n> Your patch breaks existing use cases, I think.\n> \n> I think Junio's suggestion for a pushurl config which does what you\n> think commitUrl does would be what you're after...\n\nThat sounds good to me. I'll submit an updated patch later today.\n\n-Alejandro\n"},{"id":"165206","messageId":"1302034509-8842-1-git-send-email-asedeno@mit.edu","threadId":"26989","inReplyTo":"4D9B310A.9020203@mit.edu","subject":"[PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-05T20:15:09Z","receivedAt":"2011-04-05T20:15:09Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"Similar to the 'remote.<name>.pushurl' config key for git remotes, the\n'pushurl' key is treated the same as the 'url' key. This is distinct\nfrom the 'commiturl' key, which is defined to be a full svn path.\n\nThis is necessary if you want to be able to commit to multiple branches.\n\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\nReviewed-off-by: James Y Knight <jknight@itasoftware.com>\n---\n Documentation/git-svn.txt |    6 ++++++\n git-svn.perl              |   14 ++++++++++++--\n 2 files changed, 18 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex ea8fafd..94f7497 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -648,6 +648,12 @@ svn-remote.<name>.rewriteUUID::\n \twhere the original UUID is not available via either useSvmProps\n \tor useSvnsyncProps.\n \n+svn-remote.<name>.pushurl::\n+\tSimilar to git's remote.<name>.pushurl, this is useful in\n+\tcases where the SVN repository url is read-only. Unlike\n+\t'commiturl', 'pushurl' is a base path. This key is overridden\n+\tby the 'commiturl' config key.\n+\n svn.brokenSymlinkWorkaround::\n \tThis disables potentially expensive checks to workaround\n \tbroken symlinks checked into SVN by broken clients.  Set this\ndiff --git a/git-svn.perl b/git-svn.perl\nindex fa8cd07..8372606 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -531,7 +531,13 @@ sub cmd_dcommit {\n \t\t$url = eval { command_oneline('config', '--get',\n \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n \t\tif (!$url) {\n-\t\t\t$url = $gs->full_url\n+\t\t\t$url = eval { command_oneline('config', '--get',\n+\t\t\t\t      \"svn-remote.$gs->{repo_id}.pushurl\") };\n+\t\t\tif ($url) {\n+\t\t\t\t$url .= (length $gs->{path} ? '/' . $gs->{path} : '');\n+\t\t\t} else {\n+\t\t\t\t$url = $gs->full_url\n+\t\t\t}\n \t\t}\n \t}\n \n@@ -730,7 +736,11 @@ sub cmd_branch {\n \t\t$url = eval { command_oneline('config', '--get',\n \t\t\t\"svn-remote.$gs->{repo_id}.commiturl\") };\n \t\tif (!$url) {\n-\t\t\t$url = $remote->{url};\n+\t\t\t$url = eval { command_oneline('config', '--get',\n+\t\t\t\t      \"svn-remote.$gs->{repo_id}.pushurl\") };\n+\t\t\tif (!$url) {\n+\t\t\t\t$url = $remote->{url};\n+\t\t\t}\n \t\t}\n \t}\n \tmy $dst = join '/', $url, $lft, $branch_name, ($rgt || ());\n-- \n1.7.4.2.1.gd6f1f\n"},{"id":"165207","messageId":"4D9B7A9E.6040902@mit.edu","threadId":"26989","inReplyTo":"1302034509-8842-1-git-send-email-asedeno@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-05T20:25:02Z","receivedAt":"2011-04-05T20:25:02Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"On 04/05/2011 04:15 PM, Alejandro R. Sedeño wrote:\n> @@ -730,7 +736,11 @@ sub cmd_branch {\n>  \t\t$url = eval { command_oneline('config', '--get',\n>  \t\t\t\"svn-remote.$gs->{repo_id}.commiturl\") };\n>  \t\tif (!$url) {\n> -\t\t\t$url = $remote->{url};\n> +\t\t\t$url = eval { command_oneline('config', '--get',\n> +\t\t\t\t      \"svn-remote.$gs->{repo_id}.pushurl\") };\n> +\t\t\tif (!$url) {\n> +\t\t\t\t$url = $remote->{url};\n> +\t\t\t}\n>  \t\t}\n>  \t}\n>  \tmy $dst = join '/', $url, $lft, $branch_name, ($rgt || ());\n\nActually, I was just finishing running this through its paces with\ndifferent values for url and pushurl, and branching has issues:\n\nTrying to use an unsupported feature: Source and dest appear not to be in\nthe same repository (src: 'http://asedeno/svn/trunk'; dst:\n'file:///tmp/svn/repo/branches/nb1') at /tmp/git/libexec/git-core/git-svn\nline 770\n\nSo I'm continuing to look into that. Perhaps it makes sense to use pushurl\nfor both src and dst when branching?\n\n-Alejandro\n"},{"id":"165211","messageId":"20110405210940.GA19412@dcvr.yhbt.net","threadId":"26989","inReplyTo":"4D9B7A9E.6040902@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-04-05T21:09:40Z","receivedAt":"2011-04-05T21:09:40Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"\\\"Alejandro R. Sedeño\\\"\" <asedeno@mit.edu> wrote:\n> Trying to use an unsupported feature: Source and dest appear not to be in\n> the same repository (src: 'http://asedeno/svn/trunk'; dst:\n> 'file:///tmp/svn/repo/branches/nb1') at /tmp/git/libexec/git-core/git-svn\n> line 770\n\nThis may be a new warning/error in newer versions of Subversion itself.\nMaybe it's better to always use the same URL for all read/writes\n\n-- \nEric Wong\n"},{"id":"165265","messageId":"4D9C6023.6040305@drmicha.warpmail.net","threadId":"26989","inReplyTo":"1302034509-8842-1-git-send-email-asedeno@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-06T12:44:19Z","receivedAt":"2011-04-06T12:44:19Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Alejandro R. Sedeño venit, vidit, dixit 05.04.2011 22:15:\n> Similar to the 'remote.<name>.pushurl' config key for git remotes, the\n> 'pushurl' key is treated the same as the 'url' key. This is distinct\n> from the 'commiturl' key, which is defined to be a full svn path.\n> \n> This is necessary if you want to be able to commit to multiple branches.\n\nMaybe one can understand this remark after reading the whole thread, but\nreading it as a commit message I'm wondering: Huh? How can I have been\ndoing it then without pushurl?\n\nAlso, \"treated the same as the url\" makes a reader wonder why we have\ntwo names for the same.\n\nThe point of pushurl is that you can use a passwordless transport for\nfetches and another transport for pushes. The standing assumption is\nthat both urls point in fact at the same repo. Weird things can happen\nif not. Is that assumption the same for your svn pushurl?\n\n> \n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Reviewed-off-by: James Y Knight <jknight@itasoftware.com>\n> ---\n>  Documentation/git-svn.txt |    6 ++++++\n>  git-svn.perl              |   14 ++++++++++++--\n>  2 files changed, 18 insertions(+), 2 deletions(-)\n> \n> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\n> index ea8fafd..94f7497 100644\n> --- a/Documentation/git-svn.txt\n> +++ b/Documentation/git-svn.txt\n> @@ -648,6 +648,12 @@ svn-remote.<name>.rewriteUUID::\n>  \twhere the original UUID is not available via either useSvmProps\n>  \tor useSvnsyncProps.\n>  \n> +svn-remote.<name>.pushurl::\n> +\tSimilar to git's remote.<name>.pushurl, this is useful in\n> +\tcases where the SVN repository url is read-only. Unlike\n> +\t'commiturl', 'pushurl' is a base path. This key is overridden\n> +\tby the 'commiturl' config key.\n> +\n\nExactly :)\n\n>  svn.brokenSymlinkWorkaround::\n>  \tThis disables potentially expensive checks to workaround\n>  \tbroken symlinks checked into SVN by broken clients.  Set this\n> diff --git a/git-svn.perl b/git-svn.perl\n> index fa8cd07..8372606 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -531,7 +531,13 @@ sub cmd_dcommit {\n>  \t\t$url = eval { command_oneline('config', '--get',\n>  \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n>  \t\tif (!$url) {\n> -\t\t\t$url = $gs->full_url\n> +\t\t\t$url = eval { command_oneline('config', '--get',\n> +\t\t\t\t      \"svn-remote.$gs->{repo_id}.pushurl\") };\n> +\t\t\tif ($url) {\n> +\t\t\t\t$url .= (length $gs->{path} ? '/' . $gs->{path} : '');\n> +\t\t\t} else {\n> +\t\t\t\t$url = $gs->full_url\n> +\t\t\t}\n>  \t\t}\n>  \t}\n>  \n> @@ -730,7 +736,11 @@ sub cmd_branch {\n>  \t\t$url = eval { command_oneline('config', '--get',\n>  \t\t\t\"svn-remote.$gs->{repo_id}.commiturl\") };\n>  \t\tif (!$url) {\n> -\t\t\t$url = $remote->{url};\n> +\t\t\t$url = eval { command_oneline('config', '--get',\n> +\t\t\t\t      \"svn-remote.$gs->{repo_id}.pushurl\") };\n> +\t\t\tif (!$url) {\n> +\t\t\t\t$url = $remote->{url};\n> +\t\t\t}\n>  \t\t}\n>  \t}\n>  \tmy $dst = join '/', $url, $lft, $branch_name, ($rgt || ());\n"},{"id":"165269","messageId":"4D9C6262.2080408@drmicha.warpmail.net","threadId":"26989","inReplyTo":"4D9B7A9E.6040902@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-06T12:53:54Z","receivedAt":"2011-04-06T12:53:54Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"\"Alejandro R. Sedeño\" venit, vidit, dixit 05.04.2011 22:25:\n> On 04/05/2011 04:15 PM, Alejandro R. Sedeño wrote:\n>> @@ -730,7 +736,11 @@ sub cmd_branch {\n>>  \t\t$url = eval { command_oneline('config', '--get',\n>>  \t\t\t\"svn-remote.$gs->{repo_id}.commiturl\") };\n>>  \t\tif (!$url) {\n>> -\t\t\t$url = $remote->{url};\n>> +\t\t\t$url = eval { command_oneline('config', '--get',\n>> +\t\t\t\t      \"svn-remote.$gs->{repo_id}.pushurl\") };\n>> +\t\t\tif (!$url) {\n>> +\t\t\t\t$url = $remote->{url};\n>> +\t\t\t}\n>>  \t\t}\n>>  \t}\n>>  \tmy $dst = join '/', $url, $lft, $branch_name, ($rgt || ());\n> \n> Actually, I was just finishing running this through its paces with\n> different values for url and pushurl, and branching has issues:\n> \n> Trying to use an unsupported feature: Source and dest appear not to be in\n> the same repository (src: 'http://asedeno/svn/trunk'; dst:\n> 'file:///tmp/svn/repo/branches/nb1') at /tmp/git/libexec/git-core/git-svn\n> line 770\n> \n> So I'm continuing to look into that. Perhaps it makes sense to use pushurl\n> for both src and dst when branching?\n\nFor branching, yes. This is just the following in disguise:\n\nhttp://permalink.gmane.org/gmane.comp.version-control.git/135577\n\n\"svn cp\" between 2 URLs simply requires they're within the same repo.\n\nMichael\n"},{"id":"165268","messageId":"4D9C6309.8080809@mit.edu","threadId":"26989","inReplyTo":"4D9C6023.6040305@drmicha.warpmail.net","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-06T12:56:41Z","receivedAt":"2011-04-06T12:56:41Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"On 4/6/2011 8:44 AM, Michael J Gruber wrote:\n> Alejandro R. Sedeño venit, vidit, dixit 05.04.2011 22:15:\n>> > Similar to the 'remote.<name>.pushurl' config key for git remotes, the\n>> > 'pushurl' key is treated the same as the 'url' key. This is distinct\n>> > from the 'commiturl' key, which is defined to be a full svn path.\n>> > \n>> > This is necessary if you want to be able to commit to multiple branches.\n> Maybe one can understand this remark after reading the whole thread, but\n> reading it as a commit message I'm wondering: Huh? How can I have been\n> doing it then without pushurl?\n> \n> Also, \"treated the same as the url\" makes a reader wonder why we have\n> two names for the same.\n> \n> The point of pushurl is that you can use a passwordless transport for\n> fetches and another transport for pushes. The standing assumption is\n> that both urls point in fact at the same repo. Weird things can happen\n> if not. Is that assumption the same for your svn pushurl?\n\nYes, that is the idea. I will rephrase the commit message and\ndocumentation to be clearer when I send the next version of this patch.\n\nWhen I say, \"treated the same as the url,\" what I mean to say is that\nany manipulations that would be done to 'url' are also done to\n'pushurl', such as appending '/trunk' or '/branches/<branch-name>/' if\nnecessary, which does not happen with commiturl since it is a full snv path.\n\n-Alejandro\n"},{"id":"165270","messageId":"4D9C64ED.4030900@mit.edu","threadId":"26989","inReplyTo":"4D9C6262.2080408@drmicha.warpmail.net","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-06T13:04:45Z","receivedAt":"2011-04-06T13:04:45Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"On 4/6/2011 8:53 AM, Michael J Gruber wrote:\n>> > So I'm continuing to look into that. Perhaps it makes sense to use pushurl\n>> > for both src and dst when branching?\n> For branching, yes. This is just the following in disguise:\n> \n> http://permalink.gmane.org/gmane.comp.version-control.git/135577\n> \n> \"svn cp\" between 2 URLs simply requires they're within the same repo.\n\nYeah, I understand that. The purpose of that email was to make sure that\nthe patch was not committed as is, and it was hastily written because I\nwas practically out the door at the time.\n\nThanks for the pointer though.\n\nI'll be sending an updated patch in a few hours.\n\n-Alejandro\n"},{"id":"165272","messageId":"4D9C66D5.8070103@drmicha.warpmail.net","threadId":"26989","inReplyTo":"4D9C64ED.4030900@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-06T13:12:53Z","receivedAt":"2011-04-06T13:12:53Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"\"Alejandro R. Sedeño\" venit, vidit, dixit 06.04.2011 15:04:\n> On 4/6/2011 8:53 AM, Michael J Gruber wrote:\n>>>> So I'm continuing to look into that. Perhaps it makes sense to use pushurl\n>>>> for both src and dst when branching?\n>> For branching, yes. This is just the following in disguise:\n>>\n>> http://permalink.gmane.org/gmane.comp.version-control.git/135577\n>>\n>> \"svn cp\" between 2 URLs simply requires they're within the same repo.\n> \n> Yeah, I understand that. The purpose of that email was to make sure that\n> the patch was not committed as is, and it was hastily written because I\n> was practically out the door at the time.\n\nLong arms or small room? ;)\n\n> \n> Thanks for the pointer though.\n> \n> I'll be sending an updated patch in a few hours.\n\nThanks!\n\nMichael\n"},{"id":"165276","messageId":"1302102336-8800-1-git-send-email-asedeno@mit.edu","threadId":"26989","inReplyTo":"4D9B7A9E.6040902@mit.edu","subject":"[PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-06T15:05:36Z","receivedAt":"2011-04-06T15:05:36Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"Similar to the 'remote.<name>.pushurl' config key for git remotes,\n'pushurl' is designed to be used in cases where 'url' points to an SVN\nrepository via a read-only transport, to provide an alternate\nread/write transport. It is assumed that both keys point to the same\nrepository.\n\nThe 'pushurl' key is distinct from the 'commiturl' key in that\n'commiturl' is a full svn path while 'pushurl' (like 'url') is a base\npath. 'commiturl' takes precendece over 'pushurl' in cases where\neither might be used.\n\nThe 'pushurl' is used by git-svn's dcommit and branch commands.\n\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\nReviewed-off-by: James Y Knight <jknight@itasoftware.com>\n---\n Documentation/git-svn.txt |   10 ++++++++++\n git-svn.perl              |   18 +++++++++++++++---\n 2 files changed, 25 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex ea8fafd..4aa6404 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -648,6 +648,16 @@ svn-remote.<name>.rewriteUUID::\n \twhere the original UUID is not available via either useSvmProps\n \tor useSvnsyncProps.\n \n+svn-remote.<name>.pushurl::\n+\n+\tSimilar to git's 'remote.<name>.pushurl', this key is designed\n+\tto be used in cases where 'url' points to an SVN repository\n+\tvia a read-only transport, to provide an alternate read/write\n+\ttransport. It is assumed that both keys point to the same\n+\trepository. Unlike 'commiturl', 'pushurl' is a base path. If\n+\teither 'commiturl' or 'pushurl' could be used, 'commiturl'\n+\ttakes precedence.\n+\n svn.brokenSymlinkWorkaround::\n \tThis disables potentially expensive checks to workaround\n \tbroken symlinks checked into SVN by broken clients.  Set this\ndiff --git a/git-svn.perl b/git-svn.perl\nindex fa8cd07..184442a 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -531,7 +531,7 @@ sub cmd_dcommit {\n \t\t$url = eval { command_oneline('config', '--get',\n \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n \t\tif (!$url) {\n-\t\t\t$url = $gs->full_url\n+\t\t\t$url = $gs->full_pushurl\n \t\t}\n \t}\n \n@@ -679,7 +679,7 @@ sub cmd_branch {\n \t$head ||= 'HEAD';\n \n \tmy (undef, $rev, undef, $gs) = working_head_info($head);\n-\tmy $src = $gs->full_url;\n+\tmy $src = $gs->full_pushurl;\n \n \tmy $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};\n \tmy $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };\n@@ -730,7 +730,7 @@ sub cmd_branch {\n \t\t$url = eval { command_oneline('config', '--get',\n \t\t\t\"svn-remote.$gs->{repo_id}.commiturl\") };\n \t\tif (!$url) {\n-\t\t\t$url = $remote->{url};\n+\t\t\t$url = $remote->{pushurl} || $remote->{url};\n \t\t}\n \t}\n \tmy $dst = join '/', $url, $lft, $branch_name, ($rgt || ());\n@@ -1834,6 +1834,8 @@ sub read_all_remotes {\n \t\t\t$r->{$1}->{svm} = {};\n \t\t} elsif (m!^(.+)\\.url=\\s*(.*)\\s*$!) {\n \t\t\t$r->{$1}->{url} = $2;\n+\t\t} elsif (m!^(.+)\\.pushurl=\\s*(.*)\\s*$!) {\n+\t\t\t$r->{$1}->{pushurl} = $2;\n \t\t} elsif (m!^(.+)\\.(branches|tags)=$svn_refspec$!) {\n \t\t\tmy ($remote, $t, $local_ref, $remote_ref) =\n \t\t\t                                     ($1, $2, $3, $4);\n@@ -2071,6 +2073,8 @@ sub new {\n \t$self->{url} = command_oneline('config', '--get',\n \t                               \"svn-remote.$repo_id.url\") or\n                   die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n+\t$self->{pushurl} = eval { command_oneline('config', '--get',\n+\t                          \"svn-remote.$repo_id.pushurl\") };\n \t$self->rebuild;\n \t$self;\n }\n@@ -2548,6 +2552,14 @@ sub full_url {\n \t$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');\n }\n \n+sub full_pushurl {\n+\tmy ($self) = @_;\n+\tif ($self->{pushurl}) {\n+\t\treturn $self->{pushurl} . (length $self->{path} ? '/' . $self->{path} : '');\n+\t} else {\n+\t\treturn $self->full_url;\n+\t}\n+}\n \n sub set_commit_header_env {\n \tmy ($log_entry) = @_;\n-- \n1.7.4.2.1.gd6f1f\n"},{"id":"165277","messageId":"4D9C851A.7070801@drmicha.warpmail.net","threadId":"26989","inReplyTo":"1302102336-8800-1-git-send-email-asedeno@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-06T15:22:02Z","receivedAt":"2011-04-06T15:22:02Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Alejandro R. Sedeño venit, vidit, dixit 06.04.2011 17:05:\n> Similar to the 'remote.<name>.pushurl' config key for git remotes,\n> 'pushurl' is designed to be used in cases where 'url' points to an SVN\n> repository via a read-only transport, to provide an alternate\n> read/write transport. It is assumed that both keys point to the same\n> repository.\n> \n> The 'pushurl' key is distinct from the 'commiturl' key in that\n> 'commiturl' is a full svn path while 'pushurl' (like 'url') is a base\n> path. 'commiturl' takes precendece over 'pushurl' in cases where\n> either might be used.\n> \n> The 'pushurl' is used by git-svn's dcommit and branch commands.\n> \n\nThanks, very clear now.\n\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Reviewed-off-by: James Y Knight <jknight@itasoftware.com>\n\n:) So, if that review is off, that means...\n\n> ---\n>  Documentation/git-svn.txt |   10 ++++++++++\n>  git-svn.perl              |   18 +++++++++++++++---\n>  2 files changed, 25 insertions(+), 3 deletions(-)\n> \n> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\n> index ea8fafd..4aa6404 100644\n> --- a/Documentation/git-svn.txt\n> +++ b/Documentation/git-svn.txt\n> @@ -648,6 +648,16 @@ svn-remote.<name>.rewriteUUID::\n>  \twhere the original UUID is not available via either useSvmProps\n>  \tor useSvnsyncProps.\n>  \n> +svn-remote.<name>.pushurl::\n> +\n> +\tSimilar to git's 'remote.<name>.pushurl', this key is designed\n> +\tto be used in cases where 'url' points to an SVN repository\n> +\tvia a read-only transport, to provide an alternate read/write\n> +\ttransport. It is assumed that both keys point to the same\n> +\trepository. Unlike 'commiturl', 'pushurl' is a base path. If\n> +\teither 'commiturl' or 'pushurl' could be used, 'commiturl'\n> +\ttakes precedence.\n> +\n>  svn.brokenSymlinkWorkaround::\n>  \tThis disables potentially expensive checks to workaround\n>  \tbroken symlinks checked into SVN by broken clients.  Set this\n> diff --git a/git-svn.perl b/git-svn.perl\n> index fa8cd07..184442a 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -531,7 +531,7 @@ sub cmd_dcommit {\n>  \t\t$url = eval { command_oneline('config', '--get',\n>  \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n>  \t\tif (!$url) {\n> -\t\t\t$url = $gs->full_url\n> +\t\t\t$url = $gs->full_pushurl\n\nWouldn't we want to do the same $gs->full_pushurl || $gs->full_url fall\nback here as below, or is fullpush_url always set? OK, I see it always is.\n\n>  \t\t}\n>  \t}\n>  \n> @@ -679,7 +679,7 @@ sub cmd_branch {\n>  \t$head ||= 'HEAD';\n>  \n>  \tmy (undef, $rev, undef, $gs) = working_head_info($head);\n> -\tmy $src = $gs->full_url;\n> +\tmy $src = $gs->full_pushurl;\n\nSame here.\n\n>  \n>  \tmy $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};\n>  \tmy $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };\n> @@ -730,7 +730,7 @@ sub cmd_branch {\n>  \t\t$url = eval { command_oneline('config', '--get',\n>  \t\t\t\"svn-remote.$gs->{repo_id}.commiturl\") };\n>  \t\tif (!$url) {\n> -\t\t\t$url = $remote->{url};\n> +\t\t\t$url = $remote->{pushurl} || $remote->{url};\n>  \t\t}\n>  \t}\n>  \tmy $dst = join '/', $url, $lft, $branch_name, ($rgt || ());\n> @@ -1834,6 +1834,8 @@ sub read_all_remotes {\n>  \t\t\t$r->{$1}->{svm} = {};\n>  \t\t} elsif (m!^(.+)\\.url=\\s*(.*)\\s*$!) {\n>  \t\t\t$r->{$1}->{url} = $2;\n> +\t\t} elsif (m!^(.+)\\.pushurl=\\s*(.*)\\s*$!) {\n> +\t\t\t$r->{$1}->{pushurl} = $2;\n>  \t\t} elsif (m!^(.+)\\.(branches|tags)=$svn_refspec$!) {\n>  \t\t\tmy ($remote, $t, $local_ref, $remote_ref) =\n>  \t\t\t                                     ($1, $2, $3, $4);\n> @@ -2071,6 +2073,8 @@ sub new {\n>  \t$self->{url} = command_oneline('config', '--get',\n>  \t                               \"svn-remote.$repo_id.url\") or\n>                    die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n> +\t$self->{pushurl} = eval { command_oneline('config', '--get',\n> +\t                          \"svn-remote.$repo_id.pushurl\") };\n\nWhy eval? We don't do it for url either.\n\n>  \t$self->rebuild;\n>  \t$self;\n>  }\n> @@ -2548,6 +2552,14 @@ sub full_url {\n>  \t$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');\n>  }\n>  \n> +sub full_pushurl {\n> +\tmy ($self) = @_;\n\nIsn't that a noop?\n\n> +\tif ($self->{pushurl}) {\n> +\t\treturn $self->{pushurl} . (length $self->{path} ? '/' . $self->{path} : '');\n> +\t} else {\n> +\t\treturn $self->full_url;\n> +\t}\n> +}\n>  \n>  sub set_commit_header_env {\n>  \tmy ($log_entry) = @_;\n"},{"id":"165278","messageId":"4D9C8803.1000708@mit.edu","threadId":"26989","inReplyTo":"4D9C851A.7070801@drmicha.warpmail.net","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-06T15:34:27Z","receivedAt":"2011-04-06T15:34:27Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"On 04/06/2011 11:22 AM, Michael J Gruber wrote:\n> Alejandro R. Sedeño venit, vidit, dixit 06.04.2011 17:05:\n>> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n>> Reviewed-off-by: James Y Knight <jknight@itasoftware.com>\n> \n> :) So, if that review is off, that means...\n\nUm, s/-off//. Oops :)\n\nI can send a follow-up, or let Eric deal with that change, however he prefers.\n\n>> diff --git a/git-svn.perl b/git-svn.perl\n>> index fa8cd07..184442a 100755\n>> --- a/git-svn.perl\n>> +++ b/git-svn.perl\n>> @@ -531,7 +531,7 @@ sub cmd_dcommit {\n>>  \t\t$url = eval { command_oneline('config', '--get',\n>>  \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n>>  \t\tif (!$url) {\n>> -\t\t\t$url = $gs->full_url\n>> +\t\t\t$url = $gs->full_pushurl\n> \n> Wouldn't we want to do the same $gs->full_pushurl || $gs->full_url fall\n> back here as below, or is fullpush_url always set? OK, I see it always is.\n\nYeah, I just went with full_pushurl returning full_url in cases where\npushurl is not set.\n\n>> @@ -2071,6 +2073,8 @@ sub new {\n>>  \t$self->{url} = command_oneline('config', '--get',\n>>  \t                               \"svn-remote.$repo_id.url\") or\n>>                    die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n>> +\t$self->{pushurl} = eval { command_oneline('config', '--get',\n>> +\t                          \"svn-remote.$repo_id.pushurl\") };\n> \n> Why eval? We don't do it for url either.\n\nBecause otherwise it would die with:\n\n  $ git svn fetch\n  config --get svn-remote.svn.pushurl: command returned error: 1\n\nwhen pushurl wasn't defined. If that happens with 'url' too, well, that's\na mis-configured git-svn remote.\n\n>> +sub full_pushurl {\n>> +\tmy ($self) = @_;\n> \n> Isn't that a noop?\n\nI'm just copying the style of sub full_url here.\n\n-Alejandro\n"},{"id":"165282","messageId":"4D9C88FD.5080807@drmicha.warpmail.net","threadId":"26989","inReplyTo":"4D9C8803.1000708@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-06T15:38:37Z","receivedAt":"2011-04-06T15:38:37Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"\"Alejandro R. Sedeño\" venit, vidit, dixit 06.04.2011 17:34:\n> On 04/06/2011 11:22 AM, Michael J Gruber wrote:\n>> Alejandro R. Sedeño venit, vidit, dixit 06.04.2011 17:05:\n>>> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n>>> Reviewed-off-by: James Y Knight <jknight@itasoftware.com>\n>>\n>> :) So, if that review is off, that means...\n> \n> Um, s/-off//. Oops :)\n> \n> I can send a follow-up, or let Eric deal with that change, however he prefers.\n> \n>>> diff --git a/git-svn.perl b/git-svn.perl\n>>> index fa8cd07..184442a 100755\n>>> --- a/git-svn.perl\n>>> +++ b/git-svn.perl\n>>> @@ -531,7 +531,7 @@ sub cmd_dcommit {\n>>>  \t\t$url = eval { command_oneline('config', '--get',\n>>>  \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n>>>  \t\tif (!$url) {\n>>> -\t\t\t$url = $gs->full_url\n>>> +\t\t\t$url = $gs->full_pushurl\n>>\n>> Wouldn't we want to do the same $gs->full_pushurl || $gs->full_url fall\n>> back here as below, or is fullpush_url always set? OK, I see it always is.\n> \n> Yeah, I just went with full_pushurl returning full_url in cases where\n> pushurl is not set.\n> \n>>> @@ -2071,6 +2073,8 @@ sub new {\n>>>  \t$self->{url} = command_oneline('config', '--get',\n>>>  \t                               \"svn-remote.$repo_id.url\") or\n>>>                    die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n>>> +\t$self->{pushurl} = eval { command_oneline('config', '--get',\n>>> +\t                          \"svn-remote.$repo_id.pushurl\") };\n>>\n>> Why eval? We don't do it for url either.\n> \n> Because otherwise it would die with:\n> \n>   $ git svn fetch\n>   config --get svn-remote.svn.pushurl: command returned error: 1\n> \n> when pushurl wasn't defined. If that happens with 'url' too, well, that's\n> a mis-configured git-svn remote.\n> \n>>> +sub full_pushurl {\n>>> +\tmy ($self) = @_;\n>>\n>> Isn't that a noop?\n> \n> I'm just copying the style of sub full_url here.\n> \n\nOK, I finally understood the reason for \"eval\" and \"my ($self) = @_;\". I\nsimply shouldn't look at perl code ;)\n\nThanks!\n\nMichael\n"},{"id":"165422","messageId":"1302274674-4231-1-git-send-email-asedeno@mit.edu","threadId":"26989","inReplyTo":"1302102336-8800-1-git-send-email-asedeno@mit.edu","subject":"[PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-08T14:57:54Z","receivedAt":"2011-04-08T14:57:54Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"Similar to the 'remote.<name>.pushurl' config key for git remotes,\n'pushurl' is designed to be used in cases where 'url' points to an SVN\nrepository via a read-only transport, to provide an alternate\nread/write transport. It is assumed that both keys point to the same\nrepository.\n\nThe 'pushurl' key is distinct from the 'commiturl' key in that\n'commiturl' is a full svn path while 'pushurl' (like 'url') is a base\npath. 'commiturl' takes precendece over 'pushurl' in cases where\neither might be used.\n\nThe 'pushurl' is used by git-svn's dcommit and branch commands.\n\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\nReviewed-by: James Y Knight <jknight@itasoftware.com>\n---\n Documentation/git-svn.txt |   10 ++++++++++\n git-svn.perl              |   18 +++++++++++++++---\n 2 files changed, 25 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex ea8fafd..4aa6404 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -648,6 +648,16 @@ svn-remote.<name>.rewriteUUID::\n \twhere the original UUID is not available via either useSvmProps\n \tor useSvnsyncProps.\n \n+svn-remote.<name>.pushurl::\n+\n+\tSimilar to git's 'remote.<name>.pushurl', this key is designed\n+\tto be used in cases where 'url' points to an SVN repository\n+\tvia a read-only transport, to provide an alternate read/write\n+\ttransport. It is assumed that both keys point to the same\n+\trepository. Unlike 'commiturl', 'pushurl' is a base path. If\n+\teither 'commiturl' or 'pushurl' could be used, 'commiturl'\n+\ttakes precedence.\n+\n svn.brokenSymlinkWorkaround::\n \tThis disables potentially expensive checks to workaround\n \tbroken symlinks checked into SVN by broken clients.  Set this\ndiff --git a/git-svn.perl b/git-svn.perl\nindex fa8cd07..184442a 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -531,7 +531,7 @@ sub cmd_dcommit {\n \t\t$url = eval { command_oneline('config', '--get',\n \t\t\t      \"svn-remote.$gs->{repo_id}.commiturl\") };\n \t\tif (!$url) {\n-\t\t\t$url = $gs->full_url\n+\t\t\t$url = $gs->full_pushurl\n \t\t}\n \t}\n \n@@ -679,7 +679,7 @@ sub cmd_branch {\n \t$head ||= 'HEAD';\n \n \tmy (undef, $rev, undef, $gs) = working_head_info($head);\n-\tmy $src = $gs->full_url;\n+\tmy $src = $gs->full_pushurl;\n \n \tmy $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};\n \tmy $allglobs = $remote->{ $_tag ? 'tags' : 'branches' };\n@@ -730,7 +730,7 @@ sub cmd_branch {\n \t\t$url = eval { command_oneline('config', '--get',\n \t\t\t\"svn-remote.$gs->{repo_id}.commiturl\") };\n \t\tif (!$url) {\n-\t\t\t$url = $remote->{url};\n+\t\t\t$url = $remote->{pushurl} || $remote->{url};\n \t\t}\n \t}\n \tmy $dst = join '/', $url, $lft, $branch_name, ($rgt || ());\n@@ -1834,6 +1834,8 @@ sub read_all_remotes {\n \t\t\t$r->{$1}->{svm} = {};\n \t\t} elsif (m!^(.+)\\.url=\\s*(.*)\\s*$!) {\n \t\t\t$r->{$1}->{url} = $2;\n+\t\t} elsif (m!^(.+)\\.pushurl=\\s*(.*)\\s*$!) {\n+\t\t\t$r->{$1}->{pushurl} = $2;\n \t\t} elsif (m!^(.+)\\.(branches|tags)=$svn_refspec$!) {\n \t\t\tmy ($remote, $t, $local_ref, $remote_ref) =\n \t\t\t                                     ($1, $2, $3, $4);\n@@ -2071,6 +2073,8 @@ sub new {\n \t$self->{url} = command_oneline('config', '--get',\n \t                               \"svn-remote.$repo_id.url\") or\n                   die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n+\t$self->{pushurl} = eval { command_oneline('config', '--get',\n+\t                          \"svn-remote.$repo_id.pushurl\") };\n \t$self->rebuild;\n \t$self;\n }\n@@ -2548,6 +2552,14 @@ sub full_url {\n \t$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');\n }\n \n+sub full_pushurl {\n+\tmy ($self) = @_;\n+\tif ($self->{pushurl}) {\n+\t\treturn $self->{pushurl} . (length $self->{path} ? '/' . $self->{path} : '');\n+\t} else {\n+\t\treturn $self->full_url;\n+\t}\n+}\n \n sub set_commit_header_env {\n \tmy ($log_entry) = @_;\n-- \n1.7.4.2.1.gd6f1f\n"},{"id":"165450","messageId":"7vmxk033ic.fsf@alter.siamese.dyndns.org","threadId":"26989","inReplyTo":"1302274674-4231-1-git-send-email-asedeno@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-08T20:13:47Z","receivedAt":"2011-04-08T20:13:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"A Tangent.\n\n>> X-Mailer: git-send-email 1.7.4.2.1.gd6f1f\n>> In-Reply-To: <1302102336-8800-1-git-send-email-asedeno@mit.edu>\n\nThis is not about this particular patch, but the From: address\ngit-send-email generates for you does not seem to quote the human readable\npart, even though the name has a \".\" in it.\n\nYour mails seem to reach the recipients fine, but I saw my reply to you\nbounce, because \"To:\" or \"Cc:\" in my reply end up having the \"R.\" part not\nquoted, like this:\n\n  (wrong)  To: Alejandro R. Sedeño <asedeno@mit.edu>\n (correct) To: \"Alejandro R. Sedeño\" <asedeno@mit.edu>\n\nI wonder if we should do something about it in git-send-email.  Every time\nI grab Shawn's address using my \"git who\" alias, I manually quote his name\nto avoid my message thrown into dustbin by vger.\n\n    [alias]\n    who = \"!sh -c 'git log -1 --format=\\\"%an <%ae>\\\" --author=\\\"$1\\\"' -\"\n\nI suspect Michael is not \"Michael J. Gruber\" for the same reason...\n"},{"id":"165453","messageId":"4D9F6F31.5020908@drmicha.warpmail.net","threadId":"26989","inReplyTo":"7vmxk033ic.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-08T20:25:21Z","receivedAt":"2011-04-08T20:25:21Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 08.04.2011 22:13:\n> A Tangent.\n> \n>>> X-Mailer: git-send-email 1.7.4.2.1.gd6f1f\n>>> In-Reply-To: <1302102336-8800-1-git-send-email-asedeno@mit.edu>\n> \n> This is not about this particular patch, but the From: address\n> git-send-email generates for you does not seem to quote the human readable\n> part, even though the name has a \".\" in it.\n> \n> Your mails seem to reach the recipients fine, but I saw my reply to you\n> bounce, because \"To:\" or \"Cc:\" in my reply end up having the \"R.\" part not\n> quoted, like this:\n> \n>   (wrong)  To: Alejandro R. Sedeño <asedeno@mit.edu>\n>  (correct) To: \"Alejandro R. Sedeño\" <asedeno@mit.edu>\n> \n> I wonder if we should do something about it in git-send-email.  Every time\n> I grab Shawn's address using my \"git who\" alias, I manually quote his name\n> to avoid my message thrown into dustbin by vger.\n> \n>     [alias]\n>     who = \"!sh -c 'git log -1 --format=\\\"%an <%ae>\\\" --author=\\\"$1\\\"' -\"\n> \n> I suspect Michael is not \"Michael J. Gruber\" for the same reason...\n\nYep, saved a lot of trouble. OTOH, I didn't want to give up completely\non the chance to make my widespread name at least a little less\nambiguous by keeping the middle initial.\n\nMichael\n"},{"id":"165457","messageId":"20110408205437.GB16540@sigill.intra.peff.net","threadId":"26989","inReplyTo":"7vmxk033ic.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-08T20:54:37Z","receivedAt":"2011-04-08T20:54:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 08, 2011 at 01:13:47PM -0700, Junio C Hamano wrote:\n\n> A Tangent.\n> \n> >> X-Mailer: git-send-email 1.7.4.2.1.gd6f1f\n> >> In-Reply-To: <1302102336-8800-1-git-send-email-asedeno@mit.edu>\n> \n> This is not about this particular patch, but the From: address\n> git-send-email generates for you does not seem to quote the human readable\n> part, even though the name has a \".\" in it.\n> \n> Your mails seem to reach the recipients fine, but I saw my reply to you\n> bounce, because \"To:\" or \"Cc:\" in my reply end up having the \"R.\" part not\n> quoted, like this:\n> \n>   (wrong)  To: Alejandro R. Sedeño <asedeno@mit.edu>\n>  (correct) To: \"Alejandro R. Sedeño\" <asedeno@mit.edu>\n\nHmm. His case has an extra level of confusion, though, because the\nnon-ascii characters all need rfc2047 encoding. So two emails I've seen\nfrom him have:\n\n  From: =?UTF-8?B?IkFsZWphbmRybyBSLiBTZWRlw7FvIg==?= <asedeno@MIT.EDU>\n  From: =?UTF-8?q?Alejandro=20R=2E=20Sede=C3=B1o?= <asedeno@mit.edu>\n\nwhere the first is from Icedove (i.e., Thunderbird) and the second is\nfrom git-send-email.\n\nThe first one contains double-quotes embedded in the encoded portion.\nThe second one (send-email) does not.\n\nBut I'm not clear on if that is necessary. I thought that rfc2047 could\nonly encode a \"word\" in the \"phrase\" portion in an address header,\nmeaning the parsing should be unambiguous.\n\nThat being said, I think we are not quoting in the non-rfc2047 case,\nanyway, and that is a bug. rfc5322 says this (section 4.1, Miscellaneous\nobsolete tokens):\n\n  Note: The \"period\" (or \"full stop\") character (\".\") in obs-phrase is\n  not a form that was allowed in earlier versions of this or any other\n  specification.  Period (nor any other character from specials) was not\n  allowed in phrase because it introduced a parsing difficulty\n  distinguishing between phrases and portions of an addr-spec (see\n  section 4.4).  It appears here because the period character is\n  currently used in many messages in the display-name portion of\n  addresses, especially for initials in names, and therefore must be\n  interpreted properly.\n\nwhich recognizes this situation. But being in the obsolete section, I\nthink it is saying \"you still need to interpret these, but don't\ngenerate them\". IOW, we should still be generating quotes now.\n\nI think format-patch is totally lacking in this type of quoting. If I\ndo:\n\n  $ git init\n  $ git config user.name '<bogus> with \"quotes\"'\n  $ echo contents >foo && git add . && git commit -m foo\n  $ git format-patch --stdout --root\n  ...\n  From: bogus with \"quotes <peff@peff.net>\n\nSo some of my magic characters are just stripped, and some of them get\nincluded, making the output bogus (the stripping of <> actually happens\nwithin git, so the commit itself is missing them).\n\nNot that I think a name like that is sane, but probably we should be\ndouble-quoting properly anyway, and then the \".\" case would just fall\nout.\n\n-Peff\n"},{"id":"165459","messageId":"20110408213201.GA20348@sigill.intra.peff.net","threadId":"26989","inReplyTo":"7v4o6830cc.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-08T21:32:01Z","receivedAt":"2011-04-08T21:32:01Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 08, 2011 at 02:22:11PM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > I think format-patch is totally lacking in this type of quoting. If I\n> > do:\n> >\n> >   $ git init\n> >   $ git config user.name '<bogus> with \"quotes\"'\n> >   $ echo contents >foo && git add . && git commit -m foo\n> >   $ git format-patch --stdout --root\n> >   ...\n> >   From: bogus with \"quotes <peff@peff.net>\n> >\n> > So some of my magic characters are just stripped, and some of them get\n> > included, making the output bogus (the stripping of <> actually happens\n> > within git, so the commit itself is missing them).\n> \n> The output from format-patch is meant to be slurped into MUA, so I would\n> say that they should show what a human user would type the name to\n> Thunderbird or message.el or whatever, and it is MUA's respoinsibility to\n> make it RFC comformant.  And that is why I mentioned that send-email\n> may want to learn a new trick or two.\n\nI disagree. Format-patch claims to make an mbox, so it should make one\nthat is valid (actually, the documentation is very wishy-washy about\nwhether it is an mbox; we say \"formatted to resemble UNIX mailbox\nformat\" at one point, and \"print all commits...in mbox format\" later).\n\nBut that is a philosophical distinction. What matters in practice is\nwhat MUAs expect to get, and how they deal with it. I expect most MUAs\nhandle bare \".\" just fine, because it's fairly unambiguous. But try:\n\n  git init repo && cd repo\n  git config user.name 'Jeff \"Peff\" King' &&\n  echo content >>file &&\n  git add file &&\n  git commit -m one\n\n  git format-patch -1 --stdout >mbox\n\nnow open the result in your MUA. Mutt strips the quotes and I become\n\"Jeff Peff King\".\n\n-Peff\n"},{"id":"165461","messageId":"7vipuo1iuy.fsf@alter.siamese.dyndns.org","threadId":"26989","inReplyTo":"20110408213201.GA20348@sigill.intra.peff.net","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-08T22:25:09Z","receivedAt":"2011-04-08T22:25:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I disagree. Format-patch claims to make an mbox, so it should make one\n> that is valid.\n\nOK.  That makes sense (even though I think it would make cutting and\npasting somewhat awkward).\n"},{"id":"165465","messageId":"20110408224035.GB7343@sigill.intra.peff.net","threadId":"26989","inReplyTo":"7vipuo1iuy.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-08T22:40:36Z","receivedAt":"2011-04-08T22:40:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 08, 2011 at 03:25:09PM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > I disagree. Format-patch claims to make an mbox, so it should make one\n> > that is valid.\n> \n> OK.  That makes sense (even though I think it would make cutting and\n> pasting somewhat awkward).\n\nCutting and pasting is already potentially awkward, because we\nrfc2047-quote in format-patch, too. But we can still get away without\nquoting at all in regular \"git log\". The \"Author:\" lines, while\nrfc822-looking do not have to be real header lines, and we know that\neverything before the <> must be the name.\n\nSo I think this is the patch we want:\n\n-- >8 --\nSubject: [PATCH] pretty: quote rfc822 specials in email addresses\n\nIf somebody has a name that includes an rfc822 special, we\nwill output it literally in the \"From:\" header. This is\nusually OK, but certain characters (like \".\") are supposed\nto be enclosed in double-quotes in a mail header.\n\nIn practice, whether this matters may depend on your MUA.\nSome MUAs will happily take in:\n\n   From: Foo B. Bar <author@example.com>\n\nwithout quotes, and properly quote the \".\" when they send\nthe actual mail.  Others may not, or may screw up harder\nthings like:\n\n  From: Foo \"The Baz\" Bar <author@example.com>\n\nFor example, mutt will strip the quotes, thinking they are\nactual syntactic rfc822 quotes.\n\nSo let's quote properly, and then (if necessary) we still\napply rfc2047 encoding on top of that, which should make all\nMUAs happy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n pretty.c                |   61 ++++++++++++++++++++++++++++++++++++++++++++++-\n t/t4014-format-patch.sh |   42 ++++++++++++++++++++++++++++++++\n 2 files changed, 102 insertions(+), 1 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex e1d8a8f..8345485 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -208,6 +208,58 @@ int has_non_ascii(const char *s)\n \treturn 0;\n }\n \n+static int is_rfc822_special(char ch)\n+{\n+\tswitch (ch) {\n+\tcase '(':\n+\tcase ')':\n+\tcase '<':\n+\tcase '>':\n+\tcase '[':\n+\tcase ']':\n+\tcase ':':\n+\tcase ';':\n+\tcase '@':\n+\tcase ',':\n+\tcase '.':\n+\tcase '\"':\n+\tcase '\\\\':\n+\t\treturn 1;\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+}\n+\n+static int has_rfc822_specials(const char *s, int len)\n+{\n+\tint i;\n+\tfor (i = 0; i < len; i++)\n+\t\tif (is_rfc822_special(s[i]))\n+\t\t\treturn 1;\n+\treturn 0;\n+}\n+\n+static void add_rfc822_quoted(struct strbuf *out, const char *s, int len)\n+{\n+\tint i;\n+\n+\t/* just a guess, we may have to also backslash-quote */\n+\tstrbuf_grow(out, len + 2);\n+\n+\tstrbuf_addch(out, '\"');\n+\tfor (i = 0; i < len; i++) {\n+\t\tswitch (s[i]) {\n+\t\tcase '\"':\n+\t\tcase '\\\\':\n+\t\t\tstrbuf_addch(out, '\\\\');\n+\t\t\t/* fall through */\n+\t\tdefault:\n+\t\t\tstrbuf_addch(out, s[i]);\n+\t\t}\n+\t}\n+\tstrbuf_addch(out, '\"');\n+}\n+\n static int is_rfc2047_special(char ch)\n {\n \treturn (non_ascii(ch) || (ch == '=') || (ch == '?') || (ch == '_'));\n@@ -293,7 +345,14 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,\n \t\t\tname_tail--;\n \t\tdisplay_name_length = name_tail - line;\n \t\tstrbuf_addstr(sb, \"From: \");\n-\t\tadd_rfc2047(sb, line, display_name_length, encoding);\n+\t\tif (has_rfc822_specials(line, display_name_length)) {\n+\t\t\tstruct strbuf quoted = STRBUF_INIT;\n+\t\t\tadd_rfc822_quoted(&quoted, line, display_name_length);\n+\t\t\tadd_rfc2047(sb, quoted.buf, quoted.len, encoding);\n+\t\t\tstrbuf_release(&quoted);\n+\t\t}\n+\t\telse\n+\t\t\tadd_rfc2047(sb, line, display_name_length, encoding);\n \t\tstrbuf_add(sb, name_tail, namelen - display_name_length);\n \t\tstrbuf_addch(sb, '\\n');\n \t} else {\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex c3cdb52..dd406c4 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -793,4 +793,46 @@ test_expect_success 'format-patch wraps extremely long headers (rfc2047)' '\n \ttest_cmp expect subject\n '\n \n+check_author() {\n+\techo content >>file &&\n+\tgit add file &&\n+\tGIT_AUTHOR_NAME=$1 git commit -m author-check &&\n+\tgit format-patch --stdout -1 >patch &&\n+\tgrep ^From: patch >actual &&\n+\ttest_cmp expect actual\n+}\n+\n+cat >expect <<'EOF'\n+From: \"Foo B. Bar\" <author@example.com>\n+EOF\n+test_expect_success 'format-patch quotes dot in headers' '\n+\tcheck_author \"Foo B. Bar\"\n+'\n+\n+cat >expect <<'EOF'\n+From: \"Foo \\\"The Baz\\\" Bar\" <author@example.com>\n+EOF\n+test_expect_success 'format-patch quotes double-quote in headers' '\n+\tcheck_author \"Foo \\\"The Baz\\\" Bar\"\n+'\n+\n+cat >expect <<'EOF'\n+From: =?UTF-8?q?\"F=C3=B6o=20B.=20Bar\"?= <author@example.com>\n+EOF\n+test_expect_success 'rfc2047-encoded headers also double-quote 822 specials' '\n+\tcheck_author \"Föo B. Bar\"\n+'\n+\n+cat >expect <<'EOF'\n+Subject: header with . in it\n+EOF\n+test_expect_success 'subject lines do not have 822 atom-quoting' '\n+\techo content >>file &&\n+\tgit add file &&\n+\tgit commit -m \"header with . in it\" &&\n+\tgit format-patch -k -1 --stdout >patch &&\n+\tgrep ^Subject: patch >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \n1.7.5.rc1.24.gcff72\n"},{"id":"165466","messageId":"20110408224335.GC7343@sigill.intra.peff.net","threadId":"26989","inReplyTo":"20110408224035.GB7343@sigill.intra.peff.net","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-08T22:43:35Z","receivedAt":"2011-04-08T22:43:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 08, 2011 at 06:40:36PM -0400, Jeff King wrote:\n\n> +cat >expect <<'EOF'\n> +From: =?UTF-8?q?\"F=C3=B6o=20B.=20Bar\"?= <author@example.com>\n> +EOF\n> +test_expect_success 'rfc2047-encoded headers also double-quote 822 specials' '\n> +\tcheck_author \"Föo B. Bar\"\n\nI'm slightly unsure of this one. Notice that we keep the literal\ndouble-quotes inside the rfc2047 encoded-word. Whereas in Alejandro's\nmail sent by Thunderbird, they ended up encoded.\n\nMy reading of rfc2047 is that it's OK either way, but I'm not 100% sure.\n\n-Peff\n"},{"id":"165505","messageId":"20110409224729.GA11062@dcvr.yhbt.net","threadId":"26989","inReplyTo":"1302274674-4231-1-git-send-email-asedeno@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-04-09T22:47:29Z","receivedAt":"2011-04-09T22:47:29Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Alejandro R. Sedeño\" <asedeno@mit.edu> wrote:\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Reviewed-by: James Y Knight <jknight@itasoftware.com>\n\nThanks all, I've acked and pushed out to git://bogomips.org/git-svn.git\n\nIf it's not too much trouble, I'd strongly prefer to have a test case\nfor this so future work doesn't break it.  Thanks.\n\n-- \nEric Wong\n"},{"id":"166227","messageId":"4DB1D2F2.6040000@mit.edu","threadId":"26989","inReplyTo":"20110408224035.GB7343@sigill.intra.peff.net","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-22T19:11:46Z","receivedAt":"2011-04-22T19:11:46Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"(Sorry I didn't chime in on this tangent. My life has been very busy since\nGoogle finished acquiring ITA Software. At least it's a good kind of busy.\n:) )\n\nI'd be happy to see something like this get in. I've often noticed\ngit-send-email telling me that it couldn't parse an address out of my\nsigned-of-by lines, but I never stopped and took the time to look into it.\n\n-Alejandro\n\nOn 04/08/2011 06:40 PM, Jeff King wrote:\n> On Fri, Apr 08, 2011 at 03:25:09PM -0700, Junio C Hamano wrote:\n> \n>> Jeff King <peff@peff.net> writes:\n>>\n>>> I disagree. Format-patch claims to make an mbox, so it should make one\n>>> that is valid.\n>>\n>> OK.  That makes sense (even though I think it would make cutting and\n>> pasting somewhat awkward).\n> \n> Cutting and pasting is already potentially awkward, because we\n> rfc2047-quote in format-patch, too. But we can still get away without\n> quoting at all in regular \"git log\". The \"Author:\" lines, while\n> rfc822-looking do not have to be real header lines, and we know that\n> everything before the <> must be the name.\n> \n> So I think this is the patch we want:\n> \n> -- >8 --\n> Subject: [PATCH] pretty: quote rfc822 specials in email addresses\n> \n> If somebody has a name that includes an rfc822 special, we\n> will output it literally in the \"From:\" header. This is\n> usually OK, but certain characters (like \".\") are supposed\n> to be enclosed in double-quotes in a mail header.\n> \n> In practice, whether this matters may depend on your MUA.\n> Some MUAs will happily take in:\n> \n>    From: Foo B. Bar <author@example.com>\n> \n> without quotes, and properly quote the \".\" when they send\n> the actual mail.  Others may not, or may screw up harder\n> things like:\n> \n>   From: Foo \"The Baz\" Bar <author@example.com>\n> \n> For example, mutt will strip the quotes, thinking they are\n> actual syntactic rfc822 quotes.\n> \n> So let's quote properly, and then (if necessary) we still\n> apply rfc2047 encoding on top of that, which should make all\n> MUAs happy.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  pretty.c                |   61 ++++++++++++++++++++++++++++++++++++++++++++++-\n>  t/t4014-format-patch.sh |   42 ++++++++++++++++++++++++++++++++\n>  2 files changed, 102 insertions(+), 1 deletions(-)\n> \n> diff --git a/pretty.c b/pretty.c\n> index e1d8a8f..8345485 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -208,6 +208,58 @@ int has_non_ascii(const char *s)\n>  \treturn 0;\n>  }\n>  \n> +static int is_rfc822_special(char ch)\n> +{\n> +\tswitch (ch) {\n> +\tcase '(':\n> +\tcase ')':\n> +\tcase '<':\n> +\tcase '>':\n> +\tcase '[':\n> +\tcase ']':\n> +\tcase ':':\n> +\tcase ';':\n> +\tcase '@':\n> +\tcase ',':\n> +\tcase '.':\n> +\tcase '\"':\n> +\tcase '\\\\':\n> +\t\treturn 1;\n> +\tdefault:\n> +\t\treturn 0;\n> +\t}\n> +}\n> +\n> +static int has_rfc822_specials(const char *s, int len)\n> +{\n> +\tint i;\n> +\tfor (i = 0; i < len; i++)\n> +\t\tif (is_rfc822_special(s[i]))\n> +\t\t\treturn 1;\n> +\treturn 0;\n> +}\n> +\n> +static void add_rfc822_quoted(struct strbuf *out, const char *s, int len)\n> +{\n> +\tint i;\n> +\n> +\t/* just a guess, we may have to also backslash-quote */\n> +\tstrbuf_grow(out, len + 2);\n> +\n> +\tstrbuf_addch(out, '\"');\n> +\tfor (i = 0; i < len; i++) {\n> +\t\tswitch (s[i]) {\n> +\t\tcase '\"':\n> +\t\tcase '\\\\':\n> +\t\t\tstrbuf_addch(out, '\\\\');\n> +\t\t\t/* fall through */\n> +\t\tdefault:\n> +\t\t\tstrbuf_addch(out, s[i]);\n> +\t\t}\n> +\t}\n> +\tstrbuf_addch(out, '\"');\n> +}\n> +\n>  static int is_rfc2047_special(char ch)\n>  {\n>  \treturn (non_ascii(ch) || (ch == '=') || (ch == '?') || (ch == '_'));\n> @@ -293,7 +345,14 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,\n>  \t\t\tname_tail--;\n>  \t\tdisplay_name_length = name_tail - line;\n>  \t\tstrbuf_addstr(sb, \"From: \");\n> -\t\tadd_rfc2047(sb, line, display_name_length, encoding);\n> +\t\tif (has_rfc822_specials(line, display_name_length)) {\n> +\t\t\tstruct strbuf quoted = STRBUF_INIT;\n> +\t\t\tadd_rfc822_quoted(&quoted, line, display_name_length);\n> +\t\t\tadd_rfc2047(sb, quoted.buf, quoted.len, encoding);\n> +\t\t\tstrbuf_release(&quoted);\n> +\t\t}\n> +\t\telse\n> +\t\t\tadd_rfc2047(sb, line, display_name_length, encoding);\n>  \t\tstrbuf_add(sb, name_tail, namelen - display_name_length);\n>  \t\tstrbuf_addch(sb, '\\n');\n>  \t} else {\n> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\n> index c3cdb52..dd406c4 100755\n> --- a/t/t4014-format-patch.sh\n> +++ b/t/t4014-format-patch.sh\n> @@ -793,4 +793,46 @@ test_expect_success 'format-patch wraps extremely long headers (rfc2047)' '\n>  \ttest_cmp expect subject\n>  '\n>  \n> +check_author() {\n> +\techo content >>file &&\n> +\tgit add file &&\n> +\tGIT_AUTHOR_NAME=$1 git commit -m author-check &&\n> +\tgit format-patch --stdout -1 >patch &&\n> +\tgrep ^From: patch >actual &&\n> +\ttest_cmp expect actual\n> +}\n> +\n> +cat >expect <<'EOF'\n> +From: \"Foo B. Bar\" <author@example.com>\n> +EOF\n> +test_expect_success 'format-patch quotes dot in headers' '\n> +\tcheck_author \"Foo B. Bar\"\n> +'\n> +\n> +cat >expect <<'EOF'\n> +From: \"Foo \\\"The Baz\\\" Bar\" <author@example.com>\n> +EOF\n> +test_expect_success 'format-patch quotes double-quote in headers' '\n> +\tcheck_author \"Foo \\\"The Baz\\\" Bar\"\n> +'\n> +\n> +cat >expect <<'EOF'\n> +From: =?UTF-8?q?\"F=C3=B6o=20B.=20Bar\"?= <author@example.com>\n> +EOF\n> +test_expect_success 'rfc2047-encoded headers also double-quote 822 specials' '\n> +\tcheck_author \"Föo B. Bar\"\n> +'\n> +\n> +cat >expect <<'EOF'\n> +Subject: header with . in it\n> +EOF\n> +test_expect_success 'subject lines do not have 822 atom-quoting' '\n> +\techo content >>file &&\n> +\tgit add file &&\n> +\tgit commit -m \"header with . in it\" &&\n> +\tgit format-patch -k -1 --stdout >patch &&\n> +\tgrep ^Subject: patch >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n>  test_done\n"},{"id":"166229","messageId":"20110422193621.GB3323@sigill.intra.peff.net","threadId":"26989","inReplyTo":"4DB1D2F2.6040000@mit.edu","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-22T19:36:22Z","receivedAt":"2011-04-22T19:36:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Apr 22, 2011 at 03:11:46PM -0400, \"Alejandro R. Sedeño\" wrote:\n\n> I'd be happy to see something like this get in. I've often noticed\n> git-send-email telling me that it couldn't parse an address out of my\n> signed-of-by lines, but I never stopped and took the time to look into it.\n\nThat is a separate issue. The patch I posted will make format-patch\nproperly quote rfc822 specials in actual email header lines. But\nSigned-off-by lines will remain as they are, being part of the message\nbody. And I think that's what we want. You certainly wouldn't want to\nrfc2047-encode them (they are already covered by the body's content-type\nencoding).\n\nAnd while you could quote rfc822 specials, people don't tend to do that.\nThere's no formal syntax defined, but people tend to treat them as:\n\n  Signed-off-by: (.*) <(.*)>\n\ni.e., everything inside <> is an address, and everything before that is\nthe name.\n\nIf there is an issue with send-email parsing signed-off-by lines or\nformatting the addresses it pulls from them, that's a separate problem\nthat will need to be dealt with in send-email.\n\n-Peff\n"},{"id":"166230","messageId":"4DB1D99D.4020104@mit.edu","threadId":"26989","inReplyTo":"20110422193621.GB3323@sigill.intra.peff.net","subject":"Re: [PATCH] git-svn: Add a svn-remote.<name>.pushurl config key","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2011-04-22T19:40:13Z","receivedAt":"2011-04-22T19:40:13Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"On 04/22/2011 03:36 PM, Jeff King wrote:\n> On Fri, Apr 22, 2011 at 03:11:46PM -0400, \"Alejandro R. Sedeño\" wrote:\n>> I'd be happy to see something like this get in. I've often noticed\n>> git-send-email telling me that it couldn't parse an address out of my\n>> signed-of-by lines, but I never stopped and took the time to look into it.\n> \n> That is a separate issue. The patch I posted will make format-patch\n> properly quote rfc822 specials in actual email header lines. But\n> Signed-off-by lines will remain as they are, being part of the message\n> body. And I think that's what we want. You certainly wouldn't want to\n> rfc2047-encode them (they are already covered by the body's content-type\n> encoding).\n> \n> And while you could quote rfc822 specials, people don't tend to do that.\n> There's no formal syntax defined, but people tend to treat them as:\n> \n>   Signed-off-by: (.*) <(.*)>\n> \n> i.e., everything inside <> is an address, and everything before that is\n> the name.\n> \n> If there is an issue with send-email parsing signed-off-by lines or\n> formatting the addresses it pulls from them, that's a separate problem\n> that will need to be dealt with in send-email.\n\nOkay, then I'll try look into that when things settle down here, if no one\nelse has by then.\n\n-Alejandro\n"}]}