From: Junio C Hamano <gitster@pobox.com>
To: "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Sixt <j6t@kdbg.org>,
Harald Nordgren <haraldnordgren@gmail.com>
Subject: Re: [PATCH v4 2/2] bisect: add --reset-when-found to leave when done
Date: Sat, 01 Aug 2026 14:40:31 -0700 [thread overview]
Message-ID: <xmqqo6fl7c4w.fsf@gitster.g> (raw)
In-Reply-To: <xmqqwlu97h1k.fsf@gitster.g> (Junio C. Hamano's message of "Sat, 01 Aug 2026 12:54:31 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> The defer_reset arrangement looks somewhat ugly even though what it
> achieves may be a worthy thing to do. Is the only code path that
> passes defer_reset==true down the call chain the bisect_run()
> codepath, to give that single caller a chance to close files that
> bisect_reset() would remove by calling bisect_clean_state()?
>
> I am wondering if the result of solving it slightly differently may
> give us cleaner and easier to follow code, namely, we stop calling
> bisect_clean_state() from bisect_reset(). Of course you would need
> to find different place to call bisect_clean_state() to compensate,
> if we go that route, but how many code paths do we have that depends
> on bisect_reset() calling biesct_clean_state()?
Conceptually, what you want out of this new feature is:
Please run "git bisect <anything>" normally. Make sure you
notice when the command completed and found the culprit, And
when you notice it, run "git bisect reset" (or "git bisect reset
<oid-of-bad-commit>").
Stepping back even further, shouldn't this be doable *a* *lot*
simpler, given that existing code does not locally exit(0)?
Wouldn't it be the matter of
- Add --reset-when-finished option parsing to the main command and
the subcommands that want to parse it.
- Make sure all indivudual cmd_bisect__<subcommand> returns the
result code, instead of calling exit(), and the result code
includes those INTERNAL ones.
- Tweak bisect_next_all() to report the found commit when it
returns BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND. Perhaps
bisect_next() can leave it in a file-scope static variable.
- Instead of doing
return is_bisect_success(res) ? 0 : -res;
at the end of cmd_bisect(), if "--reset-when-finished" is in
effect, also react to BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND and
use the commit bisect_next() received from bisect_next_all() as
needed and do what bisect_reset() does. Presumably at that
point, files that are problematic on Windows would all already
been closed, right?
That way, almost all the changes needed to cmd_bisect__<subcommand>
and below will be pure clean-up changes.
Hmm?
next prev parent reply other threads:[~2026-08-01 21:40 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 5:35 [PATCH 0/3] bisect: add --auto-reset to leave when done Harald Nordgren via GitGitGadget
2026-07-16 5:35 ` [PATCH 1/3] bisect: read run output from the open descriptor Harald Nordgren via GitGitGadget
2026-07-16 5:35 ` [PATCH 2/3] bisect: let bisect_reset() optionally check out quietly Harald Nordgren via GitGitGadget
2026-07-16 5:35 ` [PATCH 3/3] bisect: add --auto-reset to leave when done Harald Nordgren via GitGitGadget
2026-07-16 17:22 ` Junio C Hamano
2026-07-16 21:22 ` Harald Nordgren
2026-07-17 5:00 ` Junio C Hamano
2026-07-17 9:16 ` Harald Nordgren
2026-07-17 16:43 ` Junio C Hamano
2026-07-17 18:27 ` [PATCH v2 0/3] " Harald Nordgren via GitGitGadget
2026-07-17 18:27 ` [PATCH v2 1/3] bisect: read run output from the open descriptor Harald Nordgren via GitGitGadget
2026-07-17 22:42 ` Junio C Hamano
2026-07-18 16:24 ` Johannes Sixt
2026-07-17 18:27 ` [PATCH v2 2/3] bisect: let bisect_reset() optionally check out quietly Harald Nordgren via GitGitGadget
2026-07-17 18:27 ` [PATCH v2 3/3] bisect: add --auto-reset to leave when done Harald Nordgren via GitGitGadget
2026-07-18 16:18 ` Johannes Sixt
2026-07-20 1:14 ` Junio C Hamano
2026-07-20 9:10 ` [PATCH v3 0/2] " Harald Nordgren via GitGitGadget
2026-07-20 9:10 ` [PATCH v3 1/2] bisect: let bisect_reset() optionally check out quietly Harald Nordgren via GitGitGadget
2026-07-20 9:10 ` [PATCH v3 2/2] bisect: add --reset-when-found to leave when done Harald Nordgren via GitGitGadget
2026-07-23 9:17 ` Johannes Sixt
2026-07-23 14:27 ` Junio C Hamano
2026-08-01 6:51 ` Harald Nordgren
2026-07-20 17:20 ` [PATCH v3 0/2] bisect: add --auto-reset " Junio C Hamano
2026-08-01 9:44 ` [PATCH v4 0/2] bisect: add --reset-when-found " Harald Nordgren via GitGitGadget
2026-08-01 9:44 ` [PATCH v4 1/2] bisect: let bisect_reset() optionally check out quietly Harald Nordgren via GitGitGadget
2026-08-01 19:15 ` Junio C Hamano
2026-08-01 9:44 ` [PATCH v4 2/2] bisect: add --reset-when-found to leave when done Harald Nordgren via GitGitGadget
2026-08-01 19:54 ` Junio C Hamano
2026-08-01 21:40 ` Junio C Hamano [this message]
2026-08-02 9:31 ` [PATCH v5 0/2] " Harald Nordgren via GitGitGadget
2026-08-02 9:31 ` [PATCH v5 1/2] bisect: let bisect_reset() optionally check out quietly Harald Nordgren via GitGitGadget
2026-08-02 9:31 ` [PATCH v5 2/2] bisect: add --reset-when-found to leave when done Harald Nordgren via GitGitGadget
2026-08-02 16:01 ` [PATCH v5 0/2] " Junio C Hamano
2026-08-02 21:24 ` [PATCH v6 " Harald Nordgren via GitGitGadget
2026-08-02 21:24 ` [PATCH v6 1/2] bisect: let bisect_reset() optionally check out quietly Harald Nordgren via GitGitGadget
2026-08-02 21:24 ` [PATCH v6 2/2] bisect: add --reset-when-found to leave when done Harald Nordgren via GitGitGadget
2026-08-03 0:08 ` Junio C Hamano
2026-08-06 7:30 ` Harald Nordgren
2026-08-06 13:50 ` Junio C Hamano
2026-08-06 15:59 ` Harald Nordgren
2026-08-06 17:36 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqo6fl7c4w.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=haraldnordgren@gmail.com \
--cc=j6t@kdbg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.