Re: [RFC/PATCH] Add multiple workdir support to branch/checkout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 5, 2011 at 2:43 PM, Jay Soffian <jaysoffian@xxxxxxxxx> wrote:
> When using 'git new-workdir', there is no safety mechanism to prevent the
> same branch from being checked out twice, nor to prevent a checked out
> branch from being deleted.
>
> By teaching 'checkout' to record the workdir path using
> 'branch.<name>.checkout' when switching branches, we can easily check if a
> branch is already checked out in another workdir before switching to that
> branch. Similarly, we can now add a check before deleting a branch.
>
> Allow 'checkout -f' to force the checkout and issue a warning
> instead of an error.
>
> Guard this behavior behind 'core.recordCheckouts', which we will
> teach 'git new-workdir' to set in a followup commit.

I've wanted to to something like this, but you beat me to it ;)

Could you please consider a more generic approach? What I have in mind
is a mechanism to "lock" a branch, so that only commands that have the
key can update it.

So instead of branch.<name>.checkout, I would have something like
branch.<name>.locked = <key>, where <key> is just a string. Only
commands that provide the matching <key> are allowed to update the
branch. In checkout case, <key> could be "checkout: worktree".

This approach addresses more cases than just multiple workdir. We
could relax restrictions on pushing to a non-bare repository: we only
disallow pushing to locked branches. We can also use this to prevent
users from checking out another branch (by locking HEAD) while in the
middle of interactive rebase/bisect/...
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]