Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you add your primary motivation into the commits description and why you added a flag for it

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
to fetch during clone. If present, the first matching branch is used as the
working-copy parent.

* `jj status` supports hiding the list of untracked files with flag `--hide-untracked`
and config option `ui.status-hide-untracked`.
Comment on lines +73 to +74
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see the use for the flag e.g. for scripting. When would one want the config? Why not add the paths to the .gitignore when you get tired or seeing them?

Copy link
Author

@tbodt tbodt Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I only want the config :) I simply have such bad habits with leaving untracked files in my repo root that it is no longer by any stretch useful for me to see untracked files normally (in at least some of my projects...)

This implies needing another flag that's the inverse for when I do want to check on my untracked files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, a config for people with bad habits? :) I suppose if it's common that people have this bad habit, this might make sense.

Serious question: why do you keep those untracked files in your working copy instead of adding them to your .gitignore when you see them?


### Fixed bugs

* `jj metaedit --author-timestamp` twice with the same value no longer
Expand Down
8 changes: 7 additions & 1 deletion cli/src/commands/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ pub(crate) struct StatusArgs {
/// Restrict the status display to these paths
#[arg(value_name = "FILESETS", value_hint = clap::ValueHint::AnyPath)]
paths: Vec<String>,

/// Hide untracked paths
#[arg(long)]
hide_untracked: bool,
}

#[instrument(skip_all)]
Expand All @@ -75,13 +79,15 @@ pub(crate) fn cmd_status(
ui.request_pager();
let mut formatter = ui.stdout_formatter();
let formatter = formatter.as_mut();
let hide_untracked =
args.hide_untracked || command.settings().get_bool("ui.status-hide-untracked")?;

if let Some(wc_commit) = &maybe_wc_commit {
let parent_tree = wc_commit.parent_tree(repo.as_ref())?;
let tree = wc_commit.tree()?;

let wc_has_changes = tree.id() != parent_tree.id();
let wc_has_untracked = !snapshot_stats.untracked_paths.is_empty();
let wc_has_untracked = !snapshot_stats.untracked_paths.is_empty() && !hide_untracked;
if !wc_has_changes && !wc_has_untracked {
writeln!(formatter, "The working copy has no changes.")?;
} else {
Expand Down
5 changes: 5 additions & 0 deletions cli/src/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@
"committer-date-"
]
}
},
"status-hide-untracked": {
"type": "boolean",
"default": false,
"description": "Whether the status command should behave as if the --hide-untracked flag was passed."
}
}
},
Expand Down
1 change: 1 addition & 0 deletions cli/src/config/misc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ conflict-marker-style = "diff"
# signature verification is slow, disable by default
show-cryptographic-signatures = false
bookmark-list-sort-keys = ["name"]
status-hide-untracked = false

[ui.movement]
edit = false
Expand Down
6 changes: 5 additions & 1 deletion cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2772,12 +2772,16 @@ This includes:

[Conflicted bookmarks]: https://jj-vcs.github.io/jj/latest/bookmarks/#conflicts

**Usage:** `jj status [FILESETS]...`
**Usage:** `jj status [OPTIONS] [FILESETS]...`

###### **Arguments:**

* `<FILESETS>` — Restrict the status display to these paths

###### **Options:**

* `--hide-untracked` — Hide untracked paths



## `jj tag`
Expand Down
40 changes: 40 additions & 0 deletions cli/tests/test_status_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,3 +478,43 @@ fn test_status_untracked_files() {
[EOF]
");
}

#[test]
fn test_status_hide_untracked() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"snapshot.auto-track = "none()""#);

test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let work_dir = test_env.work_dir("repo");

work_dir.write_file("untracked-file", "...");
let sub_dir = work_dir.create_dir("sub");
sub_dir.write_file("untracked-file", "...");

let output = work_dir.run_jj(["status"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
Untracked paths:
? sub/
? untracked-file
Working copy (@) : qpvuntsm e8849ae1 (empty) (no description set)
Parent commit (@-): zzzzzzzz 00000000 (empty) (no description set)
[EOF]
");

let output = work_dir.run_jj(["status", "--hide-untracked"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
The working copy has no changes.
Working copy (@) : qpvuntsm e8849ae1 (empty) (no description set)
Parent commit (@-): zzzzzzzz 00000000 (empty) (no description set)
[EOF]
");

test_env.add_config(r#"ui.status-hide-untracked=true"#);
let output = work_dir.run_jj(["status"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
The working copy has no changes.
Working copy (@) : qpvuntsm e8849ae1 (empty) (no description set)
Parent commit (@-): zzzzzzzz 00000000 (empty) (no description set)
[EOF]
");
}
1 change: 1 addition & 0 deletions docs/paid_contributors.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: squash this

Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ contribute or not.
* solson
* spectral54
* steadmon
* tbodt
* zygoloid
Loading