mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
fix: ensure exclude file is properly created on initial shadow repo setup
- Force write exclude file on initial creation since git creates a default one - Fix test to delete exclude file before re-initialization to test LFS patterns - Add verification that exclude patterns are properly applied
This commit is contained in:
parent
18f76b8715
commit
a52dad903b
2 changed files with 11 additions and 3 deletions
|
|
@ -109,7 +109,8 @@ export abstract class ShadowCheckpointService extends EventEmitter {
|
|||
await git.addConfig("commit.gpgSign", "false") // Disable commit signing for shadow repo.
|
||||
await git.addConfig("user.name", "Roo Code")
|
||||
await git.addConfig("user.email", "noreply@example.com")
|
||||
await this.writeExcludeFile()
|
||||
// Force write exclude file on initial creation (git creates a default one)
|
||||
await this.writeExcludeFile(true)
|
||||
await this.stageAll(git)
|
||||
const { commit } = await git.commit("initial commit", { "--allow-empty": null })
|
||||
this.baseHash = commit
|
||||
|
|
|
|||
|
|
@ -295,6 +295,11 @@ describe.each([[RepoPerTaskCheckpointService, "RepoPerTaskCheckpointService"]])(
|
|||
})
|
||||
|
||||
it("does not create a checkpoint for ignored files", async () => {
|
||||
// Verify that the exclude file was created during initialization
|
||||
const excludesPath = path.join(service.checkpointsDir, ".git", "info", "exclude")
|
||||
const excludeContent = await fs.readFile(excludesPath, "utf-8")
|
||||
expect(excludeContent).toContain("*.log")
|
||||
|
||||
// Create a file that matches an ignored pattern (e.g., .log file).
|
||||
const ignoredFile = path.join(service.workspaceDir, "ignored.log")
|
||||
await fs.writeFile(ignoredFile, "Initial ignored content")
|
||||
|
|
@ -315,10 +320,12 @@ describe.each([[RepoPerTaskCheckpointService, "RepoPerTaskCheckpointService"]])(
|
|||
const gitattributesPath = path.join(service.workspaceDir, ".gitattributes")
|
||||
await fs.writeFile(gitattributesPath, "*.lfs filter=lfs diff=lfs merge=lfs -text")
|
||||
|
||||
// Delete the exclude file to force regeneration with new LFS patterns
|
||||
const excludesPath = path.join(service.checkpointsDir, ".git", "info", "exclude")
|
||||
await fs.unlink(excludesPath).catch(() => {}) // Ignore error if file doesn't exist
|
||||
|
||||
// Re-initialize the service to trigger a write to .git/info/exclude.
|
||||
service = new klass(service.taskId, service.checkpointsDir, service.workspaceDir, () => {})
|
||||
const excludesPath = path.join(service.checkpointsDir, ".git", "info", "exclude")
|
||||
expect((await fs.readFile(excludesPath, "utf-8")).split("\n")).not.toContain("*.lfs")
|
||||
await service.initShadowGit()
|
||||
expect((await fs.readFile(excludesPath, "utf-8")).split("\n")).toContain("*.lfs")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue