vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Git: Support opening repositories on symlinked paths

Open mrded opened this issue 10 years ago • 63 comments

  • VSCode Version: 1.0.0 (1.0.0)
  • OS Version: OSX 10.11.4 (15E65)

Steps to Reproduce:

  1. Create a new project with git repository initialised.
  2. Create a folder /foo/bar
  3. Add a symlink from /foo/bar to /bar ln -s /foo/bar .
  4. Go to Git tab on vscode, and stage /bar folder.

If now you click on staged /bar folder, you'll get an error Warn: Can't open this git resource.

mrded avatar Apr 29 '16 05:04 mrded

It would be nice to find nested git repos as well. Some of us are fortunate enough to not code on Monoliths.

jeremyjjbrown avatar Jun 02 '16 23:06 jeremyjjbrown

It would be nice to have an option to NOT do GIT change tracking inside symlinks. If my symlink is to another folder in the same git repo I don't want the changed files showing up twice in Code's Git view.

mightypenguin avatar Sep 14 '16 11:09 mightypenguin

This issue is about displaying symlinks in the git view and what happens when you click them. Neither Code nor git follow (or should follow) the symlinks.

joaomoreno avatar Sep 14 '16 13:09 joaomoreno

Ok, off topic, but I am seeing VScode following symlinks in the git view. Running "git status" does not show these files. Should I create a new issue or discuss this somewhere else?

mightypenguin avatar Sep 15 '16 11:09 mightypenguin

Can you take a screenshot to show me what you mean?

joaomoreno avatar Sep 15 '16 12:09 joaomoreno

I know what causes it. The git repo is a remotely mounted fuse file system. The linux terminal shows permissions and symlinks properly, but for some reason vscode isn't. If I create a simple git repo with a directory and a symlink to that directly it works properly on my local filesystem. If I move that to the fuse mounted file system it confuses vscode.

Here's my mount command: sshfs hostname:/home/user/ /home/user/ -o sshfs_sync -o sync_readdir -o follow_symlinks -o kernel_cache -o max_background=50 -o big_writes

mightypenguin avatar Sep 15 '16 12:09 mightypenguin

Actually, no more errors when you click it. We handle it nicely, even with decorations.

joaomoreno avatar Sep 17 '18 14:09 joaomoreno

We just can't handle the root being a symlink in itself.

joaomoreno avatar Sep 18 '18 14:09 joaomoreno

Staging ranges of a file opened through a symlink is broken as well, and will lead to weird behavior where instead the file that is the symlink has the selected range staged and every other line from the target is displayed as changes in the symlink file in the git side bar.

ghost avatar Nov 28 '18 04:11 ghost

This issue, specifically git gutters not displaying but maybe others as well, also occurs for remote symlinked git repos using the Remote - SSH extension.

ryansully avatar May 20 '19 23:05 ryansully

Can confirm, no Git gutter's when using a symlinked path in Remote WSL (Though other Git features seem to work fine) But if I navigate to the same path using /mnt/c and start up "code ." it all works fine.

UnicodeTreason avatar Jul 05 '19 03:07 UnicodeTreason

is the issue with the Remote SSH extension (and thus bugs/work should be tracked there) or with vscode itself?

seanknox avatar Sep 13 '19 16:09 seanknox

Same issue here when working on a linked folder. If a open the target folder, it works. If a open the symbolic link 'folder', gutter annotations won´t work.

dulinux avatar Oct 08 '19 03:10 dulinux

Is there a way to recognize this from the extension, and perhaps provide an error in some log (like the VSCode "Show Git Output" log)? I don't know the internals work of these extensions work, but it took me a lot of Googling to find this error – the keyword I was missing was "gutter".

Throne3d avatar Jan 25 '20 00:01 Throne3d

I am facing the same issue when using RemoteSSH for VSCode. Git gutter works on files with full path but doesn't work on same when opened with relative path.

Is there a solution for this problem?

dileepkr avatar Feb 20 '20 19:02 dileepkr

Open the non-symlinked path worked for me, but I had the same issue Feb 26, 2020.

AddictArts avatar Feb 27 '20 00:02 AddictArts

Yeah, this is pretty terrible. I've used all sorts of other OS-level hacks to get around this issue.

AddisonG avatar Feb 27 '20 02:02 AddisonG

Yeah, this is pretty terrible. I've used all sorts of other OS-level hacks to get around this issue.

Do you mind sharing what you did to work around the issue?

tungel avatar Feb 27 '20 04:02 tungel

I navigated directly through /mnt/c/... I had the project symlinked from $HOME/project. Just needed to use an absolute path from root.

AddictArts avatar Mar 07 '20 01:03 AddictArts

I have a very similar issue, a $HOME folder built on login as symlink to a folder in /mnt/home. If I open my project with the path containing $HOME, all the Git decorations are missing. If I open the same project with the real path that uses /mnt/home, then the Git decorations appear as normally.

molinav avatar Mar 13 '20 13:03 molinav