Closed sideshowcoder closed 4 years ago
Hi, thanks, I've heard of this but have never used it βuntil now! I think it'd be a nice addition.
Questions/comments:
sourcegraph is only self-hosted, right? So alist value of "sourcegraph" assumes this is used by the sourcegraph configured domain?
Currently does not work with ports, may be an existing bug but sourcegraph runs on 7080 by default and generated links are missing the port πΏ
Locally I have a link like this: http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api/-/blob/README.md?view=code#L10
But the resulting git-link is:
http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api/@master/-/blob/README.md#L10 (I added the port), which returns a 404
When git-link-use-commit
is t
I get: http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api/@4bc47f20de32d1c182ffe63b12c94ce59057bd0c/-/blob/README.md#L10
Which also 404s. Any ideas? This is using the sourcegraph/server:3.17.3
Docker image.
(Note that I also had to change it to http, but maybe that's not important now π)
Thanks for considering @sshaw
sourcegraph is only self-hosted, right? So alist value of "sourcegraph" assumes this is used by the sourcegraph configured domain?
Yes I was under that assumption, but also if I understand the code right it depends on the naming of the remote, not the url in the remote am I correct? So with the configuration given above
[remote "sourcegraph"]
url = https://i.dont.contain.the.magic.word/my.git.host/my-repository
[git-link]
remote = sourcegraph
should also work, see the url not containing sourcegraph
.
Currently does not work with ports, may be an existing bug but sourcegraph runs on 7080 by default and generated links are missing the port πΏ
Interesting I hadn't tried that, it seems to be an exisiting bug so, as the patch doesn't handle the parsing of the host, so I would assume that the port also fails for a self-hosted git running on a non default port for example. Happy to look into this, but I think its a seperate issue.
Locally I have a link like this: http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api/-/blob/README.md?view=code#L10
But the resulting git-link is:
http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api/@master/-/blob/README.md#L10 (I added the port), which returns a 404
When
git-link-use-commit
ist
I get: http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api/@4bc47f20de32d1c182ffe63b12c94ce59057bd0c/-/blob/README.md#L10Which also 404s. Any ideas? This is using the
sourcegraph/server:3.17.3
Docker image.
Interesting, I was running it against a company hosted sourcegraph instance, but I'll try the docker image and report back, I feel like there is something wrong with the branch / commit adding. I can't try it yet but I would assume the link http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api@master/-/blob/README.md#L10 should work, there seems to be a rouge /
at the end of the dirname
part of the url, which would need to be dropped.
(Note that I also had to change it to http, but maybe that's not important now π)
Yeah I guess the self hosted image is http
but when purchased and hosted inside a company I guess the recommendation is https
. Which seems like a reasonable choice π
@sshaw any chance you could take another look at this?
Oh, hi. Sorry, missed this.
if I understand the code right it depends on the naming of the remote, not the url in the remote am I correct?
It does depend on the URL. It looks up the remote and tries to match its URL against the appropriate alist key.
it seems to be an exisiting bug so, as the patch doesn't handle the parsing of the host... I think its a seperate issue.
Agreed.
git-link
is mostly working now (see inline comments).
git-link-commit
generates the following URL: http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api@2cb1ad0 but for me this does not link to the commit. This links to the commit: http://127.0.0.1:7080/github.com/ScreenStaring/recharge-api/-/commit/84286a823bd1969366b5ff4abb22a2c3c5bf8ca4
Does the first one work for you? Does the second?
Also please squash into a single commit. πͺ
Hello @sshaw sorry about the delay, I finally got fix the issues and follow up.
The link for git-link-commit
was not working indeed but it seemed to be working on my instance as it did the correct redirect. It is working now.
No problem, thanks for this!
Not sure this is something that would be an addition to git-link as sourcegraph does not actually implement a repository, but it is related to git.
Sourcegraph allows to reference files by git commit or branch, even so it does not represent a git repository it can be useful to open files in sourcegraph instead of the remote.
This requires a pseudo remote to be setup in the
.git/config
of the project.