From: Erik Johnson <palehose@gmail.com>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Git mailing list <git@vger.kernel.org>
Subject: Re: git branch doesn't allow me to forcibly delete branch which was checked out in a now-deleted worktree dir
Date: Sat, 9 Jul 2016 00:05:00 -0500 [thread overview]
Message-ID: <20160709050500.GD1916@gmail.com> (raw)
In-Reply-To: <CA+P7+xoLKmUaJ9f1obVVDyjBTBe=XvSACvL8uiJWYf+2MTMN8w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]
On Fri, Jul 08, 2016 at 09:58:26PM -0700, Jacob Keller wrote:
>On Fri, Jul 8, 2016 at 7:22 PM, Erik Johnson <palehose@gmail.com> wrote:
>> On Fri, Jul 08, 2016 at 05:41:17PM -0700, Jacob Keller wrote:
>>> It is possible we should update "git branch -d" should perform a
>>> worktree prune first, since that would enable it to determine that you
>>> deleted the directory, and any worktree which is removable should be
>>> marked as persistent.
>>>
>>> Given that there is a known workaround (git worktree prune) and that
>>> it is expected behavior for a branch checked out to prevent deletion,
>>> I think the best coarse of action would be to patch git branch -d to
>>> do a prune before attempting to delete.
>>>
>>> Thanks,
>>> Jake
>>
>>
>> Well, I never mentioned -d (I was using -D), but I think we're both in
>> agreement.
>>
>>
>
>Out of curiosity, what is git branch -D behavior when the worktree does exist?
>
>Thanks,
>Jake
It works the same irrespective of whether or not the directory exists:
% git worktree add ../foo
Preparing ../foo (identifier foo)
HEAD is now at 91e095b Merge pull request #34429 from terminalmage/pkg-latest-versioncheck
% git branch -D foo
error: Cannot delete branch 'foo' checked out at '/home/erik/git/salt/foo'
% rm -rf /home/erik/git/salt/foo
% git branch -D foo
error: Cannot delete branch 'foo' checked out at '/home/erik/git/salt/foo'
% git worktree prune -v
Removing worktrees/foo: gitdir file points to non-existent location
% git branch -D foo
Deleted branch foo (was 91e095b).
--
-Erik
"For me, it is far better to grasp the universe as it really is than to
persist in delusion, however satisfying and reassuring." --Carl Sagan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2016-07-09 5:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-07 18:44 git branch doesn't allow me to forcibly delete branch which was checked out in a now-deleted worktree dir Erik Johnson
2016-07-07 23:39 ` Jacob Keller
2016-07-08 0:36 ` Erik Johnson
2016-07-09 0:41 ` Jacob Keller
2016-07-09 2:22 ` Erik Johnson
2016-07-09 4:58 ` Jacob Keller
2016-07-09 5:05 ` Erik Johnson [this message]
2016-07-09 5:33 ` 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=20160709050500.GD1916@gmail.com \
--to=palehose@gmail.com \
--cc=git@vger.kernel.org \
--cc=jacob.keller@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.