From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: frank kulow <kulow.f@googlemail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: "git branch -f" corrupt other worktree
Date: Thu, 02 May 2019 14:51:18 +0200 [thread overview]
Message-ID: <87d0l1qat5.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <CACsJy8CJ_PB+QKp-T-yTHNPYgjEEVN39QbnAu4kKzGGcEQ0ezA@mail.gmail.com>
On Thu, May 02 2019, Duy Nguyen wrote:
> On Thu, May 2, 2019 at 6:59 PM frank kulow <kulow.f@googlemail.com> wrote:
>>
>> git version 2.21.0.windows.1
>>
>> > /c/tmp/gt (Branch_702091a0)
>> $ git worktree add ../wt master
>> Preparing worktree (checking out 'master')
>> HEAD is now at f534c32 4
>>
>> > /c/tmp/gt (Branch_702091a0)
>> $ git branch -D master
>> error: Cannot delete branch 'master' checked out at 'C:/tmp/wt'
>>
>> #but this is possible:
>>
>> > /c/tmp/gt (Branch_702091a0)
>> $ git branch -f master HEAD
>
> I admit I didn't see this. But I don't know how far we would go
> protecting other worktrees. You give --force and that usually means
> "Yes I know what I'm doing, don't stop me". If --force rejects in this
> case, what would be the real force, --force --force maybe, or fall
> back to "git update-ref"?
>
>>
>> #and the other worktree is now corrupted:
>>
>> > /c/tmp/wt (master)
>> $ git status
>> On branch master
>> Changes to be committed:
>> (use "git reset HEAD <file>..." to unstage)
>>
>> modified: txt.txt
>> deleted: txtb.txt
>>
>>
>>
>> greetings f.kulow
Part of this is "doctor, it hurts when I stab my eye" :) but I wonder in
general whether users are more likely to expect different worktrees to
have different views of the refstore, since they way they're created is
"I want just this branch over there".
I.e. whether they want something closer to another directory with
"alternates" pointing to the "main" repo, and whether that should be
promoted to UI that's easier to set up than it is now.
Or maybe something in-between, where they'd expect remote tracking refs
to update for everything, but a worktree's "master" branch not to be
touchable by a worktree on "topic".
next prev parent reply other threads:[~2019-05-02 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-02 11:58 "git branch -f" corrupt other worktree frank kulow
2019-05-02 12:29 ` Duy Nguyen
2019-05-02 12:51 ` Ævar Arnfjörð Bjarmason [this message]
2019-05-02 13:05 ` Duy Nguyen
2019-05-02 13:49 ` Duy Nguyen
2019-05-02 17:16 ` Duy Nguyen
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=87d0l1qat5.fsf@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=kulow.f@googlemail.com \
--cc=pclouds@gmail.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).