git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Austin Morton <austin.morton@aquatic.com>
Cc: git@vger.kernel.org
Subject: Re: Able to checkout same branch in multiple worktrees when using symbolic-refs
Date: Mon, 02 May 2022 11:30:38 -0700	[thread overview]
Message-ID: <xmqq7d73zt0x.fsf@gitster.g> (raw)
In-Reply-To: <CAAir=1NY=98Z_cTrEyUn6tcPFR3UGNUmXs=2hg27LMGijGZpUw@mail.gmail.com> (Austin Morton's message of "Mon, 2 May 2022 14:54:33 +0000")

Austin Morton <austin.morton@aquatic.com> writes:

[jc: swapped the blocks to chronological order, and trimmed parts
that are not relevant to this reply].

> On Fri, Apr 29, 2022 at 8:19 PM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Austin Morton <austin.morton@aquatic.com> writes:
>>
>> I also suspect there is no way, other than scanning _all_ the local
>> branches, to see if some other branch aliases the branch we are
>> about to check out.  It may potentially be somewhat expensive.
>
> I don't know why you would need to scan all the local branches, unless
> that is what "git worktree list" ends up doing under the hood?
> ...
> Seems like you would "just" need to resolve the symbolic-ref in the
> same way that the worktree code does when checking against existing
> worktrees in find_shared_symref during checkout.

Yeah, you're right.

You would scan all the worktrees instead of asking all the
local branches "Are you a symlink that points at a branch I am about
to check out?  If so, yell loudly to stop me."

>> But it would be nice if it can get fixed in inexpensively.
>>
>> Thanks for a report.

So, yeah, it may be doable to fix it inexpensively.

Patches welcome ;-)

Thanks.

      reply	other threads:[~2022-05-02 18:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29 19:05 Able to checkout same branch in multiple worktrees when using symbolic-refs Austin Morton
2022-04-29 20:19 ` Junio C Hamano
2022-05-02 14:54   ` Austin Morton
2022-05-02 18:30     ` Junio C Hamano [this message]

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=xmqq7d73zt0x.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=austin.morton@aquatic.com \
    --cc=git@vger.kernel.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 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 NNTP newsgroup(s).