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

GitBranch Provider Issue in a specific case #201

Open
Abh15h3k opened this issue Jul 16, 2021 · 1 comment
Open

GitBranch Provider Issue in a specific case #201

Abh15h3k opened this issue Jul 16, 2021 · 1 comment

Comments

@Abh15h3k
Copy link

Abh15h3k commented Jul 16, 2021

I recently installed nvm (node version manager) using a curl one-liner from their repo.
the install script checks out the cloned repo to a release tag and deletes all other branches.

This causes the "GitBranch" provider to error out spectacularly.
This happens only if u open files from outside the git repo.
As in if the repo is ~/.config/nvm and that is not your pwd.

GIF showing the issue ( and that the GitBranch provider is causing it ).
buffer-error

Exact steps to reproduce.
Note: if have XGD_CONFIG_HOME set to ~/.config. which is where nvm gets installed.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
nvim ~/.config/nvm/nvm.sh # does not have to nvm.sh. can be any file

steps to reproduce with actually installing nvm (replace abhishek with your username)

command git clone "https://github.com/nvm-sh/nvm.git" --depth=1 "/home/abhishek/Downloads/nvm";
command git --git-dir="/home/abhishek/Downloads/nvm"/.git --work-tree="/home/abhishek/Downloads/nvm" fetch origin tag "v0.38.0" --depth=1;
command git --git-dir="/home/abhishek/Downloads/nvm"/.git --work-tree="/home/abhishek/Downloads/nvm" fetch origin "v0.38.0" --depth=1;
command git -c advice.detachedHead=false --git-dir="/home/abhishek/Downloads/nvm"/.git --work-tree="/home/abhishek/Downloads/nvm" checkout -f --quiet FETCH_HEAD;
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1;
command git --git-dir="/home/abhishek/Downloads/nvm"/.git --work-tree="/home/abhishek/Downloads/nvm" branch --quiet 2>/dev/null;
command git --git-dir="/home/abhishek/Downloads/nvm"/.git --work-tree="/home/abhishek/Downloads/nvm" reflog expire --expire=now --all;
command git --git-dir="/home/abhishek/Downloads/nvm"/.git --work-tree="/home/abhishek/Downloads/nvm" gc --auto --aggressive --prune=now;
nvim Downloads/nvm/nvm.sh
@Abh15h3k
Copy link
Author

I think I've figured it out.

when you are trying to get the detached head. you are assuming that the current working directory is the git repo.

I've raised a PR with a fix.

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