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();