diff --git a/cli/tests/test_git_remotes.rs b/cli/tests/test_git_remotes.rs index f34dd29c5e..9987a5e1b1 100644 --- a/cli/tests/test_git_remotes.rs +++ b/cli/tests/test_git_remotes.rs @@ -100,16 +100,42 @@ fn test_git_remote_set_url() { &repo_path, &["git", "remote", "add", "foo", "http://example.com/repo/foo"], ); - let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "set-url", "bar", "http://example.com/repo/bar"]); + let stderr = test_env.jj_cmd_failure( + &repo_path, + &[ + "git", + "remote", + "set-url", + "bar", + "http://example.com/repo/bar", + ], + ); insta::assert_snapshot!(stderr, @r###" Error: No git remote named 'bar' "###); - let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "set-url", "git", "http://example.com/repo/git"]); + let stderr = test_env.jj_cmd_failure( + &repo_path, + &[ + "git", + "remote", + "set-url", + "git", + "http://example.com/repo/git", + ], + ); insta::assert_snapshot!(stderr, @r###" Error: Git remote named 'git' is reserved for local Git repository "###); - let (stdout, stderr) = - test_env.jj_cmd_ok(&repo_path, &["git", "remote", "set-url", "foo", "http://example.com/repo/bar"]); + let (stdout, stderr) = test_env.jj_cmd_ok( + &repo_path, + &[ + "git", + "remote", + "set-url", + "foo", + "http://example.com/repo/bar", + ], + ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); diff --git a/lib/src/git.rs b/lib/src/git.rs index 56a4e8cd42..fc03fe766a 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -1153,7 +1153,7 @@ pub fn remote_set_url( return Err(GitRemoteManagementError::RemoteReservedForLocalGitRepo); } - // Repository::remote_set_url() doesn't ensure the remote exists, it just + // Repository::remote_set_url() doesn't ensure the remote exists, it just // creates it if it's missing. // Therefore ensure it exists first git_repo.find_remote(remote_name).map_err(|err| { @@ -1166,9 +1166,7 @@ pub fn remote_set_url( git_repo .remote_set_url(remote_name, new_remote_url) - .map_err(|err| { - GitRemoteManagementError::InternalGitError(err) - })?; + .map_err(|err| GitRemoteManagementError::InternalGitError(err))?; Ok(()) }