Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I cut down a git bisect run using file paths?

Tags:

I'm using git bisect to find a failure inducing commit. However, a lot of the commits in the range are definately irrelevant (because they are commits to the documentation or to unit tests). I'd like to make git bisect automatically skip commits which affect files in certain directories. Is this possible somehow?

like image 302
Frerich Raabe Avatar asked Jul 05 '10 12:07

Frerich Raabe


People also ask

How do I remove a bad commit in git bisect?

Use git log to check the previous commits. Use Git Bisect to find the commit in which line 2 is changed from 'b = 20' to 'b = 0.00000'. Remove the bad commit by using Git Revert. Leave the commit message as is.

What is git bisect how can you use it to determine the source of a regression bug?

The git bisect command is a fantastic tool that can help you determine which commit introduced the bug. A regression bug is a specific type of software bug that prevents a feature or software from working when it was working before the bug was introduced. Just remember, git bisect won't "fix" the broken commit for you.


1 Answers

You have several options here:

  1. Ignoring specific commits

    git bisect contains functionality of skipping commits. You can specify commits, tags, ranges you don't want to test with

     git bisect skip 0dae5f ff049ab ... 

    Just do this before you git bisect run, and it should skip what you specified.

  2. Specifying folders with broken sources

    You can also cut down commits bisect tests by specifying what folders it should look for problems in. This is done at the beginning of bisect process by supplying additional arguments to git bisect start (quote from standard manual):

     git bisect start -- arch/i386 include/asm-i386 

    Bisect will only consider commits that touch the folders specified.


If you want to automatically gather commits that touch certain files or folders, you may use git log for that. For example, the following command will give you commit names that modify files in certain folders:

git log --pretty=format:%H  tests/ docs/ 

And you can supply the result to git bisect skip with use of shell capabilities:

git bisect skip `git log --pretty=format:%H  tests/ docs/` 
like image 94
P Shved Avatar answered Sep 30 '22 10:09

P Shved