0

Hope you are doing well!

i have a query on how to automate git bisect. currently we are manually finding the faulty commit in bunch of commits manually given git bisect commands. Is there any python script or any bash script?

as am very new to scripting :)

like

git bisect start git bisect bad git bisect good "commit sha value" run the test

and on failed scenario it should take command git bisect bad and on pass scenario it takes git bisect good

this above should continue until it finishes all the commits check.

your response is welcome Thank you in advance.

Python
  • 17
  • 1
  • 4

1 Answers1

0

First you have to write a script that returns 0 if and only if the checked commit is good. For example, the script can run the unit tests.

When you have this script (let's call it check-app.sh), place it in local your git repo and then run :

git bisect start <a-bad-revision> <a-good-revision>
git bisect run ./check-app.sh
Romain Warnan
  • 1,022
  • 1
  • 7
  • 13
  • okie, thanks for the info. do you have an example of such script which returns 0? – Python Oct 10 '18 at 20:04
  • Yes, but it is very specific: if you code in Java with Maven, `mvn test` will return 0 if and only if all unit tests are ok. Clearly, writing the script is the essential part of the work. – Romain Warnan Oct 10 '18 at 20:09
  • Thanks, for the inputs, but as am totally new to scripting, so was looking some initative, well i started reading some documents on python, as i have to write a git bisect automate code in python. – Python Oct 11 '18 at 09:34