git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Anders Kaseorg <andersk@mit.edu>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Andreas Heiduk <andreas.heiduk@mathema.de>
Subject: Re: [PATCH v2] fetch: Protect branches checked out in all worktrees
Date: Mon, 8 Nov 2021 12:12:17 -0800	[thread overview]
Message-ID: <2e925989-d435-0355-d26d-e79a0a99929f@mit.edu> (raw)
In-Reply-To: <YYUbQqyYQDD5QEAz@coredump.intra.peff.net>

On 11/5/21 04:53, Jeff King wrote:
> +			       wt->is_current ?
> +			       _("can't fetch in current branch") :
> +			       _("branch checked out in worktree"),

Sure, I’ll go ahead and add this.  We can make further improvements here 
if we proceed with removing the other error path, which seems to have 
enough complications that we should consider it after merging this bug fix.

> Hmm. That is the same check that is on the fetch side, isn't it? In a
> bare repository, we will not do any of these current-branch checks. What
> is weird in your example is that you are adding a worktree to a bare
> repository. Is that a supported workflow? Should that make it non-bare?
> 
> I notice that there is a worktree->is_bare flag, and that
> find_shared_symref() would not report such a bare entry to us. But I'm
> really unclear how any of that is supposed to work (how do you have a
> bare worktree, and what does it mean?).

worktree->is_bare is only ever potentially set for the main working tree 
(.git/..).  Although a bare repository doesn’t have a main working tree, 
it can still have other working trees created with git worktree.  Making 
a temporary working tree can be useful to quickly inspect or change a 
bare repository.  It’s also useful for sharing refs, remotes, and object 
storage between several working trees where any of them might be created 
or deleted, and there isn’t one that should be considered primary.

The Zulip installer works this way to save some disk space and 
re-cloning time while allowing for simple rollbacks to a previous 
deployment directory (https://github.com/zulip/zulip/pull/18487), which 
is how my team stumbled on the issue.

> I think that's all orthogonal to the main purpose of your patch here.
> You may want to post about it separately with a different subject to get
> the attention of folks who work on worktrees.

I expect this subject line will have already caught the attention of 
those folks, but I’ll add a patch 2/2 with a more specific subject line 
for this issue.

Anders

      parent reply	other threads:[~2021-11-08 20:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 21:05 [PATCH] fetch: Protect branches checked out in all worktrees Anders Kaseorg
2021-11-04 21:10 ` [PATCH v2] " Anders Kaseorg
2021-11-05  8:38   ` Jeff King
2021-11-05 10:01     ` Anders Kaseorg
2021-11-05 11:53       ` Jeff King
2021-11-05 18:39         ` Junio C Hamano
2021-11-08 20:12         ` Anders Kaseorg [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

  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=2e925989-d435-0355-d26d-e79a0a99929f@mit.edu \
    --to=andersk@mit.edu \
    --cc=andreas.heiduk@mathema.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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).