如何在git svn的authors文件中有一个尾随空格字符

Ash*_*ame 5 git-svn

我的svn回购中的作者如下:

$ svn log --xml | grep作者| sort -u | perl -pe's /.>(.?)<./$ 1 = /'

输出:

<author>ashfame</author>
<author>clean</author>
<author>clean </author>
<author>rocketweb</author>
Run Code Online (Sandbox Code Playgroud)

但是在使用进口克隆回购的时候git svn clone,它却在说到之间停了下来Author: clean not defined in /home/ashfame/fun/authors-transform.txt file

注意clean之后的双倍空格,这意味着它是第三个用户"clean ".

如何格式化我的作者文件以在用户名中留出空格?我目前的内容如下:

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
Run Code Online (Sandbox Code Playgroud)

有趣的发现:我尝试将svn repo导入git而没有任何用户映射,我看不到任何与"干净"用户相关的内容,只有"干净"存在,所以我猜这是svn repo的一些打嗝.关于可以做些什么的任何指示?

Cra*_*rel 5

作者名中的空格也有类似的问题。

使用author-prog选项解决该问题,该选项允许您使用bash脚本,它将转换未知的作者。

#!/bin/bash

if [ "$1" = "VisualSVN Server" ];then
    echo "VirtualSVNServer <svn.localdomain>";
fi
Run Code Online (Sandbox Code Playgroud)


Ash*_*ame 2

我不明白 SVN 存储库出了什么问题,所以我只是导入了它们,没有任何作者文件。然后我使用来自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"
'
Run Code Online (Sandbox Code Playgroud)

将上面的代码保存在一个名为 say 的文件中change-commit-author-script.sh,并将该文件放入您的存储库根目录中。使其可执行chmod +x change-commit-author-script.sh,然后运行./change-commit-author-script.sh

是的,不要忘记编辑脚本来填写您的姓名和电子邮件值。