From 28e1ddd372e441f10e563c2f22cde11898d8e563 Mon Sep 17 00:00:00 2001 From: Daniel Norman Date: Mon, 11 May 2026 12:41:04 +0200 Subject: [PATCH] Remove unused create_repo handler This handler wasn't being called by any code and diverges from a typical `rad init` flow, as it creates an empty repo with an initial empty commit. Removing this as it reduces maintenance burden --- crates/radicle-tauri/src/commands/repo.rs | 77 +---------------------- crates/radicle-tauri/src/lib.rs | 1 - 2 files changed, 1 insertion(+), 77 deletions(-) diff --git a/crates/radicle-tauri/src/commands/repo.rs b/crates/radicle-tauri/src/commands/repo.rs index d794a8500..dbb9a2e2f 100644 --- a/crates/radicle-tauri/src/commands/repo.rs +++ b/crates/radicle-tauri/src/commands/repo.rs @@ -1,13 +1,5 @@ -use std::collections::BTreeSet; -use std::str::FromStr; - use radicle::git; -use radicle::identity::project::ProjectName; -use radicle::identity::{doc, Project, RepoId, Visibility}; -use radicle::rad::InitError; -use radicle::storage::git::Repository; -use radicle::storage::refs::branch_of; -use radicle::storage::{SignRepository, WriteRepository}; +use radicle::identity::RepoId; use radicle_types as types; use radicle_types::error::Error; use radicle_types::traits::repo::{Repo, Show}; @@ -129,73 +121,6 @@ pub fn repo_commit( ctx.repo_commit(rid, sha) } -#[tauri::command] -pub(crate) async fn create_repo( - ctx: tauri::State<'_, AppState>, - name: String, - description: String, -) -> Result<(), Error> { - let profile = &ctx.profile; - let storage = &profile.storage; - let signer = ctx.profile.signer()?; - let config = git2::Config::open_default()?; - // SAFETY: "master" is always a valid RefString - let default_branch = git::fmt::RefString::try_from( - config - .get_string("init.defaultBranch") - .unwrap_or("master".to_owned()), - ) - .unwrap(); - - let name = ProjectName::from_str(&name)?; - if description.len() > doc::MAX_STRING_LENGTH { - return Err(Error::ProjectError( - radicle::identity::project::ProjectError::Description("Cannot exceed 255 characters."), - )); - } - - let visibility = Visibility::Private { - allow: BTreeSet::default(), - }; - - let proj = Project::new(name, description, default_branch.clone()).map_err(|errs| { - InitError::ProjectPayload( - errs.into_iter() - .map(|err| err.to_string()) - .collect::>() - .join(", "), - ) - })?; - let doc = radicle::identity::Doc::initial(proj, profile.public_key.into(), visibility); - let (project, identity) = Repository::init(&doc, &storage, &signer)?; - - let tree_id = { - let mut index = project.backend.index()?; - - index.write_tree() - }?; - let sig = project.backend.signature()?; - let tree = project.backend.find_tree(tree_id)?; - - project.set_remote_identity_root_to(signer.public_key(), identity)?; - project.set_identity_head_to(identity)?; - - let base = project - .backend - .commit(Some("HEAD"), &sig, &sig, "Initial commit", &tree, &[])?; - - let ns_head = branch_of(&ctx.profile.public_key, &default_branch); - project - .backend - .reference(ns_head.as_str(), base, false, "Created namespace ref")?; - - project.set_canonical_symbolic_refs("set-canonical from create_repo")?; - project.set_default_branch_to_canonical_head()?; - project.sign_refs(&signer)?; - - Ok(()) -} - #[tauri::command] pub fn seed(ctx: tauri::State, rid: RepoId) -> Result<(), Error> { ctx.seed(rid) diff --git a/crates/radicle-tauri/src/lib.rs b/crates/radicle-tauri/src/lib.rs index b76c92b0a..d4672bb1f 100644 --- a/crates/radicle-tauri/src/lib.rs +++ b/crates/radicle-tauri/src/lib.rs @@ -54,7 +54,6 @@ pub fn run() { inbox::list_notifications, profile::alias, profile::config, - repo::create_repo, repo::diff_stats, repo::list_commits, repo::list_repo_commits,