git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Allred <allred.sean@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: git@vger.kernel.org
Subject: Re: Bug report - Can create worktrees from bare repo / such worktrees can fool is_bare_repository()
Date: Sun, 19 Dec 2021 14:46:59 -0600	[thread overview]
Message-ID: <CABceR4YVd4remACJkxwSCTSYB2v3Zn1BsjKHbzeve8uHiZv1pA@mail.gmail.com> (raw)
In-Reply-To: <e992d4b4-f9e2-a8f9-22da-e9d342c7bede@sunshineco.com>

> However, you missed the step (discussed in [1]) in which it is your
> responsibility to move the `core.bare=true` setting from
> git.git/config to git.git/worktree.config manually after setting
> `extensions.worktreeconfig=true`.

Ahh, that makes sense!  I did notice the `core.bare` setting being
respected in source and figured this had a part to play (which is why
I included git-config output).

I think then that I was overzealous in trying to MWE-ify the issue: as
I noted, I found this issue when I was trying to perform a
sparse-checkout within the worktree.  To memory (I don't have my work
system at the moment and don't have its `history`), I think it went
something like this:

    git worktree add --no-checkout ../next && cd ../next
    git sparse-checkout init --cone # auto-created a worktree config
    git sparse-checkout set t

I think either the git-sparse-checkout-set command (or the
git-checkout I ran after) would fail complaining that I was not in a
worktree.  Based on the above, it sounds like `init` is creating the
worktree-specific config, but is not overriding `core.bare` in that
config.  Would a patch to take this step this automatically be
well-received?  I see two options for when to set `core.bare=false` in
worktree-specific config:

  1. At git-worktree-add: This is probably the earliest time which
     makes sense, but may be over-reach.  I'm not up-to-speed on how
     worktree-specific configs are generally considered on this list.
     If I were implementing a workaround, though, this is probably
     where I'd make it.

  2. At git-sparse-checkout-init: This is where the problem begins to
     have an effect, so this might also make sense.

I'm glad to learn about bare repositories + worktrees being a
supported use-case :-)

  reply	other threads:[~2021-12-19 20:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-18 16:46 Bug report - Can create worktrees from bare repo / such worktrees can fool is_bare_repository() Sean Allred
2021-12-18 17:47 ` rsbecker
2021-12-18 19:00   ` Sean Allred
2021-12-18 21:55     ` rsbecker
2021-12-19 20:16 ` Eric Sunshine
2021-12-19 20:46   ` Sean Allred [this message]
2021-12-19 21:32     ` rsbecker
2021-12-19 22:23       ` Sean Allred
2021-12-19 22:51         ` rsbecker
2021-12-19 23:30           ` Eric Sunshine
2021-12-19 23:45             ` Eric Sunshine
2021-12-19 23:54             ` rsbecker
2021-12-20  0:07               ` Eric Sunshine
2021-12-20  0:58     ` Eric Sunshine
2021-12-20 14:11       ` Derrick Stolee
2021-12-20 15:58         ` Eric Sunshine
2021-12-20 17:29           ` Derrick Stolee
2021-12-20 21:58             ` Eric Sunshine
2021-12-20 16:20         ` Junio C Hamano

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=CABceR4YVd4remACJkxwSCTSYB2v3Zn1BsjKHbzeve8uHiZv1pA@mail.gmail.com \
    --to=allred.sean@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).