pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.36k stars 127 forks source link

fix: lack of default branch name causes repo display issue #521

Closed milogert closed 6 months ago

milogert commented 6 months ago

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 #519

Special notes for reviews

N/A

milogert commented 6 months ago

@MadKuntilanak would you be able to verify this one?

MadKuntilanak commented 6 months ago

would you be able to verify this one?

yup i verified this with:

  1. Create an empty folder and make repo with zero git suff
  2. Open octo repo list or ocro repo view <repo_link>
  3. Doing this doing that, success, no errors

Thanks!