Web lists-archives.com

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

Duy Nguyen <pclouds@xxxxxxxxx> writes:

>> 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.