git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git diff from a pre-commit hook

From
MSMichael Strelnikov <michaelst@gmail.com>
Date
Feb 17, 2020, 09:00 UTC
Message-ID
<CANno94g7S68OfXNJ5B-uKR5=oZn3dsuDsuZHnKrh7tXzYWPNig@mail.gmail.com>
Hello,
   I'm trying to implement the pre-commit hook and faced a problem.
   1. If I just run command "git diff --staged --name-only
--diff-filter=A" I get an error: "fatal: unable to read [SHA]"
   2. After searching for solutions I found that for a pre-commit hook
I have to re-set the GIT_INDEX_FILE variable to ".git/index". After
doing that I see that diff is not honoring the "info/exclude"
settings.
Is there anything else I need to set to make diff working properly?

Best regards, Michael Strelnikov

Message 1 of 1 in “git diff from a pre-commit hook”
  1. Michael StrelnikovFeb 17, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.