From 168fac4fa3920abaa2d48f8577c727ecad586ebe Mon Sep 17 00:00:00 2001 From: Nipunn Koorapati Date: Thu, 2 Sep 2021 21:09:31 -0400 Subject: [PATCH] Improve error message when unable to initialize git index repo With this - it'll be more obvious which git repo couldn't be initialized. --- src/cargo/sources/registry/remote.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cargo/sources/registry/remote.rs b/src/cargo/sources/registry/remote.rs index 8e86b15882a..f3bc0edb53a 100644 --- a/src/cargo/sources/registry/remote.rs +++ b/src/cargo/sources/registry/remote.rs @@ -88,8 +88,9 @@ impl<'cfg> RemoteRegistry<'cfg> { // things that we don't want. let mut opts = git2::RepositoryInitOptions::new(); opts.external_template(false); - Ok(git2::Repository::init_opts(&path, &opts) - .with_context(|| "failed to initialize index git repository")?) + Ok(git2::Repository::init_opts(&path, &opts).with_context(|| { + format!("failed to initialize index git repository (in {:?})", path) + })?) } } })