From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Edmundo Carmona Antoranz <eantoranz@gmail.com>, git@vger.kernel.org
Subject: Re: [RFC PATCH] status: avoid reporting worktrees as "Untracked files"
Date: Mon, 13 Nov 2023 08:52:34 +0900 [thread overview]
Message-ID: <xmqqjzqmmsvx.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cQbwcJOQiYyb7bma3pH1hxjE_X_yeAp3JeHWVCeJtySfQ@mail.gmail.com> (Eric Sunshine's message of "Sun, 12 Nov 2023 12:13:59 -0500")
Eric Sunshine <sunshine@sunshineco.com> writes:
> I doubt you're the only one, but, based upon, list emails over the
> years, it seems that both in-main-tree and outside-main-tree (often
> sibling) worktrees are common. More recently, we've also heard from
> people who don't even have a main-worktree; instead, they hang their
> multiple worktrees off of a bare repository (which is an
> explicitly-supported use-case); i.e.:
>
> git clone --bare https://.../foobar.git
> git -C foobar.git worktree add worktree1
> git -C foobar.git worktree add worktree2
> ...
I am not sure why you brought in that layout in this discussion,
because it places worktree1 and worktree2 next to each other, just
like placing worktree1 and worktree2 next to the non-bare repository.
git clone https://.../foobar.git foobar
git -C foobar worktree add worktree1
git -C foobar worktree add worktree2
The layout to create worktrees attached to a bare repository and add
them next to each other, and the same starting from a non-bare
repository, share an important trait. They do not have an untracked
and untrackable "cruft" in their working tree, unlike the crazy
layout that places worktrees of the repository inside the working
tree of the primary worktree as untracked subdirectories.
Really, what is the advantage of doing so? It is not like the build
recipe recorded in the primary worktree can work recursively on
different branches that are checked out---worktree names and paths
at which they are checked out are totally local matter, and the
upstream project that supplies the build recipe would not know or
care.
Even worse, when the project wants to add a new subdirectory or a
file, the name chosen for the subdirectory may happen to collide
with the name of an untracked subdirectory you happened to have used
(again, because the worktree names and locations are totally local
matter, the upstream project are unaware of them and cannot avoid
such name clashes even if they cared). You can imagine the
confusion that happens to your next "git pull".
Compared to such an insanity, attaching worktrees to a bare
repository, so that all worktrees are equals and there is no
"primary" worktree that you cannot remove, behave just as normal as
a set of worktrees attached to a non-bare repository and sit outside
the primary worktree, often as immediate siblings.
prev parent reply other threads:[~2023-11-12 23:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-04 0:02 [RFC PATCH] status: avoid reporting worktrees as "Untracked files" Edmundo Carmona Antoranz
2023-11-04 6:15 ` Eric Sunshine
2023-11-04 6:58 ` Junio C Hamano
2023-11-11 9:22 ` Edmundo Carmona Antoranz
2023-11-12 17:13 ` Eric Sunshine
2023-11-12 23:52 ` 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=xmqqjzqmmsvx.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=eantoranz@gmail.com \
--cc=git@vger.kernel.org \
--cc=sunshine@sunshineco.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).