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

Re: [PATCH] sha1-name.c: for ":/", find detached HEAD commits

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 11, 2018, 17:20 UTC
Message-ID
<xmqqfu0p3czt.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CACsJy8CBJvpKAAtVjrdcuO06WossxcMmqwmSRL9Shr7g+qVySA@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 12 quoted lines
>> diff --git a/sha1-name.c b/sha1-name.c
>> index 60d9ef3c7..641ca12f9 100644
>> --- a/sha1-name.c
>> +++ b/sha1-name.c
>> @@ -1650,6 +1650,7 @@ static int get_oid_with_context_1(const char *name,
>>                         struct commit_list *list = NULL;
>>
>>                         for_each_ref(handle_one_ref, &list);
>> +                       head_ref(handle_one_ref, &list);
>
> When multiple worktrees are used, should we consider all HEADs or just
> current worktree's HEAD?

Does for_each_ref() iterate over per-worktree refs (like "bisect", perhaps)? If so, then looking in different worktree's HEADs would make sense, and otherwise not.

I would think that the whole point of detaching HEAD in a separate worktree is that you can avoid exposing the work you do while detached to other worktrees by doing so, so from that point of view, I would probably prefer :/ not to look into other worktrees, but that is not a very strong preference. If peeking all over the place is easier to implement, then a minor information leaking is not something I'd lose sleep over.

Thanks for bringing up an interesting issue.
Previous: Jeff KingNext: Duy Nguyen
Message 9 of 19 in “sha1-name.c: for ":/", find detached HEAD commits”
  1. sha1-name.c: for ":/", find detached HEAD commitsWilliam Chargin, Jul 10, 2018
  2. Jeff KingJul 10, 2018
  3. Junio C HamanoJul 10, 2018
  4. William CharginJul 11, 2018
  5. Jeff KingJul 11, 2018
  6. Junio C HamanoJul 11, 2018
  7. Duy NguyenJul 11, 2018
  8. Jeff KingJul 11, 2018
  9. Junio C HamanoJul 11, 2018
  10. Duy NguyenJul 11, 2018
  11. William CharginJul 11, 2018
  12. sha1-name.c: for ":/", find detached HEAD commitsWilliam Chargin, Jul 12, 2018
  13. Jeff KingJul 12, 2018
  14. Junio C HamanoJul 12, 2018
  15. William CharginJul 12, 2018
  16. Junio C HamanoJul 12, 2018
  17. William CharginJul 12, 2018
  18. Jeff KingJul 13, 2018
  19. William CharginJul 13, 2018

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.