Invalid author / committer line - no space before sending by email

I have a git repository, which was cloned from bzr repository, using git -remote-bzr follows: git clone bzr::/repo new-repo. After several hundred commits, I executed git fsckand I got the following error for all bzr commits:

41bf5 commit error: invalid author / committer line - no space in front of email

When I check these changes with git cat-file -p 41bf5, I really see that the author name and email address are not separated by a space.

How can I add this missing space for all bad commits?

I have full access to the repo on the server, so I can rewrite history without any problems. After modifications, users of this code will have to put off the repository. I have already unsuccessfully tried the solutions suggested in the following posts:

+3
source share
2 answers

The solution to my question came from a friend who asked me to write an answer on his behalf:

  • Filter the repo by changing the fake author as follows. Note that this should be on two separate lines (usually shift+ is used enter):

    $ git filter-branch --commit-filter 'case "$GIT_AUTHOR_NAME" in
    > *author\<\ email*) GIT_AUTHOR_NAME=author_name; GIT_AUTHOR_EMAIL=author_email;; esac; git commit-tree "$@" '
    
  • , git fsck . , :

    $ git clone badrepo goodrepo && cd goodrepo
    $ git gc --prune=all
    
  • . git fsck .

+3

git-scm.com. , torek git filter-branch , .

:

$ git filter-branch --commit-filter '
    if [ "$GIT_AUTHOR_NAME" = "name_and_email" ];
    then
            GIT_AUTHOR_NAME="name";
            GIT_AUTHOR_EMAIL="email";
            git commit-tree "$@";
    else
            git commit-tree "$@";
    fi' HEAD

, $GIT_AUTHOR_NAME , .


, if - , . , .

0

All Articles