fix(core): reduce snapshot repository setup (#38162)
Co-authored-by: Aiden Cline <rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
parent
6b9136e797
commit
59ad593d9c
2 changed files with 51 additions and 14 deletions
|
|
@ -148,8 +148,21 @@ describe("Git trees", () => {
|
|||
const git = yield* Git.Service
|
||||
const source = yield* git.repo.discover(AbsolutePath.make(root.path))
|
||||
if (!source) throw new Error("Repository not found")
|
||||
const storage = AbsolutePath.make(path.join(root.path, ".snapshot"))
|
||||
const storage = AbsolutePath.make(path.join(root.path, ".snapshot storage"))
|
||||
const repository = yield* git.repo.create({ worktree: source.worktree, gitDirectory: storage, seed: source })
|
||||
yield* Effect.promise(() => $`git --git-dir ${storage} config --add include.path first.gitconfig`.quiet())
|
||||
yield* Effect.promise(() => $`git --git-dir ${storage} config --add include.path second.gitconfig`.quiet())
|
||||
yield* Effect.promise(() => $`git --git-dir ${storage} config core.autocrlf true`.quiet())
|
||||
yield* git.repo.create({ worktree: source.worktree, gitDirectory: storage, seed: source })
|
||||
expect(
|
||||
yield* Effect.promise(() => $`git --git-dir ${storage} config --local --includes core.autocrlf`.text()),
|
||||
).toBe("false\n")
|
||||
expect(
|
||||
(yield* Effect.promise(() => fs.readFile(path.join(storage, "config"), "utf8"))).match(/opencode\.gitconfig/g),
|
||||
).toHaveLength(1)
|
||||
expect(
|
||||
yield* Effect.promise(() => $`git --git-dir ${storage} config --local --get-all include.path`.text()),
|
||||
).toBe("opencode.gitconfig\nfirst.gitconfig\nsecond.gitconfig\n")
|
||||
yield* git.index.refresh({ repository, scope: RelativePath.make("scope") })
|
||||
const before = yield* git.tree.write(repository)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue