put in right namespace
This commit is contained in:
parent
6e13263009
commit
0f8db6be08
@ -1,6 +1,6 @@
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
use git2::{Cred, RemoteCallbacks, Repository};
|
||||
use git2::{Cred, RemoteCallbacks, Repository, Signature};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::{schema::models::GitPushBranch, storage::DynStorageEngine};
|
||||
@ -85,6 +85,31 @@ impl GitProvider for GitHubGitProvider {
|
||||
branch: &GitPushBranch,
|
||||
) -> eyre::Result<()> {
|
||||
let repo = repo.lock().await;
|
||||
|
||||
let signature = repo.signature()?;
|
||||
|
||||
let mut index = repo.index()?;
|
||||
index.add_path(PathBuf::from(".").as_path())?;
|
||||
index.write()?;
|
||||
|
||||
let tree = index.write_tree()?;
|
||||
let tree = repo.find_tree(tree)?;
|
||||
|
||||
let parents = repo.head().map(|h| {
|
||||
h.target()
|
||||
.ok_or(eyre::anyhow!("could not fetch target"))
|
||||
.map(|t| repo.find_commit(t))
|
||||
})???;
|
||||
|
||||
repo.commit(
|
||||
None,
|
||||
&signature,
|
||||
&signature,
|
||||
branch.name.to_lowercase().replace(" ", "-").as_str(),
|
||||
&tree,
|
||||
&[&parents],
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user