How to correct gitdir/worktree paths across systemd-run path mappings? #1214
Replies: 2 comments
-
Honestly, I have no idea. You can see Gitsigns is trying to run: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /tmp/tmp.RXP1YyDuHi/.git/modules/empty-repo/modules/empty-repo --work-tree /tmp/tmp.RXP1YyDuHi/empty-repo/empty-repo -c core.quotepath=off ls-fi
les --stage --others --exclude-standard --eol /tmp/tmp.RXP1YyDuHi/empty-repo2/empty-repo/README.md And for some reason that is failing. To get this to work, we need a I'm assuming the gitdir and worktree in the above command is correct? |
Beta Was this translation helpful? Give feedback.
-
I guess that Gitsigns (or git - I not verified it) gets both values from
On the other side, if we remove
Seems to work - all inside Nvim terminal. It's hard for me to judge how risky it would be to allow for querying paths relative to CWD in Gitsigns. I changed the original bash script to make it more reusable. |
Beta Was this translation helpful? Give feedback.
-
In Debian I use
systemd-run
path mappings (https://github.com/przepompownia/dotnvim/blob/master/lib/nvim-isolated) because ofNVIM_APPNAME
restrictions. On the other side mydotnvim
project is a submodule of the home directory. It contains plugins as sumbodules. I noticed "outside repository" error from Gitsigns when jumped (from checkhealth deprecation messages bygF
) to such "internal" paths. My gitdirs are moved up bygit submodule absorbgitdirs
.In such case
.git
in lowest level repo becomes a file that contains a relative path to itsgitdirgitconfig directory. Assume that the path accidentally exists (inside the container). Probably the worktree path is then read from that config. This is a real path and can differ from the original worktree.I have created a minimal example that shows what happens:
init.lua:
repro.sh
for Linux with systemdIn short,
${toplevel}/empty-repo/empty-repo/
in the real environment is available as${toplevel}/empty-repo2/empty-repo/
in the "container".Is it possible to configure Gitsigns in such case for correct worktree and gitdir detection?
Beta Was this translation helpful? Give feedback.
All reactions