Git bisect with a list of * uninteresting * paths

You can pass a list of paths togit bisect

to test only those files that have been tested:

You can reduce the number of probes if you know which part of the tree is involved in the problem you are tracking by setting the path parameters when you issue the bisect startup command:

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

      

However, I would like to do a double of this: ignore commits that only certain files are concerned, so something like

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

      

will skip a commit that touches arch/i386/foo.c

and include/asm-i386/utils.s

, but will include a commit that touches arch/i386/bar.c

and arch/amd64/baz.c

(since the latter is not under the specified paths, and hence the entire commit matters).

Is there a way to do this?

+3


source to share


2 answers


How to do what you want is to use it bisect run <script>

.
Use bisect as you have done so far and use bisect with the script option.

The script will return the appropriate code for gaps (or 125 for non-testable - much more appropriate in your case).



Note that the script (my_script in the example above) should exit with code 0 if the current source is good, and exit with code between 1 and 127 (inclusive), except 125 if the current source is bad.

Any other exit code will abort the bisect process. Note that a program that ends with "exit (-1)" leaves $? = 255, (see the man page exit (3)) because the value is interrupted by "& 0377".

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 reasonable value to use for this purpose, because 126 and 127 are used by POSIX shells to signal a specific error condition (127 for a command not found, 126 for a command found but not executable --- this data does not matter since they are normal script errors as far as "bisect run" is concerned).

+3


source


As CodeWizar says you should use a script for this method

Record:

git bisect start HEAD commit-id

      

Enter script.sh

as follows:

[ "$(git diff-tree --no-commit-id --name-only -r HEAD | sort)" = "path"  ] && exit 125
make && exit 0 || exit 1

      

and run



git bisect run script.sh

      

Line:

[ "$(git diff-tree --no-commit-id --name-only -r HEAD | sort)" = "path"  ] && exit 125

      

will check if the current commit contains exactly the file modification path and will exit 125 if so (e.g. skip this commit to halve)

You can also specify multiple paths with \n

inside path

+1


source







All Articles