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

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

From
Caleb White <cdwhite3@pm.me>
Date
Nov 29, 2024, 02:49 UTC
Message-ID
<D5YBJRUXYLUR.8TB0DXCJ6654@pm.me>
In-Reply-To
<20241128-wt_unique_ids-v1-0-30345d010e43@pm.me>
On Thu Nov 28, 2024 at 8:44 PM CST, Caleb White wrote:
Show 24 quoted lines
> The `es/worktree-repair-copied` topic added support for repairing a
> worktree from a copy scenario. I noted[1,2] that the topic added the
> ability for a repository to "take over" a worktree from another
> repository if the worktree_id matched a worktree inside the current
> repository which can happen if two repositories use the same worktree name.
>
> This series teaches Git to create worktrees with a unique suffix so
> that the worktree_id is unique across all repositories even if they have
> the same name. For example creating a worktree `develop` would look like:
>
>     foo/
>     ├── .git/worktrees/develop-5445874156/
>     └── develop/
>     bar/
>     ├── .git/worktrees/develop-1549518426/
>     └── develop/
>
> The actual worktree directory name is still `develop`, but the
> worktree_id is unique and prevents the "take over" scenario. The suffix
> is given by the `git_rand()` function, but I'm open to suggestions if
> there's a better random or hashing function to use.
>
> [1]: https://lore.kernel.org/git/20241008153035.71178-1-cdwhite3@pm.me/
> [2]: https://lore.kernel.org/git/r4zmcET41Skr_FMop47AKd7cms9E8bKPSvHuAUpnYavzKEY6JybJta0_7GfuYB0q-gD-XNcvh5VDTfiT3qthGKjqhS1sbT4M2lUABynOz2Q=@pm.me/

I forgot to mention, but the base for this series is obtained by merging the `cw/worktree-extension` topic (2024-11-26, 20241125-wt_relative_options-v5-0-356d122ff3db@pm.me) onto 090d24e9af.

Best,
Caleb
Previous: Caleb WhiteNext: Junio C Hamano
Message 4 of 11 in “Ensure unique worktree ids across repositories”
  1. 0/2 Ensure unique worktree ids across repositoriesCaleb White, Nov 29, 2024
  2. 1/2 worktree: add worktree with unique suffixCaleb White, Nov 29, 2024
  3. 2/2 worktree: rename worktree id during worktree moveCaleb White, Nov 29, 2024
  4. Caleb WhiteNov 29, 2024
  5. Junio C HamanoNov 29, 2024
  6. Caleb WhiteNov 29, 2024
  7. Junio C HamanoDec 1, 2024
  8. shejialuoNov 29, 2024
  9. Caleb WhiteNov 29, 2024
  10. shejialuoNov 29, 2024
  11. Caleb WhiteNov 29, 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.