Skip to content

Commit dd47580

Browse files
authored
Restore default for showUntrackedFiles (#2751)
This restores the behaviour of `gitui` <= 0.27.
1 parent db211e5 commit dd47580

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

asyncgit/src/sync/status.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,23 @@ pub fn get_status(
177177

178178
let repo: gix::Repository = gix_repo(repo_path)?;
179179

180-
let mut status = repo.status(gix::progress::Discard)?;
180+
let show_untracked = if let Some(config) = show_untracked {
181+
config
182+
} else {
183+
let git2_repo = crate::sync::repository::repo(repo_path)?;
184+
185+
// Calling `untracked_files_config_repo` ensures compatibility with `gitui` <= 0.27.
186+
// `untracked_files_config_repo` defaults to `All` while both `libgit2` and `gix` default to
187+
// `Normal`. According to [show-untracked-files], `normal` is the default value that `git`
188+
// chooses.
189+
//
190+
// [show-untracked-files]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-statusshowUntrackedFiles
191+
untracked_files_config_repo(&git2_repo)?
192+
};
181193

182-
if let Some(config) = show_untracked {
183-
status = status.untracked_files(config.into());
184-
}
194+
let status = repo
195+
.status(gix::progress::Discard)?
196+
.untracked_files(show_untracked.into());
185197

186198
let mut res = Vec::new();
187199

0 commit comments

Comments
 (0)