| @@ -413,10 +413,52 @@ |
| 413 | 413 | throw new Error(`Failed to create repository: ${res.status} ${body}`); |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | | // Configure sapling remote |
| 417 | 416 | const cwd = this.connection.cwd; |
| 418 | 417 | const cmd = this.connection.command ?? 'sl'; |
| 419 | 418 | 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 |
| 420 | 462 | const configPairs = [ |
| 421 | 463 | ['paths.default', `mononoke://grove.host:8443/${repoName}`], |
| 422 | 464 | ['remotefilelog.reponame', repoName], |
| @@ -440,6 +482,14 @@ |
| 440 | 482 | await ejeca(cmd, ['config', '--local', key, value], {cwd}); |
| 441 | 483 | } |
| 442 | 484 | |
| 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 | |
| 443 | 493 | // Re-detect repo info and send it to the client |
| 444 | 494 | const ctx = { |
| 445 | 495 | cwd, |
| 446 | 496 | |