git version
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"


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

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
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to