Subject: Re: git clone svn: authors from authors file are ignored, authors-prog works, but crashes on branch points

From: Michael J Gruber <[email-masked]>
Date: Thu, 10 Sep 2015 14:32:07 +0200

Till Schäfer venit, vidit, dixit 26.08.2015 21:57:
> Hi,
> i am observing some weired "git svn clone" behavior during my try to migrate the Scaffold Hunter [1] SVN repository [2] to Git: 
> 
> if i just use the command 
> 
> $ git svn clone svn://svn.code.sf.net/p/scaffoldhunter/code --no-metadata -s code

Is there a specific reason for "--no-metadata"? The man page advises
against it. Basically, it keeps you from converting the history in
chunks. (You can always filter-branch everything after a complete, "one
shot" conversion which may be done in stages.)

> everything went smoothly. Now i wanted to replace the authors SVN-logins by useful names and created a mapping file with the following content: 
> 
> anjenson = Andrew Zhilka <>
> bernhard.dick = Bernhard Dick <>
> dominic.sacre = Dominic Sacré <>
> doxmoxbox = doxmoxbox <>
> falkn = Falk Nette <>
> henning.garus = Henning Garus <>
> kakl = Karsten Klein <>
> klein = Karsten Klein <>
> lappie00 = Jeroen Lappenschaar <>
> michael.hesse = Michael Hesse <>
> nlskrg = Nils Kriege <[email-masked]>
> philipp.kopp = Philipp Kopp <>
> philipp.lewe = Philipp Lewe <>
> schrins = Sven Schrinner <>
> shamshadnpti = Shamshad Alam <>
> srenner7 = Steffen Renner <>
> sturm89 = Werner Sturm <>
> thomas.schmitz = Thomas Schmitz <>
> thorsten.fluegel = Thorsten Flügel <>
> till.schaefer = Till Schäfer <[email-masked]>
> tillschaefer = Till Schäfer <[email-masked]>
> 
> 
> I executed:
> 
> $ git svn clone svn://svn.code.sf.net/p/scaffoldhunter/code --authors-file=/home/till/temp/code-authors-transform.txt --no-metadata -s code
> 
> and got the error message "Author: klein not defined in /home/till/temp/code-authors-transform.txt file". 
> I tried a workaround by using a python script to return the entries i have already defined in the authors file: 
> 
> $ git svn clone svn://svn.code.sf.net/p/scaffoldhunter/code --authors-file=/home/till/temp/code-authors-transform.txt --authors-prog=/home/till/temp/authors.py --no-metadata -s code
> 
> The import process now went over the "klein" commit. The weired thing is, that a few SVN usernames seem to be recognized in the authors file and a few are passed to my script (I logged the output). However, at the first revision, where a tag was added in the SVN repo the cloning process crashed with the error message: 

That first part is weird already. The reason is that author-file
processing and author-prog output processing use different perl regexps.
I will follow up with a patch.

> Found possible branch point: svn://svn.code.sf.net/p/scaffoldhunter/code/trunk => svn://svn.code.sf.net/p/scaffoldhunter/code/branches/subsearch, 17
> Use of uninitialized value $u in substitution (s///) at /usr/lib64/perl5/vendor_perl/5.20.2/Git/SVN.pm line 101.
> Use of uninitialized value $u in concatenation (.) or string at /usr/lib64/perl5/vendor_perl/5.20.2/Git/SVN.pm line 101.
> refs/remotes/origin/trunk: 'svn://svn.code.sf.net/p/scaffoldhunter/code' not found in ''
> 
> One problem I am seeing in the SVN repo is, that between the revisions 97 and 102 the trunk folder was absent. the old one was moved to some subfolder and a new one was created. Therefore, I started the cloning beginning with rev 102 using the command line option "-r102:HEAD". However, the same error occurred for some later tag (the first tag after rev 102). 
> 
> Found possible branch point: svn://svn.code.sf.net/p/scaffoldhunter/code/trunk => svn://svn.code.sf.net/p/scaffoldhunter/code/tags/release-2.0, 1565
> Use of uninitialized value $u in substitution (s///) at /usr/lib64/perl5/vendor_perl/5.20.2/Git/SVN.pm line 101.
> Use of uninitialized value $u in concatenation (.) or string at /usr/lib64/perl5/vendor_perl/5.20.2/Git/SVN.pm line 101.
> refs/remotes/origin/trunk: 'svn://svn.code.sf.net/p/scaffoldhunter/code' not found in ''
> 
> I would be very glad if someone has a hint about what is going wrong here. Is this a bug in git or is something wrong with the SVN repo?

The layout change (no root) certainly doesn't help. We shouldn't crash,
though.

> used software versions: 
> - git 2.5.0 
> - subversion 1.8.14

The conversion goes through for me with (your other options and) your
authors file and specifying a stupid authors prog:

--->8---
#!/bin/sh
grep "$1" /tmp/t/authors | head -n 1 | cut -d'=' -f2 | cut -c'2-'
--->8---

and:

git version 2.6.0.rc0.178.g4177fa5
svn, Version 1.8.13 (r1667537)

with our without --authors-file...

(It went also through with a patched git-svn and just the authors file.)

I don't think git-svn has changed since git 2.5.0. Maybe you can
downgrade svn for the one-shot conversion? I don't see anything
suspicious in their changelog but don't remember it as being overly
complete.

git svn served us well in making itself mostly obsolete. The downside is
that not many are using it any more. Keeping up with subversion changes
(to keep git svn working) has become more and more difficult.

Michael