gitoxide not ready yet
This commit is contained in:
15
src/main.rs
15
src/main.rs
@@ -1501,6 +1501,8 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,ro
|
||||
};
|
||||
let tree_id={
|
||||
let mut tree_index = repo.index()?;
|
||||
tree.index()?.
|
||||
tree.peel_to_entry(path);
|
||||
match tree_index.add_all(std::iter::once("*"),gix::IndexAddOption::DEFAULT,None){
|
||||
Ok(_)=>(),
|
||||
Err(e)=>println!("tree_index.add_all error: {}",e),
|
||||
@@ -1512,14 +1514,12 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,ro
|
||||
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)?;
|
||||
@@ -1530,7 +1530,10 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,ro
|
||||
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user