Skip to content

Commit 744a6b9

Browse files
committed
Remove .git directory when downloading a crate from git(hub)
1 parent e2ec11a commit 744a6b9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

collector/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,11 @@ fn download_from_git(target: &Path, url: &str) -> anyhow::Result<()> {
12521252
.status()
12531253
.expect("Git clone failed");
12541254
generate_lockfile(tmpdir.path());
1255+
1256+
if let Err(error) = std::fs::remove_dir_all(tmpdir.path().join(".git")) {
1257+
log::error!("Could not delete .git directory: {error:?}");
1258+
}
1259+
12551260
execute::rename(&tmpdir, &target)?;
12561261
Ok(())
12571262
}

0 commit comments

Comments
 (0)