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

Re: What's cooking in git.git (Feb 2024, #02; Fri, 2)

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Feb 6, 2024, 13:56 UTC
Message-ID
<a94a5ddf-c36f-4125-96b4-a4534b67d762@gmail.com>
In-Reply-To
<xmqqjznimrbe.fsf@gitster.g>
Hi Junio
On 05/02/2024 23:20, Junio C Hamano wrote:
Show 21 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> I'm concerned that the UI could use some improvement. If I understand
>> correctly the proposal is to make
>>
>> 	git for-each-ref
>>
>> and
>>
>> 	git for-each-ref ""
>>
>> behave differently so that the latter prints the pseudorefs from the
>> current worktree and the former does not.
> 
> I would actually think that is perfectly sensible.  The optional
> arguments for-each-ref name "filtering patterns" and you can view
> the behaviour of the command as using "refs/" as the default
> filtering pattern when nothing is given.  But it is easy to defeat
> the unfortunate and historical default filtering pattern, by saying
> "we do not limit to any hierarchy, anything goes" by giving "" as
> the prefix.

There is a logic to that if one ignores "refs/{main-worktree,worktrees/$worktree}/*" not being shown. As Patrick has pointed out the change in the handling of the empty prefix here is a breaking change though [1]. To me, the handling of the empty prefix feels inconsistent with the rest of the pattern space. The patterns "*" and "*_HEAD" don't match anything and there is no way to filter a subset of pseudorefs. If all we want is a way to show all the refs including pseudorefs in a worktree then I think an option to do that which errored out if a pattern is given would be a better approach. I'd prefer an option (say "--include-pseudorefs") that included pseudorefs in the list of refs to be filtered and allowed the user to filter them as they wanted. That way we could later add a "--all-worktrees" option that included refs/{main-worktree,worktrees/$worktree} in the list of refs to be filtered as well.

Best Wishes
Phillip
[1] https://lore.kernel.org/git/ZcHEmyvvMR_b_Idl@tanuki/
Previous: Junio C HamanoNext: Taylor Blau
Message 4 of 5 in “What's cooking in git.git (Feb 2024, #02; Fri, 2)”
  1. Junio C HamanoFeb 3, 2024
  2. Phillip WoodFeb 5, 2024
  3. Junio C HamanoFeb 5, 2024
  4. Phillip WoodFeb 6, 2024
  5. Taylor BlauFeb 5, 2024

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.