git-exec-and-restage
git-exec-and-restage copied to clipboard
Blank commit created if the command results in no changes
Originally reported by @Stupidism in https://github.com/motiz88/git-exec-and-restage/issues/5#issue-228844635:
When there's nothing to commit after cmd executed(original diff is fixed back to unchanged), the commit is blank now. It should abort commit process by exit 1
How to reproduce:
- make an auto-fixable change (e.g. remove a trail-coma or a
;
) -
git add . && git commit
-
git reset --mixed
back to last commit, you will find there's nothing changed in the commit
I see. This functionality would ideally need to interop with git commit --allow-empty
somehow. I wonder if we can detect this flag in a hook.