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

Re: Bug: relative core.worktree is resolved from symlink and not its target

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 9, 2014, 09:08 UTC
Message-ID
<20140209090803.GA24578@lanh>
In-Reply-To
<52F0BEF7.5020600@thequod.de>
On Tue, Feb 04, 2014 at 11:20:39AM +0100, Daniel Hahler wrote:
Show 12 quoted lines
> Hi,
> 
> when using a submodule "sm", there is a relative worktree in its config:
> 
>    .git/modules/sm/config:
>    [core]
>     worktree = ../../../smworktree
> 
> git-new-worktree (from contrib) symlinks this config the new worktree.
> 
> From inside the new worktree, git reads the config, but resolves the
> relative worktree setting based on the symlink's location.

Hmm.. core.worktree is relative to $GIT_DIR. Whether "config" is a symlink should have no effects.

$ pwd
/tmp/abc
$ ls -l .git/config 
lrwxrwxrwx 1 pclouds users 11 Feb  9 15:57 .git/config -> /tmp/config
$ cat /tmp/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        worktree = ../../worktree
$ ls -l /tmp/worktree/
total 4
-rw-r--r-- 1 pclouds users 5 Feb  9 15:59 abc
$ ~/w/git/git ls-files -o
abc
Maybe it's something else. Could you produce a small test case?
Show 5 quoted lines
> A fix would be to resolve any relative worktree setting based on the
> symlink target's location (the actual config file), and not from the
> symlink.
> 
> This is with git version 1.8.5.3.

-- Duy

Previous: Daniel HahlerNext: Daniel Hahler
Message 2 of 4 in “Bug: relative core.worktree is resolved from symlink and not its target”
  1. Daniel HahlerFeb 4, 2014
  2. Duy NguyenFeb 9, 2014
  3. Daniel HahlerFeb 17, 2014
  4. Duy NguyenFeb 17, 2014

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.