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

Re: obsolete index in wt_status_print after pre-commit hook runs

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 15, 2016, 17:02 UTC
Message-ID
<xmqq1t2uomw3.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<5988D847-25A2-4997-9601-083772689879@covenanteyes.com>
Andrew Keller <andrew.keller@covenanteyes.com> writes:
Show 10 quoted lines
> I have observed an interesting scenario.  Here are example reproduction steps:
>
> 1. new repository
> 2. create new pre-commit hook that invokes `git mv one two`
> 3. touch one
> 4. git add one
> 5. git commit
>
> Expected outcome: In the commit message template, I expect to see
> “Changes to be committed: new file: two"

Expected outcome is an error saying "do not modify the index inside pre-commit hook", and a rejection. It was meant as a verification mechansim (hence it can be bypassed with --no-verify), not as a way to make changes that the user didn't tell "git commit" to make.

It is just the implementation that dates back to the old days were too trusting that all users would behave (with its own definition of "behaving well", which may or may not match your expectation), did not anticipate that people would try to muck with the contents being commited in the hook, and did not implement such verification.

Previous: Andrew KellerNext: Andrew Keller
Message 2 of 13 in “obsolete index in wt_status_print after pre-commit hook runs”
  1. Andrew KellerJul 15, 2016
  2. Junio C HamanoJul 15, 2016
  3. Andrew KellerJul 15, 2016
  4. Junio C HamanoJul 15, 2016
  5. Andrew KellerJul 15, 2016
  6. Andrew KellerJul 15, 2016
  7. Junio C HamanoJul 15, 2016
  8. Junio C HamanoJul 15, 2016
  9. Andrew KellerJul 16, 2016
  10. Andrew KellerAug 3, 2016
  11. Junio C HamanoAug 4, 2016
  12. Andrew KellerAug 5, 2016
  13. Andrew KellerJul 16, 2016

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.