git bisect with additional patch
Asked Answered
K

2

9

Let's say I have these revisions:

  • rev 1 introduces bug #1
  • rev 2 possibly introduces bug #2
  • rev 3 possibly introduces bug #2
  • rev 4 possibly introduces bug #2
  • rev 5 fixes bug #1

To verify where bug #2 occured, bug #1 needs to be fixed.

Can the revision where bug #2 first occured be determined during a single git bisect run, possibly through manually appling the rev 5 patch on each bisect step? Would manually patching interfere a bisect?

Kerato answered 28/4, 2015 at 21:13 Comment(3)
see Automatically bisect with temporary modifications in the bisect documentation.Oshinski
Adding a link to the docs example section that Torek mentions: git-scm.com/docs/git-bisect#_examples @Oshinski If you posted that link as an answer, I'd vote for it :)Uredium
@ncoghlan: I'd basically just be reproducing the man-page example (SO answers aren't supposed to be just-a-link)...Oshinski
G
5

When you reach the region that requires the hot-fix patch(rev 5 in your ex.), just run:

git cherry-pick --no-commit hot-fix 

Then continue bisecting normally.

Got answered 16/9, 2021 at 19:39 Comment(0)
K
4

After actually reading the docs, something like this might work (per bisect step):

git cherry-pick [patch-rev]
git reset --hard
git bisect [good/bad]
Kerato answered 29/4, 2015 at 15:3 Comment(2)
this sounds ok but is it possible that the fix could be amended into the last commit to avoid doing tis step by step?Hypogeal
For automated bisection, combine git cherry-pick --no-commit (instead of git-merge) with the hot-fix example mentioned in the comments on the question.Uredium

© 2022 - 2024 — McMap. All rights reserved.