Skip to content

Commit 454cd03

Browse files
Clean git directory on each recording run
1 parent 4f1c4e2 commit 454cd03

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

collector/src/execute/rustc.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ fn record(
3838
aid: database::ArtifactIdNumber,
3939
) -> anyhow::Result<()> {
4040
let checkout = Path::new("rust");
41+
let status = Command::new("git")
42+
.current_dir("rust")
43+
.arg("reset")
44+
.arg("--hard")
45+
.arg("origin/master")
46+
.status()
47+
.context("git reset --hard origin/master")?;
48+
assert!(status.success(), "git reset --hard successful");
49+
let status = Command::new("git")
50+
.current_dir("rust")
51+
.arg("clean")
52+
.arg("-fxd")
53+
.status()
54+
.context("git clean -fxd")?;
55+
assert!(status.success(), "git clean -fxd successful");
4156

4257
// Configure the compiler we're given as the one to use.
4358
let status = Command::new(
@@ -121,21 +136,6 @@ fn checkout() -> anyhow::Result<()> {
121136
.status()
122137
.context("git fetch origin")?;
123138
assert!(status.success(), "git fetch successful");
124-
let status = Command::new("git")
125-
.current_dir("rust")
126-
.arg("reset")
127-
.arg("--hard")
128-
.arg("origin/master")
129-
.status()
130-
.context("git reset --hard origin/master")?;
131-
assert!(status.success(), "git reset --hard successful");
132-
let status = Command::new("git")
133-
.current_dir("rust")
134-
.arg("clean")
135-
.arg("-fxd")
136-
.status()
137-
.context("git clean -fxd")?;
138-
assert!(status.success(), "git clean -fxd successful");
139139
} else {
140140
let status = Command::new("git")
141141
.arg("clone")

0 commit comments

Comments
 (0)