Skip to content

Commit 155baed

Browse files
committed
feat: create file/folder by new cl
Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
1 parent 8465977 commit 155baed

5 files changed

Lines changed: 381 additions & 268 deletions

File tree

ceres/src/api_service/import_api_service.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use jupiter::{storage::Storage, utils::converter::FromGitModel};
2626
use crate::{
2727
api_service::{ApiHandler, cache::GitObjectCache, history},
2828
model::{
29-
git::{CreateEntryInfo, EditFilePayload, EditFileResult},
29+
git::{CreateEntryInfo, CreateEntryResult, EditFilePayload, EditFileResult},
3030
tag::TagInfo,
3131
},
3232
protocol::repo::Repo,
@@ -49,10 +49,13 @@ impl ApiHandler for ImportApiService {
4949
&self.git_object_cache
5050
}
5151

52-
async fn create_monorepo_entry(&self, _: CreateEntryInfo) -> Result<String, GitError> {
53-
return Err(GitError::CustomError(
52+
async fn create_monorepo_entry(
53+
&self,
54+
_: CreateEntryInfo,
55+
) -> Result<CreateEntryResult, GitError> {
56+
Err(GitError::CustomError(
5457
"import dir does not support create entry".to_string(),
55-
));
58+
))
5659
}
5760

5861
fn strip_relative(&self, path: &Path) -> Result<PathBuf, MegaError> {

ceres/src/api_service/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use crate::{
2323
blame::{BlameQuery, BlameResult},
2424
change_list::MuiTreeNode,
2525
git::{
26-
CommitBindingInfo, CreateEntryInfo, DiffPreviewPayload, EditFilePayload,
27-
EditFileResult, TreeBriefItem, TreeCommitItem, TreeHashItem,
26+
CommitBindingInfo, CreateEntryInfo, CreateEntryResult, DiffPreviewPayload,
27+
EditFilePayload, EditFileResult, TreeBriefItem, TreeCommitItem, TreeHashItem,
2828
},
2929
tag::TagInfo,
3030
},
@@ -115,8 +115,11 @@ pub trait ApiHandler: Send + Sync {
115115
blob_ops::get_blob_as_string(self, file_path, refs).await
116116
}
117117

118-
/// Create a file or directory entry under the monorepo path. Returns the new commit id on success.
119-
async fn create_monorepo_entry(&self, file_info: CreateEntryInfo) -> Result<String, GitError>;
118+
/// Create a file or directory entry under the monorepo path.
119+
async fn create_monorepo_entry(
120+
&self,
121+
file_info: CreateEntryInfo,
122+
) -> Result<CreateEntryResult, GitError>;
120123

121124
async fn get_raw_blob_by_hash(&self, hash: &str) -> Result<Vec<u8>, MegaError> {
122125
self.get_context()

0 commit comments

Comments
 (0)