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

Re: [PATCH] worktree: stop supporting moving worktrees manually

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Dec 31, 2015, 05:59 UTC
Message-ID
<CAPig+cSDNgSmwMcEKfEQVcY=_7VHFrNiOHkR++YwvPtcsp5WZg@mail.gmail.com>
In-Reply-To
<CACsJy8ALc32ptP20_Mm+XDRXR6+b=Lam4saV77Kfrr1-3rHjfw@mail.gmail.com>
On Tue, Dec 29, 2015 at 8:55 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 18 quoted lines
> On Mon, Dec 28, 2015 at 1:22 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> On Sun, Dec 27, 2015 at 10:43:16AM +0700, Nguyễn Thái Ngọc Duy wrote:
>>>  If you move a linked working tree to another file system, or
>>> -within a file system that does not support hard links, you need to run
>>> -at least one git command inside the linked working tree
>>> -(e.g. `git status`) in order to update its administrative files in the
>>> -repository so that they do not get automatically pruned.
>>> +within a file system that does not support hard links, you need to update
>>
>> Hmm, is this "hard links" feature implemented? If not, then this
>> documentation is a bit outdated.
>
> The prune logic is there. But this hard link is not created by
> 'worktree add'. I think calling link() was done at some point but then
> it got dropped. Ah found it, it wasn't a big "no" so maybe we can
> revive it at some point.
>
> http://article.gmane.org/gmane.comp.version-control.git/243475
Hmm, yes...
Show 18 quoted lines
>>> +$GIT_DIR/worktrees/<id>/gitdir so that they do not get automatically pruned.
>>
>> Following the example of af189b4 (Documentation/git-worktree: split
>> technical info from general description, 2015-07-06), it might be a
>> good idea to keep this high-level overview free of such low-level
>> details and instead mention $GIT_DIR/worktrees/<id>/gitdir in the
>> "DETAILS" section.
>>
>> Perhaps something like this, on top of your patch (assuming that the
>> "hard links" feature is not implemented):
>
> Looks good.
>
> How about something like this at the end of the last new paragraph?
> "alternatively if your file system supports hard link and the worktree
> and $GIT_DIR are on the same file system, you can create a hard link
> named "link" back to the .git file. See gitrepository-layout.txt for
> more information".
That makes sense, however...

If I understand correctly, while it's true that the 'link' file will inhibit pruning, don't we still have the problem that "git worktree list" will show an outdated path if the user fails to update 'gitdir'? And doesn't the "branch already checked out in some other worktree" interrogation also depend upon 'gitdir' being up-to-date?

Previous: Duy Nguyen
Message 18 of 18 in “What's the ".git/gitdir" file?”
  1. Kyle MeyerOct 27, 2015
  2. Stefan BellerOct 27, 2015
  3. Randall S. BeckerOct 27, 2015
  4. Stefan BellerOct 27, 2015
  5. Junio C HamanoOct 27, 2015
  6. Mike RappazzoOct 27, 2015
  7. Junio C HamanoOct 28, 2015
  8. setup: do not create $X/gitdir unnecessarily when accessing git file $XNguyễn Thái Ngọc Duy, Nov 2, 2015
  9. Eric SunshineNov 2, 2015
  10. Jeff KingNov 2, 2015
  11. Junio C HamanoNov 2, 2015
  12. Jeff KingNov 2, 2015
  13. Duy NguyenNov 3, 2015
  14. Junio C HamanoNov 3, 2015
  15. worktree: stop supporting moving worktrees manuallyNguyễn Thái Ngọc Duy, Dec 27, 2015
  16. Eric SunshineDec 28, 2015
  17. Duy NguyenDec 29, 2015
  18. Eric SunshineDec 31, 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.