1

我正在使用 git bisect 来查找导致 linux 启动失败的错误提交。

当前已知的错误提交是:

commit 0f3f4fef3520fe888303886b62224bac7a837cac
Author: Darren Hart <dvhart@linux.intel.com>
Date:   Mon Mar 2 09:06:39 2015 -0800

Add manifest for 2015-03-02

已知的良好提交是:

commit 857a433072364883be5e4a7e30b895360999c8ab
Merge: d6182fe 0e28b83
Author: Darren Hart <dvhart@linux.intel.com>
Date:   Mon Feb 23 17:11:35 2015 -0800

Merge commit '0e28b83bcbf60b2485f55ec71ce540f9153725d4'

因此我输入:

[root@localhost linux]# git bisect start
[root@localhost linux]#

[root@localhost linux]# git bisect good 857a433072364883be5e4a7e30b895360999c8ab

[root@localhost linux]# git bisect bad 0f3f4fef3520fe888303886b62224bac7a837cac
Bisecting: a merge base must be tested
[c517d838eb7d07bbe9507871fab3931deccff539] 
Linux 4.0-rc1

测试提交 ID 位于:

[root@localhost linux]# git log
commit c517d838eb7d07bbe9507871fab3931deccff539
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Feb 22 18:21:14 2015 -0800

Linux 4.0-rc1

这是在良好的承诺之前:

commit 857a433072364883be5e4a7e30b895360999c8ab
Date:   Mon Feb 23 17:11:35 2015 -0800

我认为 bisect 永远不会找到错误的提交。

我错过了什么?

4

1 回答 1

1

我想我已经得到了答案,它是由 git rebase 引起的:

假设存在以下历史并且当前分支是“主题”:

      A---B---C topic
     /
D---E---F---G master

从这一点来看,以下命令的结果:

git rebase master

将会:

              A'--B'--C' topic
             /
D---E---F---G master

于是,B消失了。如果 B 是一个好的 commit,并且在 rebase 之后,我们发现 C' 是一个 bad commit,下面的命令:

git bisect start
git bisect good B
git bisect bad C'

会在 B 之前生成一个测试提交,例如:E。

于 2015-03-13T08:19:53.650 回答