mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
perf(git_status): avoid gix index load when core.fsmonitor is used (#6817)
This commit is contained in:
@@ -29,7 +29,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
// TODO: remove this special case once `gitoxide` can handle sparse indices for tree-index comparisons.
|
// TODO: remove this special case once `gitoxide` can handle sparse indices for tree-index comparisons.
|
||||||
let stats = if gix_repo.index_or_empty().ok()?.is_sparse() || repo.fs_monitor_value_is_true {
|
let stats = if repo.fs_monitor_value_is_true || gix_repo.index_or_empty().ok()?.is_sparse() {
|
||||||
let mut git_args = vec!["diff", "--shortstat"];
|
let mut git_args = vec!["diff", "--shortstat"];
|
||||||
if config.ignore_submodules {
|
if config.ignore_submodules {
|
||||||
git_args.push("--ignore-submodules");
|
git_args.push("--ignore-submodules");
|
||||||
|
|||||||
@@ -250,8 +250,8 @@ fn get_repo_status(
|
|||||||
let has_untracked = !config.untracked.is_empty();
|
let has_untracked = !config.untracked.is_empty();
|
||||||
let git_config = gix_repo.config_snapshot();
|
let git_config = gix_repo.config_snapshot();
|
||||||
if config.use_git_executable
|
if config.use_git_executable
|
||||||
|| gix_repo.index_or_empty().ok()?.is_sparse()
|
|
||||||
|| repo.fs_monitor_value_is_true
|
|| repo.fs_monitor_value_is_true
|
||||||
|
|| gix_repo.index_or_empty().ok()?.is_sparse()
|
||||||
{
|
{
|
||||||
let mut args = vec!["status", "--porcelain=2"];
|
let mut args = vec!["status", "--porcelain=2"];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user