src-expose serve finds subprojects
Created by: keegancsmith
src-expose serve finds git repos under a directory and serves up an endpoint to list all repos and git fetch/clone them. Currently it stops crawling into a directory once it finds the .git
directory. However, this means we don't serve subprojects. eg if your directory structure is this
- project/.git
- project/subproject/.git
then we only list project
. However, we should also list project/subproject
.
Here is were we do the crawling https://github.com/sourcegraph/sourcegraph/blob/bac12cbb510c78d10ec5aae855615d6305b71721/dev/src-expose/serve.go#L141-L145
Requirements:
- Recurse into subprojects
- Don't recurse into
.git
. This is for performance reasons.
Nice to have: Only recurse into subprojects if it is a bare repo. Context: src-expose sync
creates bare repositories, and is the use case for subprojects. However, src-expose serve
can also be used to export local normal git repositories into Sourcegraph. But recursing into non-bare repos is a lot more work (eg node_modules/etc is an order of magnitude more syscalls). So we can only do the recursing if the .git
is configured as a bare repo.