From 2d9b1024beff8a550adab51b7be4bc6e59b8cc7e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 13 Jan 2024 15:29:31 -0800 Subject: [PATCH] gitoxide not ready yet --- src/main.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 498f0a8..3738b85 100644 --- a/src/main.rs +++ b/src/main.rs @@ -853,7 +853,9 @@ async fn write_commit(config:WriteCommitConfig,b:Result{ - 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:Resultprintln!("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(