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

Re: [PATCH 1/2] worktree: add CLI/config options for relative path linking

From
Taylor Blau <me@ttaylorr.com>
Date
Oct 28, 2024, 00:17 UTC
Message-ID
<Zx7YFPE5tjr/bn2s@nand.local>
In-Reply-To
<20241025-wt_relative_options-v1-1-c3005df76bf9@pm.me>
On Fri, Oct 25, 2024 at 10:29:37PM +0000, Caleb White wrote:
Show 18 quoted lines
> This patch introduces the `--[no-]relative-paths` CLI option for
> `git worktree {add, move, repair}` commands, as well as the
> `worktree.useRelativePaths` configuration setting. When enabled,
> these options allow worktrees to be linked using relative paths,
> enhancing portability across environments where absolute paths
> may differ (e.g., containerized setups, shared network drives).
>
> Using the `--relative-paths` option with `worktree {move, repair}`
> will convert absolute paths to relative ones, while `--no-relative-paths`
> does the reverse. For cases where users want consistency in path
> handling, the config option `worktree.useRelativePaths` provides
> a persistent setting.
>
> A new helper function, `write_worktree_linking_files()`, centralizes
> the logic for computing and writing either relative or absolute
> paths, based on the provided configuration. This function accepts
> `strbuf` pointers to both the worktree’s `.git` link and the
> repository’s `gitdir`, and then writes the appropriate path to each.

Looking at the patch below, it is quite large, and I wonder if it would benefit from being split into smaller pieces. Perhaps factoring out write_worktree_linking_files() in a separate patch would be a good start here?

Thanks, Taylor

Previous: Caleb WhiteNext: Taylor Blau
Message 3 of 14 in “Allow relative worktree linking to be configured by the user”
  1. 0/2 Allow relative worktree linking to be configured by the userCaleb White, Oct 25, 2024
  2. 1/2 worktree: add CLI/config options for relative path linkingCaleb White, Oct 25, 2024
  3. Taylor BlauOct 28, 2024
  4. Taylor BlauOct 28, 2024
  5. Caleb WhiteOct 28, 2024
  6. Taylor BlauOct 28, 2024
  7. Caleb WhiteOct 28, 2024
  8. Caleb WhiteOct 28, 2024
  9. 2/2 worktree: add `relativeWorktrees` extensionCaleb White, Oct 25, 2024
  10. Taylor BlauOct 28, 2024
  11. Caleb WhiteOct 28, 2024
  12. Taylor BlauOct 28, 2024
  13. Caleb WhiteOct 28, 2024
  14. Taylor BlauOct 28, 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.