perf(directory): Skip repo resolution if unused by directory config (#4401)
Skip repo resolution if its not used by directory config
This commit is contained in:
parent
03c4165927
commit
227ec32d9d
|
@ -52,7 +52,11 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
|||
|
||||
// Attempt repository path contraction (if we are in a git repository)
|
||||
// Otherwise use the logical path, automatically contracting
|
||||
let repo = context.get_repo().ok();
|
||||
let repo = if config.truncate_to_repo || config.repo_root_style.is_some() {
|
||||
context.get_repo().ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let dir_string = if config.truncate_to_repo {
|
||||
repo.and_then(|r| r.workdir.as_ref())
|
||||
.filter(|&root| root != &home_dir)
|
||||
|
|
Loading…
Reference in New Issue