mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-26 22:10:52 +00:00
cli: branch: reject empty branch name consistently by "set"
Though "branch set" can't create new branch, this should provide a better error message.
This commit is contained in:
parent
d4e64c46b4
commit
5988a00ae4
3 changed files with 10 additions and 2 deletions
|
@ -29,7 +29,7 @@ pub struct BranchCreateArgs {
|
|||
revision: Option<RevisionArg>,
|
||||
|
||||
/// The branches to create
|
||||
#[arg(required = true, value_parser=NonEmptyStringValueParser::new())]
|
||||
#[arg(required = true, value_parser = NonEmptyStringValueParser::new())]
|
||||
names: Vec<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use clap::builder::NonEmptyStringValueParser;
|
||||
use jj_lib::object_id::ObjectId as _;
|
||||
use jj_lib::op_store::RefTarget;
|
||||
|
||||
|
@ -32,7 +33,7 @@ pub struct BranchSetArgs {
|
|||
allow_backwards: bool,
|
||||
|
||||
/// The branches to update
|
||||
#[arg(required = true)]
|
||||
#[arg(required = true, value_parser = NonEmptyStringValueParser::new())]
|
||||
names: Vec<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,13 @@ fn test_branch_empty_name() {
|
|||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
|
||||
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["branch", "set", ""]);
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
error: a value is required for '<NAMES>...' but none was supplied
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue