Skip to content
Merged
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
8 changes: 0 additions & 8 deletions src-tauri/src/cli/workspace_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ pub(super) fn handle_workspace_add(matches: &Matches) -> bool {
return false;
}

// A workspace bookmark follows its working copy, so this would move trunk.
if branch_name == default_branch_or_empty(&repo_path) {
super::log_cli_error(&format!(
"Error: invalid_arguments: '{branch_name}' is the repo's default branch; the home repo already works on it"
));
return false;
}

// Same settings the app applies when it creates a workspace.
let included_copy_files = Database::new(core::resolve_app_db_path(&repo_path))
.ok()
Expand Down
27 changes: 0 additions & 27 deletions src-tauri/tests/cli_process_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
//! and run it in shells with no display server.
#![cfg(desktop)]

mod e2e_test_helpers;

use e2e_test_helpers::{JjVerifier, TestRepo};
use std::process::{Command, Output};

fn treq(cwd: &std::path::Path, args: &[&str]) -> Output {
Expand Down Expand Up @@ -56,27 +53,3 @@ fn failing_command_exits_non_zero_without_a_display() {
assert_eq!(out.status.code(), Some(1), "{out:?}");
assert!(String::from_utf8_lossy(&out.stderr).contains("Not inside a"));
}

#[test]
fn add_refuses_a_workspace_on_the_default_branch() {
let repo = TestRepo::new().unwrap();
let trunk = repo.default_branch().to_string();
let before = JjVerifier::get_bookmark_commit_id(&repo.repo_path, &trunk).unwrap();

let out = treq(std::path::Path::new(&repo.repo_path), &["add", &trunk]);

assert_eq!(out.status.code(), Some(1), "{out:?}");
assert!(
String::from_utf8_lossy(&out.stderr).contains("default branch"),
"{out:?}"
);
assert_eq!(
JjVerifier::get_bookmark_commit_id(&repo.repo_path, &trunk).unwrap(),
before,
"the default branch bookmark must not move"
);
assert_eq!(
JjVerifier::list_workspaces(&repo.repo_path).unwrap(),
vec!["default".to_string()]
);
}
Loading