Re: Scriptable mode for git bisect
- From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
- Date
- Sep 25, 2022, 00:59 UTC
- Message-ID
- <Yy+n7/NolP5rCpwX@danh.dev>
- In-Reply-To
- <69B998A9-0E3E-45F0-8733-F2A3F11625A5@clausfischer.com>
On 2022-09-25 01:46:13+0200, Claus Fischer <claus.fischer@clausfischer.com> wrote:
Show 13 quoted lines
> Well since I usually don’t have many revisions backwards, typically > no more than 50, I can just traverse the tree backwards from main. > I remember the last ‘bad’ revision before the good one. > So there’s a solution for me. > > Yes the bisect command puts the correct ‘first bad’ revision in its > output but it’s surrounded by a large amount of useless text. It > would be nice to have a ‘quiet’ flag that lets it output just the > bad revision. Alternatively, that it ends by checking out just that > bad revision before revert. > > My problem is solved by stepping backwards to HEAD~1 each time, but > you might consider making bisect more scriptable.
No, you don't need to parse "git bisect" output to get the "first bad" revision. The "first bad" revision is stored in refs/bisect/bad.
And you can take the "first bad" revision in a scriptable way with:
FIRST_BAD=$(git rev-parse --verify refs/bisect/bad)
Of course, after finishing bisecting.
-- Danh