clean up
This commit is contained in:
@@ -62,16 +62,13 @@ impl Repo {
|
||||
pub fn init(path: &Path, name: &str, description: &str) -> Result<String> {
|
||||
use gix::refs::transaction::{Change, LogChange, PreviousValue, RefEdit, RefLog};
|
||||
|
||||
std::fs::create_dir_all(path)
|
||||
.with_context(|| format!("failed to create {}", path.display()))?;
|
||||
|
||||
std::fs::create_dir_all(path)?;
|
||||
let repo = gix::init(path)?;
|
||||
|
||||
let (signature, mut time_buf) = Self::repository_signature();
|
||||
let signature = signature.to_ref(&mut time_buf);
|
||||
|
||||
let head = gix::refs::FullName::try_from("HEAD")
|
||||
.map_err(|e| anyhow::anyhow!("invalid ref name: {e}"))?;
|
||||
let signature = signature.to_ref(&mut time_buf);
|
||||
let head = gix::refs::FullName::try_from("HEAD")?;
|
||||
|
||||
repo.edit_references_as(
|
||||
[RefEdit {
|
||||
@@ -99,7 +96,7 @@ impl Repo {
|
||||
format!("# {name}\n\n{description}\n")
|
||||
};
|
||||
|
||||
std::fs::write(path.join("README.md"), &readme).context("failed to write README.md")?;
|
||||
std::fs::write(path.join("README.md"), &readme)?;
|
||||
|
||||
let blob = repo.write_object(gix::objs::Blob {
|
||||
data: readme.into_bytes(),
|
||||
|
||||
Reference in New Issue
Block a user