We are migrating svn to git and some of the users in our svn are no longer with the company and have no corresponding account in our git repository.
Is there any way to ignore mapping of these users during git svn clone. We are getting the error "Author not defined in file" for them.
EDIT: Maybe not ignore completely but just use their svn user by default.
P.S. I don't have all the svn users list. Only those from our team.
As a distributed VCS (unlike svn), git does not require any registration of author/commiter email addresses.
In general, commit author email is merely an annotation, a field on commit object. During git commit
, you can set it to whatever value you feel necessary:
git commit --author 'Bruce Willis <planet-savior@earth.universe>'
and it'll work. Try it!
Of course usually, we don't do that, but instead set it once with git config --global user.email my-email@acme.com
and git stamps it onto most commits we make on that machine. Here, too, notice it's a label that we freely choose, it requires registration nowhere.
Also, you can "amend", that is, change, existing commit's author, with git commit --amend --author ...
— although beware that, like with all amends, this changes the commit's sha hash, and thus ID, and thus all subsequent commits in a branch will need rewriting (with git rebase
or otherwise) and force-pushing — because the parent commit ID participates in the child's commit hash as another commit object field.
That is to say: an "account in git repository" is not a thing. It is in svn, yes. But in git, author email is merely a label on commit. It's principally the same as the Date
field — only in email format, rather than a datestamp. BTW, Date
on commits can be rewritten similarly.
Now, to your specific problem... Let me cite git-svn documentation about --authors-file
and the next option, --authors-prog
:
-A<filename>
--authors-file=<filename>Syntax is compatible with the file used by
git cvsimport
but an empty email address can be supplied with<>
:loginname = Joe User <user@example.com>
If this option is specified and
git svn
encounters an SVN 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 previousgit svn
command after the authors-file is modified should continue operation.--authors-prog=<filename>
If this option is specified, for each SVN committer name that does not exist in the authors file, the given file is executed with the committer name as the first argument. The program is expected to return a single line of the form "Name " or "Name <>", which will be treated as if included in the authors file.
I'll highlight 3 points:
Re-running the previous git svn command after the authors-file is modified should continue operation.
— perhaps try just editing the authors-file, add missing entries as they're discovered, then restart the previous git svn command.An empty email address can be supplied with <>
— reads clear enough as-is to me; might come handy when trying the next idea;--authors-prog
. Remember that its output, what the name & email "should be" — from git's perspective, is completely up to you.