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

Re: [PATCH v2 0/3] Ensure unique worktree ids across repositories

From
shejialuo <shejialuo@gmail.com>
Date
Dec 2, 2024, 11:46 UTC
Message-ID
<Z02eKA8i51QyXgJ-@ArchLinux>
In-Reply-To
<xmqqed2qkfn0.fsf@gitster.g>
On Mon, Dec 02, 2024 at 11:00:51AM +0900, Junio C Hamano wrote:
Show 10 quoted lines
> Caleb White <cdwhite3@pm.me> writes:
> 
> > - Add the worktree id to `worktree list` output
> 
> I have always thought that we deliberately hid the "ID" from the end
> user's view because it is a mere implementation detail, and used the
> filesystem path of the worktree directory instead to identify each
> instance of the worktree in the end-user interaction.  It is unclear
> why this change is a good idea from that point of view.
> 

I have a discussion with Caleb in the first version. Because appending a hash / random number will cause the worktree id has more digits, the user cannot easily use the following commands to make a ref in the main worktree point to linked worktree ref:

    ```sh
    git symbolic-ref refs/heads/foo \
        worktrees/<worktree id>/refs/worktree/foo
    ```

And I expressed my concern about above situation, the user types the extra hash to do above. So, Caleb decides to list the worktree id.

Actually, this usage should not be common. But when implementing the consistency check for files backend, you have told me that the above situation could happen. And you have said we _deliberately_ hide the "ID" from the end user's view.

But cross-ref operations between worktrees must explicitly specify the worktree id, so I am wondering whether we should allow the user do cross-ref operations in the first place:

  1. main worktree symref points to linked worktree ref.
  2. A linked worktree ref points to another linked worktree ref.

Thanks, Jialuo

Previous: Junio C HamanoNext: Junio C Hamano
Message 15 of 24 in “Ensure unique worktree ids across repositories”
  1. 0/3 Ensure unique worktree ids across repositoriesCaleb White, Nov 29, 2024
  2. 1/3 worktree: add worktree with unique suffixCaleb White, Nov 29, 2024
  3. 2/3 worktree: rename worktree id during worktree moveCaleb White, Nov 29, 2024
  4. 3/3 worktree: add id to `worktree list` outputCaleb White, Nov 29, 2024
  5. rsbecker@nexbridge.comNov 29, 2024
  6. Caleb WhiteNov 29, 2024
  7. rsbecker@nexbridge.comNov 29, 2024
  8. Caleb WhiteNov 29, 2024
  9. rsbecker@nexbridge.comNov 29, 2024
  10. Caleb WhiteNov 30, 2024
  11. rsbecker@nexbridge.comNov 30, 2024
  12. Caleb WhiteNov 30, 2024
  13. rsbecker@nexbridge.comNov 30, 2024
  14. Junio C HamanoDec 2, 2024
  15. shejialuoDec 2, 2024
  16. Junio C HamanoDec 3, 2024
  17. Eric SunshineDec 3, 2024
  18. Junio C HamanoDec 3, 2024
  19. rsbecker@nexbridge.comDec 3, 2024
  20. Junio C HamanoDec 3, 2024
  21. Caleb WhiteDec 3, 2024
  22. Junio C HamanoDec 3, 2024
  23. Caleb WhiteDec 3, 2024
  24. shejialuoDec 3, 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.