Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make links in search results work for SSH style repo URLs #19

Closed
jklein opened this issue Jan 28, 2015 · 14 comments
Closed

Make links in search results work for SSH style repo URLs #19

jklein opened this issue Jan 28, 2015 · 14 comments
Labels

Comments

@jklein
Copy link
Member

jklein commented Jan 28, 2015

Currently Hound only supports HTTP style URLs for repos, and it would be nice to support SSH as well.

@kgodwin
Copy link

kgodwin commented Jan 28, 2015

https://github.com/etsy/Hound/blob/b0f9b34552cf28357b20f9dfeeac9f532a8c8375/src/hound/git/git.go#L52

{
"dbpath": "data",
"repos": {
"repo": {
"url": "git@gitlab-install:namespace/repo.git"
}
}

I'm pretty sure this does work as I've set it up for an internal gitlab install over SSH. It basically will take any uri that Git would I believe.

@jklein
Copy link
Member Author

jklein commented Jan 28, 2015

Yeah it clones, but then all of the links from search results are broken I believe.

@jklein jklein changed the title Support accessing repos over SSH Support repos over SSH - links in search results Jan 28, 2015
@kgodwin
Copy link

kgodwin commented Jan 28, 2015

Ah, I misunderstood what you were asking about. There was another user with a similar question and I thought you were asking a similar one.

@brucestephens
Copy link

If you want to get something working quickly (i.e., hack the code for your site) the thing to change
seems to be UrlToRepo in pub/assets/js/hound.js. (I'm assuming you've got something like gitweb, cgit, etc., set up to point at.)

@kgodwin
Copy link

kgodwin commented Jan 29, 2015

Given Hound already clones things into data/[repo-name] and it operates as a webapp, wouldn't it just make more sense to just self-host the not http:// repos so it just displays the local copy the search index is built on? [e.g. file:///, ssh]

@brucestephens
Copy link

Just having Hound serve source seems like a good option (and likely would be a useful default when
the URL doesn't look like a github one). More generally it's surely useful to be able to link to
some other service (one that has syntax highlighting, version control or cross referencing).

@kgodwin
Copy link

kgodwin commented Jan 29, 2015

Maybe the path forward then is:

If [contains github.com] -> Link as per current
if [UrlToRepo: contains alternative-link-scheme] -> Link as per listed link scheme
else -> Self-serve [with syntax highlighting and links to the rest of the project]

?

@brucestephens
Copy link

I guess so. Maybe there are some other special cases (like github) that are worth doing (gitlab, for example), but maybe not. What you suggest is probably a good compromise: DTRT most of the time, and simple to understand how to change it.

@kgodwin
Copy link

kgodwin commented Jan 29, 2015

http://[website-url]/[repo-name]/blob/master/[filename]#L[line-number]

Maybe the UrlToRepo should just support tokens then?

@brucestephens
Copy link

Dunno. Might be best to do something simple: so just cover cases 1 and 2 and forget about the
more annoying case?

And just leave a pointer to the relevant bit of javascript in the README, so people who want to can
easily find and hack it. (Or maybe this issue is sufficient, come to that.)

What I'd like is to have a collection of our local repositories, and they'll all map in the same way. So
actually changing the javascript would be easier than the config file (if it's necessary to configure
each repository separately). My guess is that that'll be fairly common. Maybe not, though.

Anyway, my guess is doing something simple (handle github and support local (ssh, etc.) repositories
by serving files) and seeing how people like it is probably best for now. It'll be less surprising than
the 404 that it produces now.

This was referenced Jan 30, 2015
@jklein jklein changed the title Support repos over SSH - links in search results Make links in search results work for SSH style repo URLs Feb 2, 2015
@jklein jklein added bug and removed enhancement labels Feb 2, 2015
@MoriTanosuke
Copy link

When testing SVN support I noticed that in https://github.com/etsy/Hound/blob/master/pub/assets/js/hound.js#L292 there is a hardcoded reference to add '/blob/master/' to the URL. This does not work for SVN (I think it will only for for git repos ❓) and supporting multiple VCS via PR #39 breaks the link to the source files.

@jklein
Copy link
Member Author

jklein commented Feb 4, 2015

Thanks @MoriTanosuke, we should fix that. Can you open an issue, or fix it as part of your SVN PR?

colbyr pushed a commit to colbyr/hound that referenced this issue Feb 26, 2015
This is a slightly more flexible solution for hound-search#19 than
d2c1d98, which worked for private
github.com repos but not for repos on a different domain.
jklein added a commit that referenced this issue Feb 27, 2015
fix 404s for Github Enterprise repos (see #19)
@jklein
Copy link
Member Author

jklein commented Mar 3, 2015

@kellegous it seems like with your change we can update the README/example config and this issue will be able to be fully handled by the new functionality.

@jklein
Copy link
Member Author

jklein commented Mar 6, 2015

We now have a url-pattern directive that should solve this issue completely. Feel free to open a new one if you continue to have problems. You can see an example of how this works in config-example.json.

@jklein jklein closed this as completed Mar 6, 2015
yelizariev pushed a commit to yelizariev/hound that referenced this issue Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants