forked from mirrors/jj
Update init_external to return an error instead of unwrapping
This commit is contained in:
parent
00d8cd740d
commit
eac90fd113
1 changed files with 3 additions and 5 deletions
|
@ -75,11 +75,9 @@ impl GitBackend {
|
|||
|
||||
pub fn init_external(store_path: &Path, git_repo_path: &Path) -> Result<Self, BackendError> {
|
||||
let extra_path = store_path.join("extra");
|
||||
std::fs::create_dir(&extra_path).unwrap();
|
||||
let mut git_target_file = File::create(store_path.join("git_target")).unwrap();
|
||||
git_target_file
|
||||
.write_all(git_repo_path.to_str().unwrap().as_bytes())
|
||||
.unwrap();
|
||||
std::fs::create_dir(&extra_path)?;
|
||||
let mut git_target_file = File::create(store_path.join("git_target"))?;
|
||||
git_target_file.write_all(git_repo_path.to_str().unwrap().as_bytes())?;
|
||||
let repo = git2::Repository::open(store_path.join(git_repo_path))
|
||||
.map_err(|err| BackendError::Other(format!("Failed to open git repository: {err}")))?;
|
||||
let extra_metadata_store = TableStore::init(extra_path, HASH_LENGTH);
|
||||
|
|
Loading…
Reference in a new issue