When a repo doesn't have a default branch name (i.e. a totally empty repo) then Octo gives an error when trying to view that repo.
This fixes that. Additionally, because when using the fzf-lua picker since the repo is previewed the error can show up when that repository is highlighted.
Check for the default branch ref and if it's vim.NIL the name just becomes nil. This will prevent displaying the name as well as fetching the README from the default branch.
Describe how to verify it
Make a repo on Github and don't configure anything (no README, no .gitignore, no license file, etc.), then run :Octo repo view you/your-repo. Make sure there is no error as seen in #519
Describe what this PR does / why we need it
When a repo doesn't have a default branch name (i.e. a totally empty repo) then Octo gives an error when trying to view that repo.
This fixes that. Additionally, because when using the fzf-lua picker since the repo is previewed the error can show up when that repository is highlighted.
Does this pull request fix one issue?
Fixes https://github.com/pwntester/octo.nvim/issues/519
Describe how you did it
Check for the default branch ref and if it's
vim.NIL
the name just becomes nil. This will prevent displaying the name as well as fetching the README from the default branch.Describe how to verify it
Make a repo on Github and don't configure anything (no README, no .gitignore, no license file, etc.), then run
:Octo repo view you/your-repo
. Make sure there is no error as seen in #519Special notes for reviews
N/A