Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong git branch is displayed when using a linked git worktree #47

Open
bacar opened this issue Dec 10, 2018 · 2 comments
Open

Wrong git branch is displayed when using a linked git worktree #47

bacar opened this issue Dec 10, 2018 · 2 comments

Comments

@bacar
Copy link

bacar commented Dec 10, 2018

When using git worktrees, the git branch displayed in a prompt when in a linked worktree is incorrect - it displays the current branch from the main worktree.

@bacar
Copy link
Author

bacar commented Dec 10, 2018

In any fix, is it worth using the plumbing commands (instead of parsing the gitdir contents directly) to make sure this is also more future-proof?

@bacar bacar changed the title Displays wrong git branch with git worktrees wrong git branch is displayed when using a linked git worktree Dec 10, 2018
@bacar bacar changed the title wrong git branch is displayed when using a linked git worktree Wrong git branch is displayed when using a linked git worktree Dec 10, 2018
@bacar
Copy link
Author

bacar commented Dec 10, 2018

The problem seems to be with this line in local function has_git_file(dir):

return git_dir and dir..'/'..git_dir

This probably works for submodules (which seem to put a relative gitdir: into the .git file), but not for worktrees (which seem to put in an absolute path).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant