(gitRoot: string)
| 120 | } |
| 121 | |
| 122 | async function createWorkingTreeSnapshot(gitRoot: string): Promise<string> { |
| 123 | const tempDir = await mkdtemp(join(tmpdir(), "devspace-review-index-")); |
| 124 | const indexPath = join(tempDir, "index"); |
| 125 | const env = checkpointEnv(indexPath); |
| 126 | |
| 127 | try { |
| 128 | await git(gitRoot, ["read-tree", "HEAD"], { env }); |
| 129 | await git(gitRoot, ["add", "-A", "--", "."], { env }); |
| 130 | const tree = (await git(gitRoot, ["write-tree"], { env })).stdout.trim(); |
| 131 | const parent = (await git(gitRoot, ["rev-parse", "--verify", "HEAD^{commit}"])).stdout.trim(); |
| 132 | return (await git(gitRoot, ["commit-tree", tree, "-p", parent, "-m", "DevSpace review snapshot"], { env })).stdout.trim(); |
| 133 | } finally { |
| 134 | await rm(tempDir, { recursive: true, force: true }); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | function checkpointEnv(indexPath: string): NodeJS.ProcessEnv { |
| 139 | return { |
no test coverage detected