Prerequsities
Setup Configuration and Environment
Default configuration; no environment variables relevant to this path.
Bug Description
choose_merge_request() crashes when the working tree is in detached
HEAD (or in a fresh repo without commits):
.../lua/gitlab/git.lua:112: attempt to concatenate local 'err' (a nil value)
stack traceback:
.../lua/gitlab/git.lua:112: in function 'get_current_branch'
.../lua/gitlab/actions/merge_requests.lua:33: in function 'cb'
git branch --show-current returns an empty string with exit code 0
in that case, so err is nil and the error branch in git.lua:112
concatenates nil into the notify message.
The only caller of get_current_branch() in this flow is
merge_requests.lua:33, which uses the return value to skip a
clean-tree check and a no-op switch_branch when the user is already
on the source branch, so detached HEAD has no semantic meaning here
beyond the crash itself.
Happy to open a PR.
Reproduction Steps
- Check out an arbitrary commit in detached HEAD mode
- In Neovim:
:lua require("gitlab").choose_merge_request()
- Pick any MR → crash
Prerequsities
:h gitlab.nvim.troubleshootingand followed the steps thereSetup Configuration and Environment
Default configuration; no environment variables relevant to this path.
Bug Description
choose_merge_request()crashes when the working tree is in detachedHEAD (or in a fresh repo without commits):
git branch --show-currentreturns an empty string with exit code 0in that case, so
errisniland the error branch ingit.lua:112concatenates
nilinto the notify message.The only caller of
get_current_branch()in this flow ismerge_requests.lua:33, which uses the return value to skip aclean-tree check and a no-op
switch_branchwhen the user is alreadyon the source branch, so detached HEAD has no semantic meaning here
beyond the crash itself.
Happy to open a PR.
Reproduction Steps
:lua require("gitlab").choose_merge_request()