git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: git-svn does not escape literal backslashes in author names.
@ 2007-11-12 14:28 Adrian Wilkins
  2007-11-17 20:18 ` BUG in gitk (was: Re: BUG: git-svn does not escape literal backslashes in author names.) Benoit Sigoure
  2007-11-17 20:43 ` BUG: git-svn does not escape literal backslashes in author names Eric Wong
  0 siblings, 2 replies; 4+ messages in thread
From: Adrian Wilkins @ 2007-11-12 14:28 UTC (permalink / raw)
  To: git

Recently converted a large (11,000+ revisions) repository.

We authenticate against the NT domain controller, so all our revision
authors are of the form "domain\user". (You can switch off mod_sspi
reporting the domain part, but I didn't know about this at the time,
so it continues for historical reasons.)

git-svn treats the literal backslashes in the author names as escapes.
This leads to authors like

domainkevin
domain\
ichard

I know, I should have read the manual and used my "authors" file. Bah.

I'm sure that part of the revision hash in git includes the author
name... so I guess I'm looking at another multi-day conversion. :-(

Can I suggest that you make the authors file compulsory by default as well?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* BUG in gitk (was: Re: BUG: git-svn does not escape literal backslashes in author names.)
  2007-11-12 14:28 BUG: git-svn does not escape literal backslashes in author names Adrian Wilkins
@ 2007-11-17 20:18 ` Benoit Sigoure
  2007-11-17 20:43 ` BUG: git-svn does not escape literal backslashes in author names Eric Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Benoit Sigoure @ 2007-11-17 20:18 UTC (permalink / raw)
  To: Adrian Wilkins; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 2329 bytes --]

On Nov 12, 2007, at 3:28 PM, Adrian Wilkins wrote:

> Recently converted a large (11,000+ revisions) repository.
>
> We authenticate against the NT domain controller, so all our revision
> authors are of the form "domain\user". (You can switch off mod_sspi
> reporting the domain part, but I didn't know about this at the time,
> so it continues for historical reasons.)
>
> git-svn treats the literal backslashes in the author names as escapes.
> This leads to authors like
>
> domainkevin
> domain\
> ichard

Hi Adrian,
I tried to reproduce the error but didn't succeed (see below).  Which  
version of Git did you use?

However, gitk fails to properly render the various properties when  
they contain backslash sequences.  If a gitk expert could have a  
look, I tried but didn't find a standard Tcl procedure to escape  
everything properly and I didn't feel like recoding my own procedure  
because I guess this already exists...

Cheers,


$ svnadmin create repo
$ svn co file://`pwd`/repo wc
Checked out revision 0.
$ cd wc
$ svn mkdir trunk tags branches
A         trunk
A         tags
A         branches
$ svn ci -m stdlayout
Adding         branches
Adding         tags
Adding         trunk

Committed revision 1.
$ cd trunk
$ touch plop && svn add plop
A         plop
$ svn ci -m test --username 'domain\name\richard\test\\ok'
Adding         trunk/plop
Transmitting file data .
Committed revision 2.
$ cd ../..
$ git svn clone --stdlayout file://`pwd`/repo git
Initialized empty Git repository in .git/
r1 = dc86087745d9b6378114f49c1e480d178cf328f9 (trunk)
         A       plop
r2 = de5affcfdc897bfa77a2402a447771f0a88b04bf (trunk)
Checked out HEAD:
   file:///tmp/repo/trunk r2
$ cd git
$ git log
commit de5affcfdc897bfa77a2402a447771f0a88b04bf
Author: domain\name\richard\test\\ok <domain\name\richard\test\ 
\ok@e88f2f36-2641-46fb-97e4-5fd9951470b2
Date:   Sat Nov 17 12:17:29 2007 +0000

     test

     git-svn-id: file:///tmp/repo/trunk@2  
e88f2f36-2641-46fb-97e4-5fd9951470b2

commit dc86087745d9b6378114f49c1e480d178cf328f9
Author: tsuna <tsuna@e88f2f36-2641-46fb-97e4-5fd9951470b2>
Date:   Sat Nov 17 12:16:29 2007 +0000

     stdlayout

     git-svn-id: file:///tmp/repo/trunk@1  
e88f2f36-2641-46fb-97e4-5fd9951470b2
$ gitk # Oops

-- 
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: git-svn does not escape literal backslashes in author names.
  2007-11-12 14:28 BUG: git-svn does not escape literal backslashes in author names Adrian Wilkins
  2007-11-17 20:18 ` BUG in gitk (was: Re: BUG: git-svn does not escape literal backslashes in author names.) Benoit Sigoure
@ 2007-11-17 20:43 ` Eric Wong
  2007-11-17 23:17   ` Andreas Ericsson
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Wong @ 2007-11-17 20:43 UTC (permalink / raw)
  To: Adrian Wilkins; +Cc: git

Adrian Wilkins <adrian.wilkins@gmail.com> wrote:
> Recently converted a large (11,000+ revisions) repository.
> 
> We authenticate against the NT domain controller, so all our revision
> authors are of the form "domain\user". (You can switch off mod_sspi
> reporting the domain part, but I didn't know about this at the time,
> so it continues for historical reasons.)
> 
> git-svn treats the literal backslashes in the author names as escapes.
> This leads to authors like
> 
> domainkevin
> domain\
> ichard
> 
> I know, I should have read the manual and used my "authors" file. Bah.
> 
> I'm sure that part of the revision hash in git includes the author
> name... so I guess I'm looking at another multi-day conversion. :-(

git-filter-branch should be able to take care of it.  If you find
an invocation that's useful to others, it'd be great to post it
on the list as well :)

> Can I suggest that you make the authors file compulsory by default as well?

Not going to happen.  I personally _hate_ having to track down author
information and make an authors file, and I suspect many others feel the
same.  I've never used this feature in git-svn on any real repository.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: git-svn does not escape literal backslashes in author names.
  2007-11-17 20:43 ` BUG: git-svn does not escape literal backslashes in author names Eric Wong
@ 2007-11-17 23:17   ` Andreas Ericsson
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Ericsson @ 2007-11-17 23:17 UTC (permalink / raw)
  To: Eric Wong; +Cc: Adrian Wilkins, git

Eric Wong wrote:
> Adrian Wilkins <adrian.wilkins@gmail.com> wrote:
> 
>> Can I suggest that you make the authors file compulsory by default as well?
> 
> Not going to happen.  I personally _hate_ having to track down author
> information and make an authors file, and I suspect many others feel the
> same.  I've never used this feature in git-svn on any real repository.
> 

I wholeheartedly agree. One thing that could be improved in this area though
is to do what git-cvsimport does, and stash the authors file in $GIT_DIR and
re-read it on every invocation. I've forgotten to add that -A switch numerous
times when fetching incrementally and it always annoys me enormously.

Something like this, perhaps? It needs checking. My perl is.. well, you can
see for yourselves, and unfortunately I have no possibility to test this
until monday when I'm back on a sane link. It should work as a starting
point though. It applies cleanly on top of current next.

---%<---%<---%<---
From: Andreas Ericsson <ae@op5.se>
Subject: git svn: Cache author info in $GIT_DIR/author-cache

git-cvsimport does it, so it's reasonable that git-svn users
expect the same functionality. It's also damn convenient.

Signed-off-by: Andreas Ericsson <ae@op5.se>
---
 Documentation/git-svn.txt |    3 +++
 git-svn.perl              |   25 +++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 488e4b1..446a7d7 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -276,6 +276,9 @@ committer name that does not exist in the authors-file, git-svn
 will abort operation. The user will then have to add the
 appropriate entry.  Re-running the previous git-svn command
 after the authors-file is modified should continue operation.
+For convenience, this data is saved to $GIT_DIR/author-cache
+each time the '-A' option is provided and read from that same
+file each time git-svn is run.
 
 config key: svn.authorsfile
 
diff --git a/git-svn.perl b/git-svn.perl
index e3e00fd..0a989ed 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -14,6 +14,7 @@ my $cmd_dir_prefix = eval {
        command_oneline([qw/rev-parse --show-prefix/], STDERR => 0)
 } || '';
 
+my $author_cache;
 my $git_dir_user_set = 1 if defined $ENV{GIT_DIR};
 $ENV{GIT_DIR} ||= '.git';
 $Git::SVN::default_repo_id = 'svn';
@@ -203,7 +204,6 @@ exit 1 if (!$rv && $cmd && $cmd ne 'log');
 usage(0) if $_help;
 version() if $_version;
 usage(1) unless defined $cmd;
-load_authors() if $_authors;
 
 # make sure we're always running
 unless ($cmd =~ /(?:clone|init|multi-init)$/) {
@@ -226,6 +226,14 @@ unless ($cmd =~ /(?:clone|init|multi-init)$/) {
                $ENV{GIT_DIR} = $git_dir;
        }
 }
+
+$author_cache = $ENV{GIT_DIR} . "/author-cache";
+load_authors($_authors) if $_authors;
+unless ($cmd =~ /(?:clone|init|multi-init)$/) {
+       -f $author_cache and load_authors($author_cache);
+       write_author_cache();
+}
+
 unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {
        Git::SVN::Migration::migration_check();
 }
@@ -297,6 +305,8 @@ sub do_git_init_db {
                command_noisy('config', "$pfx.$i", $icv{$i});
                $set = $i;
        }
+
+       write_author_cache() if %users;
 }
 
 sub init_subdir {
@@ -900,7 +910,8 @@ sub file_to_s {
 
 # '<svn username> = real-name <email address>' mapping based on git-svnimport:
 sub load_authors {
-       open my $authors, '<', $_authors or die "Can't open $_authors $!\n";
+       my ($file) = @_;
+       open my $authors, '<', $file or die "Can't open $file $!\n";
        my $log = $cmd eq 'log';
        while (<$authors>) {
                chomp;
@@ -915,6 +926,16 @@ sub load_authors {
        close $authors or croak $!;
 }
 
+sub write_author_cache {
+       open my $f, '>', $author_cache
+         or die "Can't open author cache $author_cache for writing: $!\n";
+       foreach (keys %users) {
+               print $f "$_=$users{$_}[0] <$users{$_}[1]>\n";
+       }
+
+       close $f or croak $!;
+}
+
 # convert GetOpt::Long specs for use by git-config
 sub read_repo_config {
        return unless -d $ENV{GIT_DIR};
-- 
1.5.3.5.1527.g6161
---%<---%<---%<---

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-17 23:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-12 14:28 BUG: git-svn does not escape literal backslashes in author names Adrian Wilkins
2007-11-17 20:18 ` BUG in gitk (was: Re: BUG: git-svn does not escape literal backslashes in author names.) Benoit Sigoure
2007-11-17 20:43 ` BUG: git-svn does not escape literal backslashes in author names Eric Wong
2007-11-17 23:17   ` Andreas Ericsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).