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

[BUG] Wrong worktree path when using multiple worktree

From
Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Date
Nov 3, 2015, 16:58 UTC
Message-ID
<5638E79E.10407@morey-chaisemartin.com>
Hi,

There seem to be an issue with the path computed for a worktree when multiple worktree were created (using git worktree) In my Setup, I have 3 repos: A/repo (main One) A/repo-patches (worktree, using branch dev) B/repo (worktree, using branch next)

I'm working in A/repo-patches an run: $ git checkout next fatal: 'next' is already checked out at 'A/repo-patches'

Which is partially true but not completely.
I looked a bit in the code and found that the issue comes from here (get_linked_worktree):
    if (!strbuf_strip_suffix(&worktree_path, "/.git")) {
        strbuf_reset(&worktree_path);
        strbuf_addstr(&worktree_path, absolute_path("."));
        strbuf_strip_suffix(&worktree_path, "/.");
    }
Because it wrongfully assumes that I am in the linked worktree.
I checked in the .git/worktree files and couldn't see anything that actually points to where the repo are setup.
Nicolas
Next: Mike Rappazzo
Message 1 of 3 in “[BUG] Wrong worktree path when using multiple worktree”
  1. Nicolas Morey-ChaisemartinNov 3, 2015
  2. Mike RappazzoNov 3, 2015
  3. Mike RappazzoNov 4, 2015

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.