git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Oct 5, 2011, 22:38 UTC
Message-ID
<CACsJy8D9xgLtYTkgWWkiuQPbonfM7zY49WDxaW9ng=e7x_Pk5g@mail.gmail.com>
In-Reply-To
<7vpqib8jzk.fsf@alter.siamese.dyndns.org>
On Thu, Oct 6, 2011 at 3:46 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
> Jay Soffian <jaysoffian@gmail.com> writes:
>
>> On Wed, Oct 5, 2011 at 12:02 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> 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.<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".
>>
>> 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:
>> </path/to/workdir>".
>
> That actually is how I read his message.
That's what I meant.
Show 7 quoted lines
> 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
Previous: Jeff KingNext: Junio C Hamano
Message 31 of 35 in “Add multiple workdir support to branch/checkout”
  1. Add multiple workdir support to branch/checkoutJay Soffian, Oct 5, 2011
  2. Jay SoffianOct 5, 2011
  3. Nguyen Thai Ngoc DuyOct 5, 2011
  4. Jay SoffianOct 5, 2011
  5. Junio C HamanoOct 5, 2011
  6. Jay SoffianOct 5, 2011
  7. Junio C HamanoOct 5, 2011
  8. Jay SoffianOct 5, 2011
  9. Andreas KreyOct 5, 2011
  10. Jay SoffianOct 5, 2011
  11. Jonathan NiederOct 5, 2011
  12. Jay SoffianOct 5, 2011
  13. Jonathan NiederOct 5, 2011
  14. Junio C HamanoOct 5, 2011
  15. Jay SoffianOct 5, 2011
  16. Jay SoffianOct 5, 2011
  17. Nguyen Thai Ngoc DuyOct 5, 2011
  18. Junio C HamanoOct 5, 2011
  19. Nguyen Thai Ngoc DuyOct 5, 2011
  20. Junio C HamanoOct 5, 2011
  21. Jay SoffianOct 6, 2011
  22. Junio C HamanoOct 6, 2011
  23. Jay SoffianOct 6, 2011
  24. Junio C HamanoOct 6, 2011
  25. Jay SoffianOct 6, 2011
  26. Junio C HamanoOct 6, 2011
  27. Jay SoffianOct 6, 2011
  28. Nguyen Thai Ngoc DuyOct 6, 2011
  29. Bernhard R. LinkOct 6, 2011
  30. Jeff KingOct 6, 2011
  31. Nguyen Thai Ngoc DuyOct 5, 2011
  32. Junio C HamanoOct 5, 2011
  33. Jay SoffianOct 5, 2011
  34. Jay SoffianOct 5, 2011
  35. Julián LanderrecheOct 8, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.