disallow adding of repositories with submodules due incomplete support

This commit is contained in:
Kiril Videlov 2024-02-26 13:37:39 +01:00 committed by Kiril Videlov
parent 72779bd481
commit 093f003890
2 changed files with 10 additions and 0 deletions

View File

@ -70,6 +70,10 @@ impl From<controller::AddError> for Error {
code: Code::Projects,
message: "Path not found".to_string(),
},
controller::AddError::SubmodulesNotSupported => Error::UserError {
code: Code::Projects,
message: "Repositories with git submodules are not supported".to_string(),
},
controller::AddError::User(error) => error.into(),
controller::AddError::Other(error) => {
tracing::error!(?error, "failed to add project");

View File

@ -66,6 +66,10 @@ impl Controller {
return Err(AddError::NotAGitRepository);
};
if path.join(".gitmodules").exists() {
return Err(AddError::SubmodulesNotSupported);
}
let id = uuid::Uuid::new_v4().to_string();
// title is the base name of the file
@ -254,6 +258,8 @@ pub enum AddError {
PathNotFound,
#[error("project already exists")]
AlreadyExists,
#[error("submodules not supported")]
SubmodulesNotSupported,
#[error(transparent)]
User(#[from] users::GetError),
#[error(transparent)]