From efc9cc98852ae60c1798963a89fc55af0c3d3c1c Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 12 Mar 2023 11:13:58 -0700 Subject: [PATCH] cli: avoid a call to `Index::num_commits()` I'm trying to remove the function from the trait. --- src/commands/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 649588e82..b89ce5784 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -3122,10 +3122,15 @@ fn cmd_debug( if let Some(default_index_store) = default_index_store { default_index_store.reinit(); let repo = repo.reload_at(repo.operation()); + let index_impl: &ReadonlyIndexWrapper = repo + .readonly_index() + .as_any() + .downcast_ref() + .expect("Default index should be a ReadonlyIndexWrapper"); writeln!( ui, "Finished indexing {:?} commits.", - repo.index().num_commits() + index_impl.stats().num_commits )?; } else { return Err(user_error(format!(