Re: [PATCH 24/34] checkout: reject if the branch is already checked out elsewhere
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Dec 2, 2014, 12:01 UTC
- Message-ID
- <CACsJy8DjbgNpbf9Z-OVCpv+YNmvsuHfcPW_Jfm3_gbq2VgYgkQ@mail.gmail.com>
- In-Reply-To
- <547D487B.4040502@gmail.com>
On Tue, Dec 2, 2014 at 12:04 PM, Mark Levedahl <mlevedahl@gmail.com> wrote:
Show 22 quoted lines
> On 12/01/2014 12:39 PM, Junio C Hamano wrote:
>>
>> Sorry, what is a hic? If this were an existing feature like
>> git-new-workdir, even though it is from contrib, making it impossible to do
>> something that used to be possible, even if that something is what mere
>> mortals would never want to to to avoid risking confusion, would be a
>> regression that needs an escape hatch. But this is a new feature. I am not
>> sure why you need to make this overridable in the first place. Those who
>> want to have multiple checkouts of the same commit can just detach HEAD at
>> the same commit in multiple working trees, as the first thing they need to
>> do would be to run "git reset --hard $branch" to synchronize the HEAD and
>> the working tree state to work in the other out-of-sync repositories either
>> case anyway.
>
>
> Yes, detached HEADS allow multiple checkouts, but now the user needs another
> system to record what $branch was for each checked out tree or needs to
> resort to forensics using various git-branch / git-log invocations to find
> the most-likely value. So, I do not find detached HEADS useful in general,
> and specifically not for this case. Duy's latest addition
> ('--ignore-other-worktrees') would, so far as I see, allow this feature to
> replace git-new-workdir in my uses, but without the addition it cannot.I'm ok either way. So I'll let you and Junio (and maybe others) sort this out. No objection means --ignore-other-worktrees is in.
FWIW git-branch usually can show the original branch of detached head (must not always). I don't think we have a plumbing equivalent for it though. People can "tail -1 $GIT_DIR/logs/HEAD| sed .." but that seems hacky. I do like "read-only" ref concept where we can keep ref name (especially tags) in HEAD until the next commit. But it didn't go anywhere
-- Duy