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

Re: worktree duplicates, was: [PATCH] SubmittingPatches: mention doc-diff

From
Duy Nguyen <pclouds@gmail.com>
Date
Aug 24, 2018, 14:46 UTC
Message-ID
<CACsJy8BxxyRxqCj5ZoOmPaiwmFRKHU72yTxyC_eHXS+cEa94zw@mail.gmail.com>
In-Reply-To
<CAPig+cTghgbBo5VfZN+VP2VM00nPkhUqm0dOUqO37arxraxBKw@mail.gmail.com>

Jeff, you're doing crazy things beyond my (admittedly very limited) imagination :P I did not see this at all when I implemented the worktree stuff.

On Thu, Aug 23, 2018 at 8:21 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 26 quoted lines
> > > In this case, it might make sense for "git worktree add" to refuse to
> > > operate if an existing worktree entry still points at the directory
> > > that you're trying to add. That should prevent those duplicate
> > > worktree entries you saw.
> >
> > Yes, but then what's the next step for my script? I can't "remove" since
> > the worktree isn't there. I can't blow away any directory that I know
> > about, since there isn't one.
>
> I was thinking that "worktree add" could start respecting the --force
> option as an escape hatch.
>
> > I need to somehow know that an existing
> > "$GIT_DIR/worktrees/foo" is the problem. But "foo" is not even
> > deterministic. Looking at the duplicates, it seems to be the basename of
> > the working tree, but then mutated to avoid collisions with other
> > worktrees.
>
> If the worktree directory still existed, "git -C rev-parse --git-dir"
> inside the worktree would give you the proper path of
> $GIT_DIR/worktrees/foo, but the directory doesn't exist, so...
> nothing.
>
> > What about refusing by default, but forcing an overwrite with "-f"?
>
> My thought, also.

Sounds good. Eric are you going to implement this? Just checking so that I can (hopefully) cross this off my backlog ;-)

-- 
Duy
Previous: Eric SunshineNext: Eric Sunshine
Message 6 of 11 in “SubmittingPatches: mention doc-diff”
  1. SubmittingPatches: mention doc-diffJeff King, Aug 21, 2018
  2. worktree duplicates, was: [PATCH] SubmittingPatches: mention doc-diffJeff King, Aug 21, 2018
  3. Eric SunshineAug 21, 2018
  4. Jeff KingAug 21, 2018
  5. Eric SunshineAug 23, 2018
  6. Duy NguyenAug 24, 2018
  7. Eric SunshineAug 24, 2018
  8. Jeff KingAug 24, 2018
  9. Eric SunshineAug 27, 2018
  10. Jeff KingAug 27, 2018
  11. Derrick StoleeAug 21, 2018

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.