git blame --ignore-revs-file显然是现代Git中存在的一个选项。
只有一个问题,它并不起作用。
或者,至少对我来说不起作用:
您可以将此添加到shell脚本中:
mkdir -p /tmp/blarp
cd /tmp/blarp
git init
cat << EOF > file.txt
one
two
three
EOF
git add file.txt
git commit --author "One <one@example.com>" -m 'one commit'
cat << EOF > file.txt
one
awesome
three
EOF
git add file.txt
git commit --author "Two <two@example.com>" -m 'two commits'
cat << EOF > file.txt
one
awesome
sauce
EOF
git add file.txt
git commit --author "One <one@example.com>" -m 'three commits'
git rev-parse HEAD~1 > ignore.txt
git blame --ignore-revs-file=ignore.txt file.txt
对我来说,这表明:
^b6d40d5 (One 2019-12-30 21:47:15 +0000 1) one
1c185c4c (Two 2019-12-30 21:47:15 +0000 2) awesome
d8b9bafd (One 2019-12-30 21:47:15 +0000 3) sauce
但我希望看到
^b6d40d5 (One 2019-12-30 21:47:15 +0000 1) one
^b6d40d5 (One 2019-12-30 21:47:15 +0000 2) two
d8b9bafd (One 2019-12-30 21:47:15 +0000 3) sauce
或者
^b6d40d5 (One 2019-12-30 21:47:15 +0000 1) one
d8b9bafd (One 2019-12-30 21:47:15 +0000 2) awesome
d8b9bafd (One 2019-12-30 21:47:15 +0000 3) sauce
但事实并非如此。我发现如果更改只是空格的更改,它们将被忽略......但git文档对此并不明确,只是建议使用以下命令:
--ignore-revs-file
忽略在文件中列出的修订版本,该文件必须与fsck.skipList的格式相同。可以重复使用此选项,并且这些文件将在使用blame.ignoreRevsFile配置选项指定的任何文件之后被处理。空文件名“”将清除先前处理的文件中版本列表。
有什么线索说明为什么git blame --ignore-revs-file=revs-to-ignore
对我来说似乎不能正确工作吗?
blame.markUnblamables
和blame.markIgnoredLines
设置,但似乎在这里它们也无法起作用。这似乎不对,但新的归咎/分配算法充满了启发式方法,描述也不太清楚,所以也许是有意为之,或者可能是一个错误。 - torek