Skip to content

Commit 98492d8

Browse files
authored
Add --git-dir and --work-tree to user tests (microsoft#35362)
1 parent 7a1c5b7 commit 98492d8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/testRunner/externalCompileRunner.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ namespace Harness {
5656
ts.Debug.assert(!!config.cloneUrl, "Bad format from test.json: cloneUrl field must be present.");
5757
const submoduleDir = path.join(cwd, directoryName);
5858
if (!fs.existsSync(submoduleDir)) {
59-
exec("git", ["clone", config.cloneUrl, directoryName], { cwd });
59+
exec("git", ["--work-tree", submoduleDir, "clone", config.cloneUrl, path.join(submoduleDir, ".git")], { cwd });
6060
}
6161
else {
62-
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
63-
exec("git", ["clean", "-f"], { cwd: submoduleDir });
64-
exec("git", ["pull", "-f"], { cwd: submoduleDir });
62+
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "reset", "HEAD", "--hard"], { cwd: submoduleDir });
63+
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "clean", "-f"], { cwd: submoduleDir });
64+
exec("git", ["--git-dir", path.join(submoduleDir, ".git"), "--work-tree", submoduleDir, "pull", "-f"], { cwd: submoduleDir });
6565
}
6666

6767
types = config.types;

0 commit comments

Comments
 (0)