I'm using the git2 crate which wraps libgit2.
I'm adding files to the index whether or not they are changed to stage them for committing.
If there are no files changed in the repo, when I commit, I get an empty commit, that I'd like to avoid. I thought calling index.is_empty() would indicate no changes, but I have a count returned from index.len().
I'd be fine resetting the index or avoid adding files to the index if they are unchanged.
How can I avoid inserting an empty commit? I know the git CLI has support for this, and can disable it with --allow-empty.