cli: clarify error when trying to forget non-existent workspace

When you try to forget a workspace that doesn't exist, we say "Nothing
changed.", since the transaction is empty. Let's have a specific error
instead.
This commit is contained in:
Martin von Zweigbergk 2022-02-02 22:23:50 -08:00
parent 62f541e8cd
commit 53b458a601

View file

@ -4007,6 +4007,14 @@ fn cmd_workspace_forget(
} else {
workspace_command.workspace_id()
};
if workspace_command
.repo()
.view()
.get_checkout(&workspace_id)
.is_none()
{
return Err(UserError("No such workspace".to_string()));
}
let mut tx =
workspace_command.start_transaction(&format!("forget workspace {}", workspace_id.as_str()));