git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Fernando Chorney <djsbx@djsbx.com>
To: git@vger.kernel.org
Subject: git commit --verbose shows incorrect diff when pre-commit hook is used to modify files
Date: Mon, 11 Feb 2019 15:27:59 -0600	[thread overview]
Message-ID: <CANFDZM5=ffu-=H=vrO3Kr0t2km-3Zg4=msYUWqqJQKGxGojnqA@mail.gmail.com> (raw)
In-Reply-To: <CANFDZM7fsbwwqhyWTzfivm4L=GgtCMfCi+DekZurs+SFGqaOjw@mail.gmail.com>

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

       reply	other threads:[~2019-02-11 21:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANFDZM6PikancjUdm+HYgGknD0dPhzxU6yOYFLZpcnCmg8JKdA@mail.gmail.com>
     [not found] ` <CANFDZM7fsbwwqhyWTzfivm4L=GgtCMfCi+DekZurs+SFGqaOjw@mail.gmail.com>
2019-02-11 21:27   ` Fernando Chorney [this message]
2019-02-11 22:04     ` git commit --verbose shows incorrect diff when pre-commit hook is used to modify files Sergey Lukashev
2019-02-26 15:32       ` Fernando Chorney
2019-03-03  1:18         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANFDZM5=ffu-=H=vrO3Kr0t2km-3Zg4=msYUWqqJQKGxGojnqA@mail.gmail.com' \
    --to=djsbx@djsbx.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).