git-exec-and-restage icon indicating copy to clipboard operation
git-exec-and-restage copied to clipboard

Blank commit created if the command results in no changes

Open motiz88 opened this issue 7 years ago • 2 comments

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

motiz88 avatar May 16 '17 10:05 motiz88

How to reproduce:

  1. make an auto-fixable change (e.g. remove a trail-coma or a ;)
  2. git add . && git commit
  3. git reset --mixed back to last commit, you will find there's nothing changed in the commit

Stupidism avatar May 16 '17 17:05 Stupidism

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.

motiz88 avatar May 17 '17 08:05 motiz88