pwntester / octo.nvim

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

fix: require 'octo' for telescope previewer #208

Closed austin-ray closed 2 years ago

austin-ray commented 2 years ago

Describe what this PR does / why we need it

'octo/writers.lua' uses the global 'octo_buffers', which 'octo.lua' initializes. However, if a user calls a function that uses the telescope previewer (e.g. 'Octo pr list') then there's a chance that 'octo/writers.lua' executes before the initialization of 'octo_buffers'. This results in an attempt to index a nil global.

Does this pull request fix one issue?

Fixes #207

Describe how you did it

To fix this, import the 'octo' module so 'octo_buffers' has guaranteed initialization.

Describe how to verify it

  1. Launch nvim in repo with open pull requests
  2. Execute Octo pr list
  3. No error message should appear.

Special notes for reviews

pwntester commented 2 years ago

Thanks!

austin-ray commented 2 years ago

@pwntester: Would you have any qualms against labeling this PR hacktoberfest-accepted? I collect the Hacktoberfest t-shirts.