This allows to control how untracked files are folded, but also can completely turn dirwalking off.
Showing the changes to src (2 of 3 files). Show all
Unified · Split
| @@ -390,6 +390,7 @@ pub fn main() -> Result<()> { · 389 unmodified lines | ||
| 390 | 390 | ), |
| 391 | 391 | Subcommands::Status(crate::plumbing::options::status::Platform { |
| 392 | 392 | ignored, |
| 393 | + untracked, | |
| 393 | 394 | format: status_format, |
| 394 | 395 | statistics, |
| 395 | 396 | submodules, |
| @@ -428,6 +429,13 @@ pub fn main() -> Result<()> { · 32 unmodified lines | ||
| 428 | 429 | core::repository::status::Ignored::Collapsed |
| 429 | 430 | } |
| 430 | 431 | }), |
| 432 | + untracked: untracked.map(|mode| match mode.unwrap_or_default() { | |
| 433 | + crate::plumbing::options::status::Untracked::No => gix::status::UntrackedFiles::None, | |
| 434 | + crate::plumbing::options::status::Untracked::Normal => { | |
| 435 | + gix::status::UntrackedFiles::Collapsed | |
| 436 | + } | |
| 437 | + crate::plumbing::options::status::Untracked::All => gix::status::UntrackedFiles::Files, | |
| 438 | + }), | |
| 431 | 439 | output_format: format, |
| 432 | 440 | statistics, |
| 433 | 441 | thread_limit: thread_limit.or(cfg!(target_os = "macos").then_some(3)), // TODO: make this a configurable when in `gix`, this seems to be optimal on MacOS, linux scales though! MacOS also scales if reading a lot of files for refresh index |
| @@ -290,6 +290,17 @@ pub mod status { · 289 unmodified lines | ||
| 290 | 290 | // allowing to ignore directories, naturally traversing the entire content. |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | + #[derive(Default, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)] | |
| 294 | + pub enum Untracked { | |
| 295 | + /// Do not show untracked files. | |
| 296 | + No, | |
| 297 | + /// Collapse untracked directories when possible. | |
| 298 | + Normal, | |
| 299 | + /// Show individual untracked files. | |
| 300 | + #[default] | |
| 301 | + All, | |
| 302 | + } | |
| 303 | + | |
| 293 | 304 | #[derive(Default, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)] |
| 294 | 305 | pub enum Format { |
| 295 | 306 | /// A basic format that is easy to read, and useful for a first glimpse as flat list. |
| @@ -308,6 +319,9 @@ pub mod status { · 12 unmodified lines | ||
| 308 | 319 | /// If enabled, show ignored files and directories. |
| 309 | 320 | #[clap(long)] |
| 310 | 321 | pub ignored: Option<Option<Ignored>>, |
| 322 | + /// Define how to show untracked files. If set without a value, show all individual untracked files. | |
| 323 | + #[clap(long, short = 'u', require_equals = true)] | |
| 324 | + pub untracked: Option<Option<Untracked>>, | |
| 311 | 325 | /// Define how to display the submodule status. Defaults to git configuration if unset. |
| 312 | 326 | #[clap(long)] |
| 313 | 327 | pub submodules: Option<Submodules>, |