Re: precommit hook broken with "git commit <filename>"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 12, 2011 at 5:04 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> "C. Scott Ananian" <cscott@xxxxxxxxxx> writes:
>
>> It appears that "git commit <filename>" breaks the git precommit hook.
>> ÂEvery other git command updates the index to make the
>> commit-about-to-be-made before running the precommit hook, and indeed
>> the 'pre-commit.sample' distributed with git assumes that the index
>> reflects the commit. ÂHowever, in the case of "git commit <filename>"
>> the man page states "the commit will ignore changes staged in the
>> index, and instead record the current content of the listed files
>> (which must already be known to git)".
>
> Doesn't the command call the pre-commit hook with GIT_INDEX_FILE
> environment set to the temporary index used to create the (partial)
> commit? ÂThe sample pre-commit hook runs "diff --cached" between that
> index and HEAD (or the empty tree), and should show the change about to be
> committed.

Thanks for the quick answer.  You're right, of course.  Our tests were
subtly broken.  Now that we understand how it's supposed to work,
everything looks fine.

Great work on git, btw.  Yet another case where something I think
might be broken turns out to be working correctly (and smartly) all
along, or was recently fixed, etc...
 --scott
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]