pwntester / octo.nvim

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

fix: "go to file" falls back to finding the file from the git root #540

Closed mogest closed 3 weeks ago

mogest commented 2 months ago

Describe what this PR does / why we need it

At present, "go to file" expects the file to be located relative to the current working directory. This commit still looks for the file at the current directory, but falls back to using the git root path. This enables "go to file" when the user is at a path inside the repository.

Does this pull request fix one issue?

Fixes #539

Describe how you did it

As above, fallback to using the git root path to find files.

Describe how to verify it

  1. cd into a subdirectory of a git repository
  2. Open a PR in Octo that has comments with tagged files
  3. Press gf on one of those comments and it will now successfully take you to the tagged file

Special notes for reviews

pwntester commented 3 weeks ago

Thanks for the PR and sorry for the late review!