Skip to content

Commit 98089bf

Browse files
authored
chore(git): improve logging (starship#4273)
1 parent f52ae55 commit 98089bf

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/context.rs

+17-5
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,25 @@ impl<'a> Context<'a> {
285285
..git::Permissions::default_for_level(git_sec::Trust::Full)
286286
});
287287

288-
let shared_repo = ThreadSafeRepository::discover_with_environment_overrides_opts(
289-
&self.current_dir,
290-
Default::default(),
291-
git_open_opts_map,
292-
)?;
288+
let shared_repo =
289+
match ThreadSafeRepository::discover_with_environment_overrides_opts(
290+
&self.current_dir,
291+
Default::default(),
292+
git_open_opts_map,
293+
) {
294+
Ok(repo) => repo,
295+
Err(e) => {
296+
log::debug!("Failed to find git repo: {e}");
297+
return Err(e);
298+
}
299+
};
293300

294301
let repository = shared_repo.to_thread_local();
302+
log::trace!(
303+
"Found git repo: {repository:?}, (trust: {:?})",
304+
repository.git_dir_trust()
305+
);
306+
295307
let branch = get_current_branch(&repository);
296308
let remote = get_remote_repository_info(&repository, branch.as_deref());
297309
let path = repository.path().to_path_buf();

0 commit comments

Comments
 (0)