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

feat: Use gh's resolved repo config for git remotes #470

Open jarviliam opened 6 months ago

jarviliam commented 6 months ago

Describe what this PR does / why we need it

This commit adjusts the fetching remote function to also consider default repositories set by the gh cli. When the local git repository has remote.origin.gh-resolved pwntester/octo.nvim set, the resolved repository name will be used instead of the default one.

When attempting to run any gh cli commands in a repo where there are multiple remotes defined, it requires the user to set the default repo to use via gh repo set-default. This repo is then used as the default remote for all gh commands. This commit attempts to also utilize the same configuration.

This is needed because on my fork when I run Octo issue list I get the issues from my fork and not the original repo. Now that I have set the default repo locally, I can fetch the issues from above command.

When fetching remotes it will: 1) Fetch remotes via git remote -v 2) Apply user_defined ssh_aliases against the set 3) Fetch the local gh-resolved value 4) When returning the default remote, if a resolved value is set from step 3, utilize that value

Let me know if theres any issues/ideas.