Skip to content

Commit 09b55bc

Browse files
Nemo157Joshua Nelson
andcommitted
Add comment on why we reinit index repository
Co-authored-by: Joshua Nelson <[email protected]>
1 parent 78dcb42 commit 09b55bc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/index/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ fn load_config(repo: &git2::Repository) -> Result<IndexConfig> {
4141
impl Index {
4242
pub(crate) fn new(path: impl AsRef<Path>) -> Result<Self> {
4343
let path = path.as_ref().to_owned();
44+
// This initializes the repository, then closes it afterwards to avoid leaking file descriptors.
45+
// See https://github.com/rust-lang/docs.rs/pull/847
4446
let diff = crates_index_diff::Index::from_path_or_cloned(&path)
4547
.context("initialising registry index repository")?;
4648
let config = load_config(diff.repository()).context("loading registry config")?;

0 commit comments

Comments
 (0)