bgreenlee / sublime-github

Sublime Text 2/3 plugin that provides a number of useful commands for GitHub.
MIT License
455 stars 98 forks source link

Proper git file path not detected in git worktrees #118

Open rkoval opened 5 years ago

rkoval commented 5 years ago

Commands like GitHub: Blame and GitHub: Open Remote URL in Browser default back to the absolute path of your directory instead of relative to the git root in the worktree.

This can be reproduced with the following script:

#!/usr/bin/env bash
tempDir=$(mktemp -d)
git worktree add -b new-branch "$tempDir"
subl "$tempDir"

... then, once Sublime comes up, run GitHub: Blame, for example, and the GitHub URL opened up will have the absolute path in your file system, which will (most likely) not exist in GitHub

jtsternberg commented 4 years ago

I'm experiencing this as well, though I don't quite know why it happens. It doesn't happen all the time, or for all repos.

florin555 commented 4 years ago

What I discovered is that for me the bug happens only when my project path is using a symlink.

For example if I have my code at ~/code/my-project and I also have a symlink ~/my-symlink => ~/code/my-project

Then the bug happens only when I use the symlink to open the project in Sublime Text, not when I use the "real" path.