0

I want to copy a large SVN repo and hash all committer/author names as they are confidential. I want to maintain the working repo, with all revision and be able to tell each committer apart but with a hashed(or obscured) author name.

So far I have used git-svn to copy the repo to git and I'm looking into using git filter-branch --env-filter to do this. However, it seems more suitable for replacing one specific author rather than all authors (there is likely hundreds). I want to change all of the names without having to enter each one manually into an if statement.

Can anyone give me advice on how to approach this problem? I'm not sure how best to proceed.

The following is the script i'm aware of but which would require manual processing of each author:

 #!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"

if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
combatrock
  • 17
  • 6

1 Answers1

1

git-svn has an --authors-file option where you can tell git what the value for the author on git will be for a given svn revision committer. So it's a pretty simple file.

svnauthor1 = Author Name 1 <author1@mail.com>
svnauthor2 = Author Name 2 <author2@mail.com>
eftshift0
  • 26,375
  • 3
  • 36
  • 60