git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shejialuo <shejialuo@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Caleb White <cdwhite3@pm.me>, git@vger.kernel.org
Subject: Re: [PATCH v2 0/3] Ensure unique worktree ids across repositories
Date: Tue, 3 Dec 2024 09:24:54 +0800	[thread overview]
Message-ID: <Z05d5pjvcIyJsAeG@ArchLinux> (raw)
In-Reply-To: <xmqqed2pioff.fsf@gitster.g>

On Tue, Dec 03, 2024 at 09:46:12AM +0900, Junio C Hamano wrote:
> shejialuo <shejialuo@gmail.com> writes:
> 
> > But cross-ref operations between worktrees must explicitly specify the
> > worktree id, so I am wondering whether we should allow the user do
> > cross-ref operations in the first place:
> >
> >   1. main worktree symref points to linked worktree ref.
> >   2. A linked worktree ref points to another linked worktree ref.
> 
> What is a cross-ref operation?  A worktree is either the primary
> working tree for a (non-bare) repository, or something added with
> "git add worktree" (i.e. whose .git is not the repository but a
> link file into the real repository).  Are you adding another mode
> where a worktree points at another worktree and not the repository?

I am sorry that my words may confuse you here. And the Eric has already
explained what I mean here. At current, we have the ability to mention
a ref another worktree within the current worktree. You also have tole
me that in [1], there is a possibility that the user could create a
symbolic link to some worktree-specific ref in another worktree.

So, if our intention is to deliberately hide the worktree id. Why we
allow such ability? Let me give an example.

If we are in the main-worktree, and we want to access the worktree
specified refs, we must specify the worktree id like the following
(also if we are in the linked-worktree, we want to access another
linked-worktree refs):

    worktrees/<worktree id>/refs/worktree/foo

We do not want to the user know the worktree id. However, we allow
above. This is something I feel really strange during the review
process. To the front-end user, the worktree path is the interface.
However, for above ability, we need the user to explicitly specify the
worktree id.

From my perspective, this is not a good design which is against our
design.

[1] https://lore.kernel.org/git/xmqq5xqn8w6r.fsf@gitster.g/

      parent reply	other threads:[~2024-12-03  1:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-29 22:37 [PATCH v2 0/3] Ensure unique worktree ids across repositories Caleb White
2024-11-29 22:37 ` [PATCH v2 1/3] worktree: add worktree with unique suffix Caleb White
2024-11-29 22:37 ` [PATCH v2 2/3] worktree: rename worktree id during worktree move Caleb White
2024-11-29 22:37 ` [PATCH v2 3/3] worktree: add id to `worktree list` output Caleb White
2024-11-29 22:54 ` [PATCH v2 0/3] Ensure unique worktree ids across repositories rsbecker
2024-11-29 23:13   ` Caleb White
2024-11-29 23:17     ` rsbecker
2024-11-29 23:29       ` Caleb White
2024-11-29 23:44         ` rsbecker
2024-11-30  0:08           ` Caleb White
2024-11-30  0:38             ` rsbecker
2024-11-30 16:08               ` Caleb White
2024-11-30 17:16                 ` rsbecker
2024-12-02  2:00 ` Junio C Hamano
2024-12-02 11:46   ` shejialuo
2024-12-03  0:46     ` Junio C Hamano
2024-12-03  0:56       ` Eric Sunshine
2024-12-03  1:46         ` Junio C Hamano
2024-12-03  1:53           ` rsbecker
2024-12-03  2:30             ` Junio C Hamano
2024-12-03  3:42               ` Caleb White
2024-12-03  4:37                 ` Junio C Hamano
2024-12-03  5:31                   ` Caleb White
2024-12-03  1:24       ` shejialuo [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=Z05d5pjvcIyJsAeG@ArchLinux \
    --to=shejialuo@gmail.com \
    --cc=cdwhite3@pm.me \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).