Skip to content

Commit

Permalink
cli: remove error message for invalid remote names
Browse files Browse the repository at this point in the history
Existing message suggests using `jj git remote rename`, but that's not
applicable to `jj git clone`.

This commit removes that message.
  • Loading branch information
bsdinis committed Feb 19, 2025
1 parent 00bc69b commit 41b0706
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
11 changes: 1 addition & 10 deletions cli/src/command_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,7 @@ jj currently does not support partial clones. To use jj with this repository, tr

impl From<GitRemoteManagementError> for CommandError {
fn from(err: GitRemoteManagementError) -> Self {
match err {
GitRemoteManagementError::NoSuchRemote(_) => user_error(err),
GitRemoteManagementError::RemoteAlreadyExists(_) => user_error(err),
GitRemoteManagementError::RemoteReservedForLocalGitRepo
| GitRemoteManagementError::RemoteWithSlash(_) => user_error_with_hint(
err,
"Run `jj git remote rename` to give a different name.",
),
GitRemoteManagementError::InternalGitError(err) => map_git2_error(err),
}
user_error(err)
}
}

Expand Down
2 changes: 0 additions & 2 deletions cli/tests/test_git_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,6 @@ fn test_git_clone_with_remote_named_git(subprocess: bool) {
insta::allow_duplicates! {
insta::assert_snapshot!(stderr, @r"
Error: Git remote named 'git' is reserved for local Git repository
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");
}
Expand All @@ -832,7 +831,6 @@ fn test_git_clone_with_remote_with_slashes(subprocess: bool) {
insta::allow_duplicates! {
insta::assert_snapshot!(stderr, @r"
Error: Git remotes with slashes are incompatible with jj: slash/origin
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");
}
Expand Down
6 changes: 0 additions & 6 deletions cli/tests/test_git_remotes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ fn test_git_remote_add() {
);
insta::assert_snapshot!(stderr, @r"
Error: Git remote named 'git' is reserved for local Git repository
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]);
Expand Down Expand Up @@ -135,7 +134,6 @@ fn test_git_remote_set_url() {
);
insta::assert_snapshot!(stderr, @r"
Error: Git remote named 'git' is reserved for local Git repository
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");
let (stdout, stderr) = test_env.jj_cmd_ok(
Expand Down Expand Up @@ -214,7 +212,6 @@ fn test_git_remote_rename() {
let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "rename", "foo", "git"]);
insta::assert_snapshot!(stderr, @r"
Error: Git remote named 'git' is reserved for local Git repository
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");
let (stdout, stderr) =
Expand Down Expand Up @@ -265,7 +262,6 @@ fn test_git_remote_named_git() {
let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "rename", "bar", "git"]);
insta::assert_snapshot!(stderr, @r"
Error: Git remote named 'git' is reserved for local Git repository
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");

Expand Down Expand Up @@ -317,7 +313,6 @@ fn test_git_remote_with_slashes() {
);
insta::assert_snapshot!(stderr, @r"
Error: Git remotes with slashes are incompatible with jj: another/origin
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]);
Expand Down Expand Up @@ -346,7 +341,6 @@ fn test_git_remote_with_slashes() {
);
insta::assert_snapshot!(stderr, @r"
Error: Git remotes with slashes are incompatible with jj: slash/origin
Hint: Run `jj git remote rename` to give a different name.
[EOF]
");

Expand Down

0 comments on commit 41b0706

Please sign in to comment.