<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/bisect.h, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-07-21T22:40:46Z</updated>
<entry>
<title>rev-list: make "struct rev_list_info" static to the only user</title>
<updated>2025-07-21T22:40:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-07-18T23:58:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9b5c002811e672fe994d72a4f0cc9325a0ecffa8'/>
<id>urn:sha1:9b5c002811e672fe994d72a4f0cc9325a0ecffa8</id>
<content type='text'>
The structure has nothing to do with what "git bisect" does; as
nobody other than "git rev-list" implementation uses it, move it
as a private data type to builtin/rev-list.c

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bisect: fix leaking good/bad terms when reading multipe times</title>
<updated>2024-11-20T23:23:40Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-11-20T13:39:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=79366add74529359dfb57a387090e9c5f9c74282'/>
<id>urn:sha1:79366add74529359dfb57a387090e9c5f9c74282</id>
<content type='text'>
Even though `read_bisect_terms()` is declared as assigning string
constants, it in fact assigns allocated strings to the `read_bad` and
`read_good` out parameters. The only callers of this function assign the
result to global variables and thus don't have to free them in order to
be leak-free. But that changes when executing the function multiple
times because we'd then overwrite the previous value and thus make it
unreachable.

Fix the function signature and free the previous values. This leak is
exposed by t0630, but plugging it does not make the whole test suite
pass.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bisect: output state before we are ready to compute bisection</title>
<updated>2022-05-11T19:35:11Z</updated>
<author>
<name>Chris Down</name>
<email>chris@chrisdown.name</email>
</author>
<published>2022-05-11T18:00:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0cf1defa5a6764b8a0fd956ff4d114cb014cb8a4'/>
<id>urn:sha1:0cf1defa5a6764b8a0fd956ff4d114cb014cb8a4</id>
<content type='text'>
Commit 73c6de06aff8 ("bisect: don't use invalid oid as rev when
starting") changes the behaviour of `git bisect` to consider invalid
oids as pathspecs again, as in the old shell implementation.

While that behaviour may be desirable, it can also cause confusion. For
example, while bisecting in a particular repo I encountered this:

    $ git bisect start d93ff48803f0 v6.3
    $

...which led to me sitting for a few moments, wondering why there's no
printout stating the first rev to check.

It turns out that the tag was actually "6.3", not "v6.3", and thus the
bisect was still silently started with only a bad rev, because
d93ff48803f0 was a valid oid and "v6.3" was silently considered to be a
pathspec.

While this behaviour may be desirable, it can be confusing, especially
with different repo conventions either using or not using "v" before
release names, or when a branch name or tag is simply misspelled on the
command line.

In order to avoid situations like this, make it more clear what we're
waiting for:

    $ git bisect start d93ff48803f0 v6.3
    status: waiting for good commit(s), bad commit known

We already have good output once the bisect process has begun in
earnest, so we don't need to do anything more there.

Signed-off-by: Chris Down &lt;chris@chrisdown.name&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bisect--helper: double-check run command on exit code 126 and 127</title>
<updated>2022-01-19T17:35:03Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2022-01-18T12:46:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48af1fdee374e205c9774c163fbd4683d1110d11'/>
<id>urn:sha1:48af1fdee374e205c9774c163fbd4683d1110d11</id>
<content type='text'>
When a run command cannot be executed or found, shells return exit code
126 or 127, respectively.  Valid run commands are allowed to return
these codes as well to indicate bad revisions, though, for historical
reasons.  This means typos can cause bogus bisect runs that go over the
full distance and end up reporting invalid results.

The best solution would be to reserve exit codes 126 and 127, like
71b0251cdd (Bisect run: "skip" current commit if script exit code is
125., 2007-10-26) did for 125, and abort bisect run when we get them.
That might be inconvenient for those who relied on the documentation
stating that 126 and 127 can be used for bad revisions, though.

The workaround used by this patch is to run the command on a known-good
revision and abort if we still get the same error code.  This adds one
step to runs with scripts that use exit codes 126 and 127, but keeps
them supported, with one exception: It won't work with commands that
cannot recognize the (manually marked) known-good revision as such.

Run commands that use low exit codes are unaffected.  Typos are reported
after executing the missing command twice and three checkouts (the first
step, the known good revision and back to the revision of the first
step).

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bisect: combine args passed to find_bisection()</title>
<updated>2020-08-07T22:13:03Z</updated>
<author>
<name>Aaron Lipman</name>
<email>alipman88@gmail.com</email>
</author>
<published>2020-08-07T21:58:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ad464a4e84b502fdfd4671f1c443060c7e87113f'/>
<id>urn:sha1:ad464a4e84b502fdfd4671f1c443060c7e87113f</id>
<content type='text'>
Now that find_bisection() accepts multiple boolean arguments, these may
be combined into a single unsigned integer in order to declutter some of
the code in bisect.c

Also, rename the existing "flags" bitfield to "commit_flags", to
explicitly differentiate it from the new "bisect_flags" bitfield.

Based-on-patch-by: Harald Nordgren &lt;haraldnordgren@gmail.com&gt;
Signed-off-by: Aaron Lipman &lt;alipman88@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cmd_bisect__helper: defer parsing no-checkout flag</title>
<updated>2020-08-07T22:13:03Z</updated>
<author>
<name>Aaron Lipman</name>
<email>alipman88@gmail.com</email>
</author>
<published>2020-08-07T21:58:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=be5fe2000df5c1110d8086e4704e1a90a64f7387'/>
<id>urn:sha1:be5fe2000df5c1110d8086e4704e1a90a64f7387</id>
<content type='text'>
cmd_bisect__helper() is intended as a temporary shim layer serving as an
interface for git-bisect.sh. This function and git-bisect.sh should
eventually be replaced by a C implementation, cmd_bisect(), serving as
an entrypoint for all "git bisect ..." shell commands: cmd_bisect() will
only parse the first token following "git bisect", and dispatch the
remaining args to the appropriate function ["bisect_start()",
"bisect_next()", etc.].

Thus, cmd_bisect__helper() should not be responsible for parsing flags
like --no-checkout. Instead, let the --no-checkout flag remain in the
argv array, so it may be evaluated alongside the other options already
parsed by bisect_start().

Signed-off-by: Aaron Lipman &lt;alipman88@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rev-list: allow bisect and first-parent flags</title>
<updated>2020-08-07T22:11:59Z</updated>
<author>
<name>Aaron Lipman</name>
<email>alipman88@gmail.com</email>
</author>
<published>2020-08-07T21:58:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0fe305a5d342225976688b1bd68dc4dc179b66b3'/>
<id>urn:sha1:0fe305a5d342225976688b1bd68dc4dc179b66b3</id>
<content type='text'>
Add first_parent_only parameter to find_bisection(), removing the
barrier that prevented combining the --bisect and --first-parent flags
when using git rev-list

Based-on-patch-by: Tiago Botelho &lt;tiagonbotelho@hotmail.com&gt;
Signed-off-by: Aaron Lipman &lt;alipman88@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bisect: libify `bisect_next_all`</title>
<updated>2020-02-19T17:37:15Z</updated>
<author>
<name>Pranit Bauva</name>
<email>pranit.bauva@gmail.com</email>
</author>
<published>2020-02-17T08:40:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6c69f2223394c200cce1289ac9200f781ef14da7'/>
<id>urn:sha1:6c69f2223394c200cce1289ac9200f781ef14da7</id>
<content type='text'>
Since we want to get rid of git-bisect.sh, it would be necessary to
convert those exit() calls to return statements so that errors can be
reported.

Emulate try catch in C by converting `exit(&lt;positive-value&gt;)` to
`return &lt;negative-value&gt;`. Follow POSIX conventions to return
&lt;negative-value&gt; to indicate error.

All the functions calling `bisect_next_all()` are already able to
handle return values from it.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Johannes Schindelin &lt;Johannes.Schindelin@gmx.de&gt;
Signed-off-by: Pranit Bauva &lt;pranit.bauva@gmail.com&gt;
Signed-off-by: Tanushree Tumane &lt;tanushreetumane@gmail.com&gt;
Signed-off-by: Miriam Rubio &lt;mirucam@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bisect: libify `handle_bad_merge_base` and its dependents</title>
<updated>2020-02-19T17:37:15Z</updated>
<author>
<name>Pranit Bauva</name>
<email>pranit.bauva@gmail.com</email>
</author>
<published>2020-02-17T08:40:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ec598e0d55ff263e47d95e7d4decef1eb1b6ac6'/>
<id>urn:sha1:9ec598e0d55ff263e47d95e7d4decef1eb1b6ac6</id>
<content type='text'>
Since we want to get rid of git-bisect.sh, it would be necessary to
convert those exit() calls to return statements so that errors can be
reported.

Emulate try catch in C by converting `exit(&lt;positive-value&gt;)` to
`return &lt;negative-value&gt;`. Follow POSIX conventions to return
&lt;negative-value&gt; to indicate error.

Update all callers to handle the error returns.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Johannes Schindelin &lt;Johannes.Schindelin@gmx.de&gt;
Signed-off-by: Pranit Bauva &lt;pranit.bauva@gmail.com&gt;
Signed-off-by: Tanushree Tumane &lt;tanushreetumane@gmail.com&gt;
Signed-off-by: Miriam Rubio &lt;mirucam@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>bisect: libify `check_merge_bases` and its dependents</title>
<updated>2020-02-19T17:37:14Z</updated>
<author>
<name>Pranit Bauva</name>
<email>pranit.bauva@gmail.com</email>
</author>
<published>2020-02-17T08:40:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cdd4dc2d6a3e420178100efc780a987495a1a3bd'/>
<id>urn:sha1:cdd4dc2d6a3e420178100efc780a987495a1a3bd</id>
<content type='text'>
Since we want to get rid of git-bisect.sh, it would be necessary to
convert those exit() calls to return statements so that errors can be
reported.

Emulate try catch in C by converting `exit(&lt;positive-value&gt;)` to
`return &lt;negative-value&gt;`. Follow POSIX conventions to return
&lt;negative-value&gt; to indicate error.

In `check_merge_bases()` there is an early success special case,
so we have introduced special error code
BISECT_INTERNAL_SUCCESS_MERGE_BASE (-11) which indicates early
success. This BISECT_INTERNAL_SUCCESS_MERGE_BASE is converted back
to BISECT_OK (0) in `check_good_are_ancestors_of_bad()`.

Update all callers to handle the error returns.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored by: Johannes Schindelin &lt;Johannes.Schindelin@gmx.de&gt;
Signed-off-by: Pranit Bauva &lt;pranit.bauva@gmail.com&gt;
Signed-off-by: Tanushree Tumane &lt;tanushreetumane@gmail.com&gt;
Signed-off-by: Miriam Rubio &lt;mirucam@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
