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

Re: Feature request: use relative path in worktree config files

From
Duy Nguyen <pclouds@gmail.com>
Date
Oct 9, 2016, 11:11 UTC
Message-ID
<CACsJy8C0kyKor4gCLSJrreRCazazbexvaSdbBg+Cka=-beZU_g@mail.gmail.com>
In-Reply-To
<CADKxhpe3S4L9CPV9yxh2yhrtJMa9wyZAPC45u_S=RiuzY1Xrkg@mail.gmail.com>

On Sat, Oct 8, 2016 at 4:35 PM, Stéphane Klein <contact@stephane-klein.info> wrote:

Show 10 quoted lines
> Hi,
>
> "git worktree add" write absolute path in ".git/gitdir"
>
> The code source is here
> https://git.kernel.org/cgit/git/git.git/tree/builtin/worktree.c?h=v2.10.1#n256
>
> Is it possible to use relative path in this config files:
>
> * [main_worktree]/.git/worktrees/[worktree_foobar]/gitdir

The problem with relative is the question "relative to where" and the answer has to be the same when asked from any worktree. For this file, it may be ok after we find a good anchor point (which I have avoided because it gives me headache and absolute paths just work).

> * [worktree_foobar]/.git

This is made absolute on purpose. So that if you move worktree_foobar away manually, it can still point back to "[main_worktree]/.git/worktrees/[woktree_foobar]". I'm not sure if we want relative paths here.

Show 5 quoted lines
> Why:
>
> 1. I configure worktree on my host
> 2. next I use this git working copy in Docker with volume share
> 3. next I've some git error in Docker because config files use absolute path

I think the common way of dealing with this in docker is put things in the same path where it actually is outside docker. If you have stuff at /path/to/foo, then you create the same /path/to/foo inside docker and bind the data to that path. Does that work?

-- 
Duy
Previous: Stéphane KleinNext: Stéphane Klein
Message 3 of 8 in “Feature request: use relative path in worktree config files”
  1. Stéphane KleinOct 8, 2016
  2. Stéphane KleinOct 8, 2016
  3. Duy NguyenOct 9, 2016
  4. Stéphane KleinOct 9, 2016
  5. Duy NguyenOct 9, 2016
  6. Stéphane KleinOct 9, 2016
  7. Junio C HamanoOct 10, 2016
  8. Duy NguyenOct 11, 2016

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.