Re: git commit --verbose shows incorrect diff when pre-commit hook is used to modify files

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

 



At the time you see the diff the committing of changes has not yet been initiated. It's only after you type in the message that the ACTUAL committing starts and the hook runs.

You can print the diff of what your hook has changed by running "git diff" in it before adding changes.

12.02.2019, 00:28, "Fernando Chorney" <djsbx@xxxxxxxxx>:
> Hi,
>
> I am trying to use a pre-commit hook to modify files before they are
> to be committed. The problem I am running into is that if I use "git
> commit --verbose", which I often do so that I can see the diff, the
> diff it displays in the editor is the diff before the pre-commit hook
> was run rather than what the diff would be after the pre-commit was
> run.
>
> I would like to note, that the pre-commit hook is definitely running,
> but when git grabs the diff seems to be in the wrong place.
>
> I have set up a simple example on my github to show the problem.
> https://github.com/fchorney/pre-commit-example
>
> Is this intended behaviour, or perhaps an issue?
>
>  Thanks,
>  Fernando Chorney




[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]

  Powered by Linux