]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/bisect--helper.c
bisect--helper: `bisect_write` shell function in C
authorPranit Bauva <pranit.bauva@gmail.com>
Wed, 2 Jan 2019 15:38:32 +0000 (07:38 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Jan 2019 18:23:02 +0000 (10:23 -0800)
commit0f30233a11f6d89fb387ddf96db64877adb90713
treec7076e59bdbe3b223f3a6bd8af9ea8140b94d13b
parent5e82c3dd22aa804ba0ae571bf903b387b0f766a6
bisect--helper: `bisect_write` shell function in C

Reimplement the `bisect_write` shell function in C and add a
`bisect-write` subcommand to `git bisect--helper` to call it from
git-bisect.sh

Using `--bisect-write` subcommand is a temporary measure to port shell
function in C so as to use the existing test suite. As more functions
are ported, this subcommand will be retired but its implementation will
be called by some other methods.

Note: bisect_write() uses two variables namely TERM_GOOD and TERM_BAD
from the global shell script thus we need to pass it to the subcommand
using the arguments. We then store them in a struct bisect_terms and
pass the memory address around functions.

Add a log_commit() helper function to write the contents of the commit message
header to a file which will be re-used in future parts of the code as
well.

Also introduce a function free_terms() to free the memory of `struct
bisect_terms` and set_terms() to set the values of members in `struct
bisect_terms`.

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Mentored-by: Lars Schneider <larsxschneider@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/bisect--helper.c
git-bisect.sh