Closed abhinav closed 2 months ago
It'd be really nice if git-spice
can infer GHE server and API urls from git remote URL in .git/config
when it's not github.com
.
It'd be really nice if
git-spice
can infer GHE server and API urls from git remote URL in.git/config
when it's notgithub.com
.
I agree, but unfortunately, unless there's a clear way to identify GHE servers (e.g. they must always have github.com in their name), that's not possible. While git-spice currently only supports GitHub, I've intentionally tried to keep it forge-agonistic. GitHub-specific details are in a single place. Everything outside that assumes that a repository could be using any forge. It is possible and conceivable to add support for other code forges to git-spice. In fact, most of the CLI behavior tests run against a fake forge with a simpler API that is registered only for tests.
Maybe there should be an option to configure the git server type? Then you can infer the API urls based on server type and remote URL, it's just nicer to not have to explicitly write out multiple URLs.
Maybe there should be an option to configure the git server type? Then you can infer the API urls based on server type and remote URL, it's just nicer to not have to explicitly write out multiple URLs.
Oh, hm. 🤔 Are you suggesting a way to say, "assume all remotes are GitHub"? I can see that being more convenient than the version in this PR.
Oh, I think I understand what you mean.
The configuration would just state that this is a GHES server, and (I guess?) the API URL for those is always /api
on the instance URL?
I ask because I agree that that's a better UX, but I'm trying to determine whether that's mutually exclusive with the configuration option offered here. I'll revert this PR if that's the case. If they're not mutually exclusive, I'll leave this PR in, and that option can happen separately.
The configuration would just state that this is a GHES server, and (I guess?) the API URL for those is always
/api
on the instance URL?
exactly, I don't think they are mutually exclusive, it's just a shortcut IMO.
Created https://github.com/abhinav/git-spice/issues/336.
Separately, @messense, re this:
it's just nicer to not have to explicitly write out multiple URLs.
One obvious convenience we can add here: if GitHub URL is not github.com, then API URL is GitHub URL + "/api". That would help here a little, yes?
One obvious convenience we can add here: if GitHub URL is not github.com, then API URL is GitHub URL + "/api". That would help here a little, yes?
Yes, I think so.
Setting GITHUB_URL and GITHUB_API_URL environment variables can be inconvenient. Allow setting these values via git config if desired.