LSIF: git args seem incorrect
Created by: chrismwendt
- Clear out existing commits to be able to trigger a gitserver call later
psql --dbname sourcegraph_lsif -c "delete from commits;" - Apply the following diff to log gitserver errors:
diff --git a/lsif/src/commits.ts b/lsif/src/commits.ts
index 3ae1faecd2..2cd3a822b9 100644
--- a/lsif/src/commits.ts
+++ b/lsif/src/commits.ts
@@ -163,7 +163,11 @@ async function gitserverExecLines(gitserverUrl: string, repository: string, args
* @param args The command to run in the repository's git directory.
*/
async function gitserverExec(gitserverUrl: string, repository: string, args: string[]): Promise<string> {
- return (await got(new URL(`http://${gitserverUrl}/exec`).href, {
+ const r = await got(new URL(`http://${gitserverUrl}/exec`).href, {
body: JSON.stringify({ repo: repository, args }),
- })).body
+ })
+ console.log({ repo: repository, args })
+ console.log(r.trailers)
+ console.log(r.body)
+ return r.body
}
- Make an
/existsrequest to lsif-server: open the Network tab and visit http://localhost:3080/github.com/sourcegraph/sourcegraph@4a7d469702c5f71bff6baa150b982e77517a5aa0/-/blob/cmd/frontend/auth/auth.go#L45 (or any other repo/file) - Notice the following error in the dev server console:
20:12:10 lsif-server | {
20:12:10 lsif-server | repo: 'github.com/sourcegraph/sourcegraph',
20:12:10 lsif-server | args: [
20:12:10 lsif-server | 'git',
20:12:10 lsif-server | 'log',
20:12:10 lsif-server | '--pretty=%H %P',
20:12:10 lsif-server | '4a7d469702c5f71bff6baa150b982e77517a5aa0',
20:12:10 lsif-server | '-5000'
20:12:10 lsif-server | ]
20:12:10 lsif-server | }
20:12:10 lsif-server | {
20:12:10 lsif-server | 'x-exec-error': 'exit status 1',
20:12:10 lsif-server | 'x-exec-exit-status': '1',
20:12:10 lsif-server | 'x-exec-stderr': "git: 'git' is not a git command. See 'git --help'. The most similar command is \tinit"
20:12:10 lsif-server | }
I believe this is caused by the presence of the git command in the args: