fix ISL create-repo flow: use non-git-backed init, pull seed commit

- extension.ts: pass --config init.prefer-git=false to sl init so repos
  aren't git-backed (which can't talk to Mononoke over EdenAPI)
- ServerToClientAPI.ts: detect and re-init git-backed repos, then pull
  the seed commit and goto main after configuring the remote
Anton Kaminsky26d ago0542c4567136parent 56f671e
2 files changed+57-3
addons/isl-server/src/ServerToClientAPI.ts
@@ -413,10 +413,52 @@
413413 throw new Error(`Failed to create repository: ${res.status} ${body}`);
414414 }
415415
416 // Configure sapling remote
417416 const cwd = this.connection.cwd;
418417 const cmd = this.connection.command ?? 'sl';
419418 const homedir = process.env.HOME ?? process.env.USERPROFILE ?? '';
419
420 // If sl init created a git-backed repo, re-init with correct format
421 const fs = await import('fs');
422 const storeRequires = path.join(cwd, '.sl', 'store', 'requires');
423 try {
424 const requires = fs.readFileSync(storeRequires, 'utf8');
425 if (requires.includes('git')) {
426 this.logger.info(
427 'Re-initializing repo: current store is git-backed, need native format for Grove',
428 );
429 fs.rmSync(path.join(cwd, '.sl'), {recursive: true, force: true});
430 await ejeca(
431 cmd,
432 [
433 'init',
434 '--config',
435 'init.prefer-git=false',
436 '--config',
437 'format.use-remotefilelog=true',
438 cwd,
439 ],
440 {cwd},
441 );
442 }
443 } catch {
444 // No .sl/store/requires means no repo yet — init fresh
445 if (!fs.existsSync(path.join(cwd, '.sl'))) {
446 await ejeca(
447 cmd,
448 [
449 'init',
450 '--config',
451 'init.prefer-git=false',
452 '--config',
453 'format.use-remotefilelog=true',
454 cwd,
455 ],
456 {cwd},
457 );
458 }
459 }
460
461 // Configure sapling remote
420462 const configPairs = [
421463 ['paths.default', `mononoke://grove.host:8443/${repoName}`],
422464 ['remotefilelog.reponame', repoName],
@@ -440,6 +482,14 @@
440482 await ejeca(cmd, ['config', '--local', key, value], {cwd});
441483 }
442484
485 // Pull the seed commit and check out main
486 try {
487 await ejeca(cmd, ['pull'], {cwd});
488 await ejeca(cmd, ['goto', 'main'], {cwd});
489 } catch (pullErr) {
490 this.logger.info('Pull after repo creation failed (may not be seeded yet):', pullErr);
491 }
492
443493 // Re-detect repo info and send it to the client
444494 const ctx = {
445495 cwd,
446496
addons/vscode/extension/extension.ts
@@ -111,7 +111,9 @@
111111 if (folderUri) {
112112 const terminal = vscode.window.createTerminal({name: 'Grove Init', cwd: folderUri.fsPath});
113113 terminal.show();
114 terminal.sendText(`${getCLICommand()} init`);
114 terminal.sendText(
115 `${getCLICommand()} init --config init.prefer-git=false --config format.use-remotefilelog=true`,
116 );
115117 }
116118 }
117119
@@ -139,7 +141,9 @@
139141 cwd: folderUri.fsPath,
140142 });
141143 terminal.show();
142 terminal.sendText(`${getCLICommand()} init`);
144 terminal.sendText(
145 `${getCLICommand()} init --config init.prefer-git=false --config format.use-remotefilelog=true`,
146 );
143147 }),
144148 );
145149
146150