From: Nguyen Thai Ngoc Duy Date: Wed, 05 Oct 2011 22:38:52 GMT Subject: Re: [RFC/PATCH] Add multiple workdir support to branch/checkout Message-ID: In-Reply-To: <7vpqib8jzk.fsf@alter.siamese.dyndns.org> On Thu, Oct 6, 2011 at 3:46 AM, Junio C Hamano wrote: > Jay Soffian writes: > >> On Wed, Oct 5, 2011 at 12:02 AM, Nguyen Thai Ngoc Duy wrote: >>> 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..checkout, I would have something like >>> branch..locked = , where is just a string. Only >>> commands that provide the matching are allowed to update the >>> branch. In checkout case, could be "checkout: worktree". >> >> In this case, each workdir needs its own key, so I'd have to record >> the key somewhere, unless you meant using a key of "checkout: >> ". > > That actually is how I read his message. That's what I meant. > I think "switch_branches()" that updates HEAD to point at a local branch > is one good place to lock the branch, but I do not know if it is a good > idea to hook the check into the codepaths for deletion of the branch using > "branch -[dD]" and check-out of the branch using "checkout $branch". I > wonder if it makes sense to add the "checking" hook into much lower level > in the callchain, perhaps delete_ref(), rename_ref() and update_ref() to > catch attempts to update "your" current branch by other people. I'd aim at low-level ref manipulation because too me it affects more than just "git checkout". > For that > matter, instead of switch_branches(), would it make more sense to add this > lock/unlock logic to symbolic_ref() that repoints HEAD to other branch? Couldn't find symbolic_ref() in current code. If you meant create_symref(), yes that would make sense. -- Duy