ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: require at least one path for jj untrack

It seems very unlikely that the user would want to untrack all paths
(that's still possible with `jj untrack .`, if they really want to,
and have added all their current paths to the `.gitignore`).
This commit is contained in:
Martin von Zweigbergk 2022-04-09 09:20:00 -07:00 committed by Martin von Zweigbergk
parent 88e34d703e
commit 9a15e32351
3 changed files with 15 additions and 0 deletions

View file

@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Errors are now printed to stderr (they used to be printed to stdout).
* `jj untrack` now requires at least one path (allowing no arguments was a UX
bug).
## [0.4.0] - 2022-04-02
### Breaking changes

View file

@ -1001,6 +1001,7 @@ struct CheckoutArgs {
/// Stop tracking specified paths in the working copy
#[derive(clap::Args, Clone, Debug)]
struct UntrackArgs {
#[clap(required = true, min_values = 1)]
paths: Vec<String>,
}

View file

@ -38,6 +38,17 @@ fn test_untrack() {
std::fs::write(repo_path.join(".gitignore"), "*.bak\n").unwrap();
let files_before = test_env.jj_cmd_success(&repo_path, &["files"]);
// Errors out when no path is specified
let stderr = test_env.jj_cmd_failure(&repo_path, &["untrack"]);
insta::assert_snapshot!(stderr.replace("jj.exe", "jj"), @r###"
error: The following required arguments were not provided:
<PATHS>...
USAGE:
jj untrack [OPTIONS] <PATHS>...
For more information try --help
"###);
// Errors out when a specified file is not ignored
let stderr = test_env.jj_cmd_failure(&repo_path, &["untrack", "file1", "file1.bak"]);
insta::assert_snapshot!(stderr, @"Error: 'file1' would be added back because it's not ignored. Make sure it's ignored, \