无效作者/提交者行 - 在电子邮件之前缺少空间 [英] invalid author/committer line - missing space before email

查看:140
本文介绍了无效作者/提交者行 - 在电子邮件之前缺少空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 git-remote-bzr bzr 存储库克隆的 git 存储库,如下所示: git clone bzr :: / repo new-repo
在执行了几百次提交之后,我执行了 git fsck ,并且所有提交的 bzr 都出现了以下错误:


提交错误41bf5:无效的作者/提交者行 - 在电子邮件之前缺少空格

当我使用 git cat-file -p 41bf5 检查这些修订版时,我确实可以看到作者姓名和电子邮件没有用空格隔开。



如何为所有错误提交添加这个空缺?

我可以完全访问服务器上的repo,因此我可以毫无问题地重写历史记录。修改后,代码的用户将不得不重新登录存储库。
我已经尝试过以下帖子中提出的解决方案,但没有成功:


解决方案

我的问题的解决方案来自于一位朋友,代表他回答:


  1. 过滤回购,使用以下方式更改假冒作者。请注意,这应该在两个单独的行上(通常使用 shift + enter ):

      $ git filter-branch --commit-filter'case$ GIT_AUTHOR_NAMEin 
    > * author\< \ email *)GIT_AUTHOR_NAME = author_name; GIT_AUTHOR_EMAIL = AUTHOR_EMAIL ;; ESAC; git commit-tree$ @'


  2. 由于错误提交仍在存储库中, git fsck 仍然会失败。为了摆脱这些提交,克隆回购,然后修剪未使用的对象:

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


  3. 清洁。 git fsck 不会返回错误。



I have a git repository that was cloned from a bzr repository using git-remote-bzr as follows: git clone bzr::/repo new-repo. After a few hundreds of commits, I executed git fsck and I got the following error for all the bzr commits:

error in commit 41bf5: invalid author/committer line - missing space before email

When I check these revisions with git cat-file -p 41bf5 I can indeed see that the author name and the email are not separated with a space.

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

I have full access to the repo on the server so I can rewrite the history without any problems. After modifications the users of the code will have to reclone the repository. I already tried without success the solutions proposed in the following posts:

解决方案

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

  1. Filter the repo, changing the bogus author with the following. Note that this should be on two separate lines (normally using shift+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 "$@" '
    

  2. Since the faulty commits are still in the repository, git fsck will still fail on them. To get rid of those commits, clone the repo and then prune unused objects:

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

  3. The new repository is clean. git fsck returns no errors.

这篇关于无效作者/提交者行 - 在电子邮件之前缺少空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆