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
This commit is contained in:
Daniel Norman
2026-05-12 11:35:52 +02:00
committed by Rūdolfs Ošiņš
parent 073a5fb574
commit 28e1ddd372
2 changed files with 1 additions and 77 deletions
+1 -76
View File
@@ -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::<Vec<_>>()
.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<AppState>, rid: RepoId) -> Result<(), Error> {
ctx.seed(rid)
-1
View File
@@ -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,