gitoxide not ready yet

This commit is contained in:
Quaternions 2024-01-13 15:29:31 -08:00
parent c8fe02160e
commit 2d9b1024be

View File

@ -853,7 +853,9 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,De
time:gix::date::Time::new(asset_version.created.timestamp(),0),
};
let tree_id={
let mut tree_index = repo.index()?;
let mut tree = repo.index()?;
tree.index()?.
tree.peel_to_entry(path);
tree_index.add_all([config.output_folder.as_path()].iter(),gix::IndexAddOption::DEFAULT,None)?;
if tree_index.len()==0{
println!("tree_index.len()==0");
@ -864,14 +866,12 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,De
tree_index.write()?;
tree_index.write_tree()?
};
let tree=repo.find_tree(tree_id)?;
let tree=repo.tree(tree_id)?;
let mut parents=Vec::new();
match repo.head(){
Ok(reference)=>{
let commit=reference.peel_to_commit_in_place()?;
match repo.head_commit(){
Ok(commit)=>{
//test tree against commit tree to see if there is any changes
let commit_tree=commit.tree()?;
let diff=repo.diff_resource_cache(Some(&commit_tree),Some(&tree),None)?;
@ -882,7 +882,10 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,De
parents.push(commit.id());
},
Err(e)=>println!("repo head error {:?}",e),
//If the repo head is not found, great, continue and make the first commit
Err(gix::reference::head_commit::Error::Head(gix::reference::find::existing::Error::NotFound))=>(),
//for other errors
Err(e)=>Err(e)?,
};
repo.commit_as(