You can pass a list of paths to git bisect
这样只有提交更改这些文件才会被测试:
You can further cut down the number of trials, if you know what part of the tree is involved in the problem you are tracking down, by specifying path parameters when issuing the bisect start command:
$ git bisect start -- arch/i386 include/asm-i386
但是,我想做这两个事情:忽略只涉及某些文件的提交,比如
$ git bisect start --unrelated arch/i386 include/asm-i386
会跳过涉及 arch/i386/foo.c
和 include/asm-i386/utils.s
的提交,但会包含涉及 的提交arch/i386/bar.c
和 arch/amd64/baz.c
(因为后者不在列出的路径下,因此整个提交是相关的)。
有办法吗?
最佳答案
做你想做的事情的方法是使用 bisect run <script>
.
像目前一样使用二分法,并将二分法与脚本选项一起使用。
脚本将返回适当的跳过代码(或 125 表示不可测试 - 更适合您的情况)。
Note that the script (my_script in the above example) should exit with code 0 if the current source code is good, and exit with a code between 1 and 127 (inclusive), except 125, if the current source code is bad.
Any other exit code will abort the bisect process. It should be noted that a program that terminates via "exit(-1)" leaves $? = 255, (see the exit(3) manual page), as the value is chopped with "& 0377".
The special exit code 125 should be used when the current source code cannot be tested. If the script exits with this code, the current revision will be skipped (see git bisect skip above). 125 was chosen as the highest sensible value to use for this purpose, because 126 and 127 are used by POSIX shells to signal specific error status (127 is for command not found, 126 is for command found but not executable---these details do not matter, as they are normal errors in the script, as far as "bisect run" is concerned).
关于带有*无趣*路径列表的 git bisect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31112179/