From 66e85050801fdb48da0d88fc5c52ac4e5976117b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=BC=C3=9Fler?= Date: Tue, 28 Oct 2025 13:32:17 +0100 Subject: [PATCH] Restore default for showUntrackedFiles This restores the behaviour of `gitui` <= 0.27. --- asyncgit/src/sync/status.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/asyncgit/src/sync/status.rs b/asyncgit/src/sync/status.rs index b86155f094..18366fa573 100644 --- a/asyncgit/src/sync/status.rs +++ b/asyncgit/src/sync/status.rs @@ -177,11 +177,23 @@ pub fn get_status( let repo: gix::Repository = gix_repo(repo_path)?; - let mut status = repo.status(gix::progress::Discard)?; + let show_untracked = if let Some(config) = show_untracked { + config + } else { + let git2_repo = crate::sync::repository::repo(repo_path)?; + + // Calling `untracked_files_config_repo` ensures compatibility with `gitui` <= 0.27. + // `untracked_files_config_repo` defaults to `All` while both `libgit2` and `gix` default to + // `Normal`. According to [show-untracked-files], `normal` is the default value that `git` + // chooses. + // + // [show-untracked-files]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-statusshowUntrackedFiles + untracked_files_config_repo(&git2_repo)? + }; - if let Some(config) = show_untracked { - status = status.untracked_files(config.into()); - } + let status = repo + .status(gix::progress::Discard)? + .untracked_files(show_untracked.into()); let mut res = Vec::new();