galaxyline.nvim
galaxyline.nvim copied to clipboard
GitBranch Provider Issue in a specific case
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 ).
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
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.