barrettj12 / jit

The superior way to use Git.
0 stars 0 forks source link

Handle forks with a different name #31

Open barrettj12 opened 4 months ago

barrettj12 commented 4 months ago
$ jit new gfouillet:fix_generate_doc
creating new worktree based on remote branch gfouillet:fix_generate_doc
added remote gfouillet (https://github.com/gfouillet/cmd)
Error: failed to create new branch: couldn't fetch remote branch gfouillet:fix_generate_doc: remote: Repository not found.
fatal: repository 'https://github.com/gfouillet/cmd/' not found

exit status 128

This failed because the fork is called gfouillet/juju-cmd, not gfouillet/cmd. Can we use GitHub to search for the name of the fork?

barrettj12 commented 3 months ago

We can use the GitHub forks API to find all forks of a given repo: https://docs.github.com/en/rest/repos/forks?apiVersion=2022-11-28

We might also be able to look through the user's repos and work out if one is a fork of the given repo.

This might also be easier using the GitHub GraphQL API.