From: Eric Sunshine <sunshine@sunshineco.com>
To: "Rubén Justo" <rjusto@gmail.com>
Cc: Git List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v2] bisect: fix "reset" when branch is checked out elsewhere
Date: Tue, 14 Feb 2023 23:52:08 -0500 [thread overview]
Message-ID: <CAPig+cQPVMKui=AiXBHEfNWY5e4fMbxixdnzvZmXsSkW9ZMLyg@mail.gmail.com> (raw)
In-Reply-To: <ada28944-6e9e-d4e7-74c9-ffadaf406e1f@gmail.com>
On Sat, Feb 4, 2023 at 6:02 PM Rubén Justo <rjusto@gmail.com> wrote:
> Since 1d0fa89 (checkout: add --ignore-other-wortrees, 2015-01-03) we
> have a safety valve in checkout/switch to prevent the same branch from
> being checked out simultaneously in multiple worktrees.
>
> If a branch is bisected in a worktree while also being checked out in
> another worktree; when the bisection is finished, checking out the
> branch back in the current worktree may fail.
>
> Let's teach bisect to use the "--ignore-other-worktrees" flag.
>
> Signed-off-by: Rubén Justo <rjusto@gmail.com>
> ---
> diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
> @@ -122,6 +122,29 @@ test_expect_success 'bisect start without -- takes unknown arg as pathspec' '
> +test_expect_success 'bisect reset: back in a branch checked out also elsewhere' '
> + echo "shared" > branch.expect &&
> + test_bisect_reset() {
> + git -C $1 bisect start &&
> + git -C $1 bisect good $HASH1 &&
> + git -C $1 bisect bad $HASH3 &&
> + git -C $1 bisect reset &&
> + git -C $1 branch --show-current > branch.output &&
> + cmp branch.expect branch.output
> + } &&
> + test_when_finished "
> + git worktree remove wt1 &&
> + git worktree remove wt2 &&
> + git branch -d shared
> + " &&
As mentioned in my review[1] of one of your other patches, &&-chaining
within the argument to test_when_finished() is probably undesirable in
this case since failure of any cleanup command would cause
test_when_finish() to fail, which would cause the test to fail
overall.
[1]: https://lore.kernel.org/git/CAPig+cQpizjmhmDKb=HPrcYqqRq7JpvC-NZvY7B9eBbG+NrfKw@mail.gmail.com/
> + git worktree add wt1 -b shared &&
> + git worktree add wt2 -f shared &&
> + # we test in both worktrees to ensure that works
> + # as expected with "first" and "next" worktrees
> + test_bisect_reset wt1 &&
> + test_bisect_reset wt2
> +'
next prev parent reply other threads:[~2023-02-15 4:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-22 1:38 [PATCH] bisect: fix "reset" when branch is checked out elsewhere Rubén Justo
2023-01-23 2:01 ` Junio C Hamano
2023-01-26 2:18 ` Rubén Justo
2023-01-26 17:06 ` Junio C Hamano
2023-01-26 17:13 ` Junio C Hamano
2023-02-04 22:46 ` Rubén Justo
2023-02-06 19:04 ` Junio C Hamano
2023-02-04 22:57 ` [PATCH v2] " Rubén Justo
2023-02-06 22:29 ` Junio C Hamano
2023-02-08 0:30 ` Rubén Justo
2023-02-08 5:16 ` Junio C Hamano
2023-02-08 21:54 ` Rubén Justo
2023-02-15 4:52 ` Eric Sunshine [this message]
2023-02-15 22:20 ` Rubén Justo
2023-02-20 22:53 ` [PATCH v3] " Rubén Justo
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cQPVMKui=AiXBHEfNWY5e4fMbxixdnzvZmXsSkW9ZMLyg@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=rjusto@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).