{"thread":{"id":"10830","subject":"BUG: git-svn does not escape literal backslashes in author names.","startedAt":"2007-11-12T14:28:24Z","lastAt":"2007-11-17T23:17:13Z","messageCount":4,"participants":["Adrian Wilkins","Benoit Sigoure","Eric Wong","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"59492","messageId":"1213a9470711120628l4ccab632n17635295ec897a2@mail.gmail.com","threadId":"10830","inReplyTo":null,"subject":"BUG: git-svn does not escape literal backslashes in author names.","fromName":"Adrian Wilkins","fromEmail":"adrian.wilkins@gmail.com","sentAt":"2007-11-12T14:28:24Z","receivedAt":"2007-11-12T14:28:24Z","isPatch":false,"sender":{"key":"adrian.wilkins@gmail.com","avatar":null},"body":"Recently converted a large (11,000+ revisions) repository.\n\nWe authenticate against the NT domain controller, so all our revision\nauthors are of the form \"domain\\user\". (You can switch off mod_sspi\nreporting the domain part, but I didn't know about this at the time,\nso it continues for historical reasons.)\n\ngit-svn treats the literal backslashes in the author names as escapes.\nThis leads to authors like\n\ndomainkevin\ndomain\\\nichard\n\nI know, I should have read the manual and used my \"authors\" file. Bah.\n\nI'm sure that part of the revision hash in git includes the author\nname... so I guess I'm looking at another multi-day conversion. :-(\n\nCan I suggest that you make the authors file compulsory by default as well?\n"},{"id":"60165","messageId":"37A0587D-2C1A-4180-A724-2E7B338465D9@lrde.epita.fr","threadId":"10830","inReplyTo":"1213a9470711120628l4ccab632n17635295ec897a2@mail.gmail.com","subject":"BUG in gitk (was: Re: BUG: git-svn does not escape literal backslashes in author names.)","fromName":"Benoit Sigoure","fromEmail":"tsuna@lrde.epita.fr","sentAt":"2007-11-17T20:18:39Z","receivedAt":"2007-11-17T20:18:39Z","isPatch":false,"sender":{"key":"tsunanet@gmail.com","avatar":"https://avatars.githubusercontent.com/u/128281?v=4"},"body":"On Nov 12, 2007, at 3:28 PM, Adrian Wilkins wrote:\n\n> Recently converted a large (11,000+ revisions) repository.\n>\n> We authenticate against the NT domain controller, so all our revision\n> authors are of the form \"domain\\user\". (You can switch off mod_sspi\n> reporting the domain part, but I didn't know about this at the time,\n> so it continues for historical reasons.)\n>\n> git-svn treats the literal backslashes in the author names as escapes.\n> This leads to authors like\n>\n> domainkevin\n> domain\\\n> ichard\n\nHi Adrian,\nI tried to reproduce the error but didn't succeed (see below).  Which  \nversion of Git did you use?\n\nHowever, gitk fails to properly render the various properties when  \nthey contain backslash sequences.  If a gitk expert could have a  \nlook, I tried but didn't find a standard Tcl procedure to escape  \neverything properly and I didn't feel like recoding my own procedure  \nbecause I guess this already exists...\n\nCheers,\n\n\n$ svnadmin create repo\n$ svn co file://`pwd`/repo wc\nChecked out revision 0.\n$ cd wc\n$ svn mkdir trunk tags branches\nA         trunk\nA         tags\nA         branches\n$ svn ci -m stdlayout\nAdding         branches\nAdding         tags\nAdding         trunk\n\nCommitted revision 1.\n$ cd trunk\n$ touch plop && svn add plop\nA         plop\n$ svn ci -m test --username 'domain\\name\\richard\\test\\\\ok'\nAdding         trunk/plop\nTransmitting file data .\nCommitted revision 2.\n$ cd ../..\n$ git svn clone --stdlayout file://`pwd`/repo git\nInitialized empty Git repository in .git/\nr1 = dc86087745d9b6378114f49c1e480d178cf328f9 (trunk)\n         A       plop\nr2 = de5affcfdc897bfa77a2402a447771f0a88b04bf (trunk)\nChecked out HEAD:\n   file:///tmp/repo/trunk r2\n$ cd git\n$ git log\ncommit de5affcfdc897bfa77a2402a447771f0a88b04bf\nAuthor: domain\\name\\richard\\test\\\\ok <domain\\name\\richard\\test\\ \n\\ok@e88f2f36-2641-46fb-97e4-5fd9951470b2\nDate:   Sat Nov 17 12:17:29 2007 +0000\n\n     test\n\n     git-svn-id: file:///tmp/repo/trunk@2  \ne88f2f36-2641-46fb-97e4-5fd9951470b2\n\ncommit dc86087745d9b6378114f49c1e480d178cf328f9\nAuthor: tsuna <tsuna@e88f2f36-2641-46fb-97e4-5fd9951470b2>\nDate:   Sat Nov 17 12:16:29 2007 +0000\n\n     stdlayout\n\n     git-svn-id: file:///tmp/repo/trunk@1  \ne88f2f36-2641-46fb-97e4-5fd9951470b2\n$ gitk # Oops\n\n-- \nBenoit Sigoure aka Tsuna\nEPITA Research and Development Laboratory\n\n\n"},{"id":"60166","messageId":"20071117204348.GA16333@muzzle","threadId":"10830","inReplyTo":"1213a9470711120628l4ccab632n17635295ec897a2@mail.gmail.com","subject":"Re: BUG: git-svn does not escape literal backslashes in author names.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-11-17T20:43:48Z","receivedAt":"2007-11-17T20:43:48Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Adrian Wilkins <adrian.wilkins@gmail.com> wrote:\n> Recently converted a large (11,000+ revisions) repository.\n> \n> We authenticate against the NT domain controller, so all our revision\n> authors are of the form \"domain\\user\". (You can switch off mod_sspi\n> reporting the domain part, but I didn't know about this at the time,\n> so it continues for historical reasons.)\n> \n> git-svn treats the literal backslashes in the author names as escapes.\n> This leads to authors like\n> \n> domainkevin\n> domain\\\n> ichard\n> \n> I know, I should have read the manual and used my \"authors\" file. Bah.\n> \n> I'm sure that part of the revision hash in git includes the author\n> name... so I guess I'm looking at another multi-day conversion. :-(\n\ngit-filter-branch should be able to take care of it.  If you find\nan invocation that's useful to others, it'd be great to post it\non the list as well :)\n\n> Can I suggest that you make the authors file compulsory by default as well?\n\nNot going to happen.  I personally _hate_ having to track down author\ninformation and make an authors file, and I suspect many others feel the\nsame.  I've never used this feature in git-svn on any real repository.\n\n-- \nEric Wong\n"},{"id":"60181","messageId":"473F7679.4010901@op5.se","threadId":"10830","inReplyTo":"20071117204348.GA16333@muzzle","subject":"Re: BUG: git-svn does not escape literal backslashes in author names.","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-11-17T23:17:13Z","receivedAt":"2007-11-17T23:17:13Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Eric Wong wrote:\n> Adrian Wilkins <adrian.wilkins@gmail.com> wrote:\n> \n>> Can I suggest that you make the authors file compulsory by default as well?\n> \n> Not going to happen.  I personally _hate_ having to track down author\n> information and make an authors file, and I suspect many others feel the\n> same.  I've never used this feature in git-svn on any real repository.\n> \n\nI wholeheartedly agree. One thing that could be improved in this area though\nis to do what git-cvsimport does, and stash the authors file in $GIT_DIR and\nre-read it on every invocation. I've forgotten to add that -A switch numerous\ntimes when fetching incrementally and it always annoys me enormously.\n\nSomething like this, perhaps? It needs checking. My perl is.. well, you can\nsee for yourselves, and unfortunately I have no possibility to test this\nuntil monday when I'm back on a sane link. It should work as a starting\npoint though. It applies cleanly on top of current next.\n\n---%<---%<---%<---\nFrom: Andreas Ericsson <ae@op5.se>\nSubject: git svn: Cache author info in $GIT_DIR/author-cache\n\ngit-cvsimport does it, so it's reasonable that git-svn users\nexpect the same functionality. It's also damn convenient.\n\nSigned-off-by: Andreas Ericsson <ae@op5.se>\n---\n Documentation/git-svn.txt |    3 +++\n git-svn.perl              |   25 +++++++++++++++++++++++--\n 2 files changed, 26 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex 488e4b1..446a7d7 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -276,6 +276,9 @@ committer name that does not exist in the authors-file, git-svn\n will abort operation. The user will then have to add the\n appropriate entry.  Re-running the previous git-svn command\n after the authors-file is modified should continue operation.\n+For convenience, this data is saved to $GIT_DIR/author-cache\n+each time the '-A' option is provided and read from that same\n+file each time git-svn is run.\n \n config key: svn.authorsfile\n \ndiff --git a/git-svn.perl b/git-svn.perl\nindex e3e00fd..0a989ed 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -14,6 +14,7 @@ my $cmd_dir_prefix = eval {\n        command_oneline([qw/rev-parse --show-prefix/], STDERR => 0)\n } || '';\n \n+my $author_cache;\n my $git_dir_user_set = 1 if defined $ENV{GIT_DIR};\n $ENV{GIT_DIR} ||= '.git';\n $Git::SVN::default_repo_id = 'svn';\n@@ -203,7 +204,6 @@ exit 1 if (!$rv && $cmd && $cmd ne 'log');\n usage(0) if $_help;\n version() if $_version;\n usage(1) unless defined $cmd;\n-load_authors() if $_authors;\n \n # make sure we're always running\n unless ($cmd =~ /(?:clone|init|multi-init)$/) {\n@@ -226,6 +226,14 @@ unless ($cmd =~ /(?:clone|init|multi-init)$/) {\n                $ENV{GIT_DIR} = $git_dir;\n        }\n }\n+\n+$author_cache = $ENV{GIT_DIR} . \"/author-cache\";\n+load_authors($_authors) if $_authors;\n+unless ($cmd =~ /(?:clone|init|multi-init)$/) {\n+       -f $author_cache and load_authors($author_cache);\n+       write_author_cache();\n+}\n+\n unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {\n        Git::SVN::Migration::migration_check();\n }\n@@ -297,6 +305,8 @@ sub do_git_init_db {\n                command_noisy('config', \"$pfx.$i\", $icv{$i});\n                $set = $i;\n        }\n+\n+       write_author_cache() if %users;\n }\n \n sub init_subdir {\n@@ -900,7 +910,8 @@ sub file_to_s {\n \n # '<svn username> = real-name <email address>' mapping based on git-svnimport:\n sub load_authors {\n-       open my $authors, '<', $_authors or die \"Can't open $_authors $!\\n\";\n+       my ($file) = @_;\n+       open my $authors, '<', $file or die \"Can't open $file $!\\n\";\n        my $log = $cmd eq 'log';\n        while (<$authors>) {\n                chomp;\n@@ -915,6 +926,16 @@ sub load_authors {\n        close $authors or croak $!;\n }\n \n+sub write_author_cache {\n+       open my $f, '>', $author_cache\n+         or die \"Can't open author cache $author_cache for writing: $!\\n\";\n+       foreach (keys %users) {\n+               print $f \"$_=$users{$_}[0] <$users{$_}[1]>\\n\";\n+       }\n+\n+       close $f or croak $!;\n+}\n+\n # convert GetOpt::Long specs for use by git-config\n sub read_repo_config {\n        return unless -d $ENV{GIT_DIR};\n-- \n1.5.3.5.1527.g6161\n---%<---%<---%<---\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"}]}