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(