Skip to content

Commit

Permalink
status: show untracked files
Browse files Browse the repository at this point in the history
  • Loading branch information
cstoitner committed Dec 18, 2024
1 parent 7011056 commit 213f80a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cli/src/commands/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use jj_lib::copies::CopyRecords;
use jj_lib::repo::Repo;
use jj_lib::revset::RevsetExpression;
use jj_lib::revset::RevsetFilterPredicate;
use std::io;
use tracing::instrument;

use crate::cli_util::print_conflicted_paths;
Expand Down Expand Up @@ -47,7 +48,7 @@ pub(crate) fn cmd_status(
command: &CommandHelper,
args: &StatusArgs,
) -> Result<(), CommandError> {
let (workspace_command, _snapshot_stats) = command.workspace_helper_with_stats(ui)?;
let (workspace_command, snapshot_stats) = command.workspace_helper_with_stats(ui)?;
let repo = workspace_command.repo();
let maybe_wc_commit = workspace_command
.get_wc_commit_id()
Expand Down Expand Up @@ -85,6 +86,14 @@ pub(crate) fn cmd_status(
)?;
}

formatter.with_label("diff", |formatter| {
for path in snapshot_stats.untracked_paths.keys() {
let ui_path = workspace_command.path_converter().format_file_path(path);
writeln!(formatter.labeled("untracked"), "? {ui_path}")?;
}
io::Result::Ok(())
})?;

// TODO: Conflicts should also be filtered by the `matcher`. See the related
// TODO on `MergedTree::conflicts()`.
let conflicts = wc_commit.tree()?.conflicts().collect_vec();
Expand Down
1 change: 1 addition & 0 deletions cli/src/config/colors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"diff added" = { fg = "green" }
"diff token" = { underline = true }
"diff modified" = "cyan"
"diff untracked" = "magenta"
"diff renamed" = "cyan"
"diff copied" = "green"
"diff access-denied" = { bg = "red" }
Expand Down

0 comments on commit 213f80a

Please sign in to comment.