✨ Add `--only-untracked (-U)` to status subcommand

berkus
Jun 25, 2025, 11:06 AM
KK4N2H5O4G45I6XNPTECFVECVIHBD4DQ6INRCNQ5JUSNQ6OP7I5QC

Dependencies

  • [2] I52XSRUH Massive cleanup, and simplification
  • [3] 5BB266P6 Optional colours in the global config file
  • [4] HSEYMLO2 Adding an untracked change iterator
  • [5] NWU66ZIP Untracked files when there are no other changes
  • [6] EWZ7VHV4 pijul diff: Do not ignore the --untracked option in presence of --short.
  • [7] J33DKFPM Do not traverse unindexed directories in `pijul diff -su`
  • [8] IBLJI7IA ✨ Add `pijul status` subcommand
  • [9] YQJRT2UB ✨ Add current channel to pijul status output
  • [10] CQKIS7KR ♻️ Refactor status command's handling of repo and channel
  • [11] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [12] RAS4PCNU "Touch" the channel after `pijul diff` if the diff and the prefixes are both empty

Change contents

  • edit in pijul/src/commands/status.rs at line 20
    [8.928]
    [8.928]
    /// Show only untracked files
    #[clap(short = 'U', long = "only-untracked")]
    pub only_untracked: bool,
  • edit in pijul/src/commands/status.rs at line 33
    [10.189][9.142:188](),[9.142][9.142:188]()
    let txn = repo.pristine.txn_begin()?;
  • replacement in pijul/src/commands/status.rs at line 35
    [9.233][9.233:445]()
    let current = txn.current_channel().ok();
    writeln!(
    stdout,
    "{}",
    current.map_or_else(|| "Not on a channel".into(), |c| format!("On channel: {c}"))
    )?;
    [9.233]
    [9.445]
    {
    let txn = repo.pristine.txn_begin()?;
    let current = txn.current_channel().ok();
    writeln!(
    stdout,
    "{}",
    current.map_or_else(|| "Not on a channel".into(), |c| format!("On channel: {c}"))
    )?;
    }
    if self.only_untracked {
    let txn = repo.pristine.arc_txn_begin()?;
    return super::diff::print_untracked_files(&repo, txn);
    }
  • replacement in pijul/src/commands/diff.rs at line 133
    [6.46][7.82:215](),[7.215][5.188:206](),[5.188][5.188:206]()
    for path in untracked(&repo, txn.clone())? {
    writeln!(stdout, "U {}", path?.to_str().unwrap())?;
    }
    [6.46]
    [5.206]
    print_untracked_files(&repo, txn.clone())?;
  • replacement in pijul/src/commands/diff.rs at line 284
    [6.79][7.866:999](),[7.999][6.205:223](),[6.205][6.205:223]()
    for path in untracked(&repo, txn.clone())? {
    writeln!(stdout, "U {}", path?.to_str().unwrap())?;
    }
    [6.79]
    [2.5627]
    print_untracked_files(&repo, txn.clone())?;
  • edit in pijul/src/commands/diff.rs at line 414
    [3.951]
    [4.2185]
    }
    pub fn print_untracked_files<T: TxnTExt + Send + Sync + 'static>(
    repo: &Repository,
    txn: libpijul::ArcTxn<T>,
    ) -> Result<(), anyhow::Error> {
    let mut stdout = std::io::stdout();
    for path in untracked(&repo, txn)? {
    writeln!(stdout, "U {}", path?.to_str().unwrap())?;
    }
    Ok(())