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

Re: [PATCH v3] worktree: detect from secondary worktree if main worktree is bare

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 31, 2025, 20:20 UTC
Message-ID
<xmqq8qqq7n26.fsf@gitster.g>
In-Reply-To
<CAFLeGL52tKmurpAHymk42Y9DGazbK8nRdtWAoyzW85eMDxJQhQ@mail.gmail.com>
Olga Pilipenco <olga.pilipenco@shopify.com> writes:
Show 15 quoted lines
>> Perhaps the logic is clear to those who diagnosed the problem, wrote
>> the patch, and reviewed it, in which case there is no reason to
>> reroll.  Perhaps it was just me to whom it was not obvious that
>> the purpose of "is_current" check was not about "are we looking at
>> the main worktree" but was about "if we are not in the main worktree,
>> we need this extra check".
>>
>> Thanks.
>
> You did a great job figuring it out and I agree it's confusing at
> first, but we tried our best to make it less confusing.
> `is_current` check is actually not necessary there, but having it there saves
> extra unnecessary calculations, also describes & fixes the exact scenario
> that didn't work (not being able to see main worktree as bare from a
> secondary worktree).

If I had to do a great job there, then the code does deserve to be explained a bit better for later developers who wonder why it is written in the way it is, perhaps we a single-liner comment?

Thanks.
Previous: Olga PilipencoNext: Olga Pilipenco
Message 11 of 19 in “worktree: detect from secondary worktree if main worktree is bare”
  1. worktree: detect from secondary worktree if main worktree is bareOlga Pilipenco via GitGitGadget, Nov 15, 2024
  2. worktree: detect from secondary worktree if main worktree is bareOlga Pilipenco via GitGitGadget, Jan 16, 2025
  3. Eric SunshineJan 19, 2025
  4. Olga PilipencoJan 28, 2025
  5. Eric SunshineJan 29, 2025
  6. Junio C HamanoJan 29, 2025
  7. worktree: detect from secondary worktree if main worktree is bareOlga Pilipenco via GitGitGadget, Jan 31, 2025
  8. Junio C HamanoJan 31, 2025
  9. Junio C HamanoJan 31, 2025
  10. Olga PilipencoJan 31, 2025
  11. Junio C HamanoJan 31, 2025
  12. Olga PilipencoFeb 4, 2025
  13. Junio C HamanoFeb 4, 2025
  14. Olga PilipencoFeb 4, 2025
  15. worktree: detect from secondary worktree if main worktree is bareOlga Pilipenco via GitGitGadget, Feb 5, 2025
  16. Eric SunshineJan 30, 2025
  17. Eric SunshineJan 30, 2025
  18. Olga PilipencoJan 31, 2025
  19. Eric SunshineJan 31, 2025

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.