working mvp

This commit is contained in:
Smartsheet-JB-Brown 2025-04-12 10:22:33 -07:00
parent 6b9b2aa4de
commit 973be7640e
2 changed files with 5 additions and 5 deletions

View file

@ -92,7 +92,7 @@ export class GitFetcher {
// Force pull with overwrite
await git.fetch("origin", "main")
await git.raw(["reset", "--hard", "origin/main"])
await git.clean(["--force", "-d"])
await git.raw(["clean", "-f", "-d"])
} catch (error) {
// If pull fails with specific errors that indicate repo corruption,
// we should remove and re-clone
@ -133,7 +133,7 @@ export class GitFetcher {
await git.clone(repoUrl, repoDir)
// Reset to ensure clean state
const repoGit = simpleGit(repoDir)
await repoGit.clean(["--force", "-d"])
await repoGit.raw(["clean", "-f", "-d"])
await repoGit.raw(["reset", "--hard", "HEAD"])
} catch (error) {
// If clone fails, ensure we clean up any partially created directory

View file

@ -121,7 +121,7 @@ describe("GitFetcher", () => {
const mockGit = mockSimpleGit()
expect(mockGit.clone).toHaveBeenCalledWith(testRepoUrl, testRepoDir)
expect(mockGit.clean).toHaveBeenCalledWith(["--force", "-d"])
expect(mockGit.raw).toHaveBeenCalledWith(["clean", "-f", "-d"])
expect(mockGit.raw).toHaveBeenCalledWith(["reset", "--hard", "HEAD"])
})
@ -139,7 +139,7 @@ describe("GitFetcher", () => {
const mockGit = mockSimpleGit()
expect(mockGit.fetch).toHaveBeenCalledWith("origin", "main")
expect(mockGit.raw).toHaveBeenCalledWith(["reset", "--hard", "origin/main"])
expect(mockGit.clean).toHaveBeenCalledWith(["--force", "-d"])
expect(mockGit.raw).toHaveBeenCalledWith(["clean", "-f", "-d"])
expect(mockGit.clone).not.toHaveBeenCalled()
})
@ -197,7 +197,7 @@ describe("GitFetcher", () => {
// Second rm call is after pull failure
expect(fs.rm).toHaveBeenCalledWith(testRepoDir, { recursive: true, force: true })
expect(mockGit.clone).toHaveBeenCalledWith(testRepoUrl, testRepoDir)
expect(mockGit.clean).toHaveBeenCalledWith(["--force", "-d"])
expect(mockGit.raw).toHaveBeenCalledWith(["clean", "-f", "-d"])
expect(mockGit.raw).toHaveBeenCalledWith(["reset", "--hard", "HEAD"])
})