Hi,
git version 1.8.4.2 Linux 3.0.74-0.6.8-xen
"git commit" does not properly reevaluate the state after the pre-commit hook has been executed, and lists files which have been reset as part of the commit, and will create an empty commit, despite that no "--allow-empty" was given.
Steps to reproduce:
1. Create a tracked file called "ignoreme"
2. Add the following line to ".git/hooks/pre-commit":
git reset HEAD ignoreme
3. Make a change to the ignoreme file
4. Run "git commit -a"
Result:
The commit template will still list the file:
# Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: ignoreme #
Adding a commit message will create an empty commit:
ign2$ git --no-pager diff HEAD^ HEAD ign2$
Expected behavior:
- Git should refuse to continue if the pre-commit hook resets all changes - The commit message should not list files removed from the index
Best Regards Gunnar Strand