Authors in my svn repo are as follows:
$ svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /'
Output:
<author>ashfame</author>
<author>clean</author>
<author>clean </author>
<author>rocketweb</author>
But while cloning the repo for import using git svn clone
, it halts in between saying Author: clean not defined in /home/ashfame/fun/authors-transform.txt file
Notice the double space after clean, which means its the 3rd user "clean "
.
How do I format my authors file to have a space in username? My current contents are as follows:
ashfame = Ashfame <mail@example.com>
clean = Yogesh Tiwari <yogesh.tiwari@example.com>
clean = Yogesh Tiwari <yogesh.tiwari@example.com>
"clean\ " = Yogesh Tiwari <yogesh.tiwari@example.com>
"clean " = Yogesh Tiwari <yogesh.tiwari@example.com>
rocketweb = rocketweb <rocketweb@rocketweb.com>
(no author) = Yogesh Tiwari <yogesh.tiwari@example.com>
(no author) = no_author
Interesting discovery: I tried importing the svn repo into git without any user mapping and I couldn't see anything related to "clean " user, only "clean" exists, so I am guessing this is some hiccup on svn repo. Any pointers on what can be done about it?
I couldn't figure what the hiccup was with the SVN repo, so I just imported them without any author file. And then I renamed the commit author data using this script from Github:
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
then
cn="Your New Committer Name"
cm="Your New Committer Email"
fi
if [ "$GIT_AUTHOR_EMAIL" = "your@email.to.match" ]
then
an="Your New Author Name"
am="Your New Author Email"
fi
export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"
'
Save the above code in a file with a name say change-commit-author-script.sh
and put the file in your repo root. Make it executable by chmod +x change-commit-author-script.sh
and then run in by ./change-commit-author-script.sh
And yeah don't forget to edit the script to fill in your name and email values.