Egit:Reflog中的消息与gitbash中的消息不同

Egit:Reflog中的消息与gitbash中的消息不同,git,egit,git-bash,git-reset,git-reflog,Git,Egit,Git Bash,Git Reset,Git Reflog,我注意到EGit记录rest操作的reflog的方式与Git Bash记录它的方式之间存在差异 28eab8d HEAD@{0}: commit: l 959126f HEAD@{1}: 959126fc7fbf887b3bdb5bd931f50c611f48bf71: updating HEAD f073b25 HEAD@{2}: commit: l 959126f HEAD@{3}: reset: moving to HEAD~1 b0114f6 HEAD@{4}: commit: l 95

我注意到EGit记录rest操作的reflog的方式与Git Bash记录它的方式之间存在差异

28eab8d HEAD@{0}: commit: l
959126f HEAD@{1}: 959126fc7fbf887b3bdb5bd931f50c611f48bf71: updating HEAD
f073b25 HEAD@{2}: commit: l
959126f HEAD@{3}: reset: moving to HEAD~1
b0114f6 HEAD@{4}: commit: l
959126f HEAD@{5}: 959126fc7fbf887b3bdb5bd931f50c611f48bf71: updating HEAD
头{1}和头{5}由EGIT记录,头{3}由Git Bash记录

此外,它们记录分支名称更改的方式似乎有所不同:

28eab8d9329f936c1642a591317bbe5be3fed7c1 28eab8d9329f936c1642a591317bbe5be3fed7c1 user <user@user.com> 1423771813 -0500 Branch: renamed refs/heads/test to refs/heads/testtt
28eab8d9329f936c1642a591317bbe5be3fed7c1 28eab8d9329f936c1642a591317bbe5be3fed7c1 user <user@user.com> 1423771870 -0500 Branch: renamed refs/heads/testtt to refs/heads/test
0000000000000000000000000000000000000000 28eab8d9329f936c1642a591317bbe5be3fed7c1 user <user@user.com> 1423771941 -0500 Branch: renamed test to testttt
0000000000000000000000000000000000000000 28eab8d9329f936c1642a591317bbe5be3fed7c1 user <user@user.com> 1423772021 -0500 Branch: renamed testttt to test
28eab8d9329f936c1642a591317bbe5be3fed7c1 28EAB8D9329F936C1642A5917BBE5BE3FED7C1用户1423771813-0500分支:将refs/heads/test重命名为refs/heads/testtt
28eab8d9329f936c1642a591317bbe5be3fed7c1 28EAB8D9329F936C1642A5917BBE5BE3FED7C1用户1423771870-0500分支:将refs/heads/testtt重命名为refs/heads/test
0000000000000000000000000000000000 28eab8d9329f936c1642a591317bbe5be3fed7c1用户1423771941-0500分支:将测试重命名为testttt
0000000000000000000000000000000000 28eab8d9329f936c1642a591317bbe5be3fed7c1用户1423772021-0500分支:重命名testttt以进行测试
最上面的第一行来自GitBash,最下面的一行来自EGit。此外,EGit对headreflog做了相同的更改,而gitbash什么也不做

最大的问题是Git Bash没有显示任何超过40 0的行,所以在Git Bash中我看不到日志

我想我可以拼凑一些脚本来重写日志,但我想知道是否有一些设置或版本我错了


我正在使用Egit 3.4.1和Git Bash 1.8.5.2.msysgit.0,下面的脚本将修复由Egit引起的问题。将其命名为
/bin/git sanitize reflog
或任何您喜欢的名称。如果你紧张,事先做个备份

#!/bin/bash

resetFix='s/([a-f0-9]{6})[a-f0-9]{34}: updating HEAD/reset: moving to $1/'
touch tempfile
for log in $(find $(git rev-parse --git-dir)/logs/$1 -type f)
do 
    if [[ $log != "$(git rev-parse --git-dir)/HEAD" ]]
    then
        perl -pe 's/^0{40} ([a-f0-9]{40})/$1 $1/' $log | 
        perl -pe 's/Branch: renamed (?!refs\/heads\/)(.*) to (?!refs\/heads\/)(.*)/Branch: renamed refs\/heads\/$1 to refs\/heads\/$2/' |
        perl -pe "$resetFix" > tempfile

        if [[ $(cat tempfile | wc -l) -ne $(cat $log | wc -l) ]]
        then
            exit -1
        fi
    else
        HEAD_grep='^0{40}.*Branch: renamed'
        egrep -v $HEAD_grep $log |
        perl -pe "$resetFix" > tempfile
        if [[ $(wc -l tempfile) -ne $(expr $(cat $log | wc -l) - $(egrep $HEAD_grep $log | wc -l)) ]]
        then
            exit -1
        fi
    fi
    cat tempfile > $log
    echo Sanitized $log
done
rm tempfile