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

Re: Stop a git commit by a specific author using pre-commit hook

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 11, 2012, 11:05 UTC
Message-ID
<7v62ebz9c0.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4F5BDDAC.4050700@gmail.com>
Neal Kreitzinger <nkreitzinger@gmail.com> writes:
> ... at the point pre-commit is run git has not
> overriden GIT_AUTHOR_IDENT with your --author value, yet.  I don't
> know if that is a bug or not.  The prepare-commit-msg hook is the same
> way.

I'd call it a bug, as the command line --author should have the same effect as GIT_AUTHOR_NAME and friends observable by the outside world.

There are two slightly different approaches to solve this, that share the first two preparatory commits. I'll send out the preparatory ones first and then show both of these approaches.

Previous: Neal KreitzingerNext: Junio C Hamano
Message 5 of 13 in “Stop a git commit by a specific author using pre-commit hook”
  1. Adrian CornishMar 9, 2012
  2. Neal KreitzingerMar 10, 2012
  3. Junio C HamanoMar 10, 2012
  4. Neal KreitzingerMar 10, 2012
  5. Junio C HamanoMar 11, 2012
  6. 3/4 test: does pre-commit-hook learn authorship?Junio C Hamano, Mar 11, 2012
  7. Johannes SixtMar 11, 2012
  8. Junio C HamanoMar 11, 2012
  9. 3/4 ident.c: add split_ident_line() to parse formatted ident lineJunio C Hamano, Mar 11, 2012
  10. 3/3 commit: pass author/committer info to hooksJunio C Hamano, Mar 11, 2012
  11. Jeff KingMar 12, 2012
  12. 3/4 run_hook(): enhance the interface to pass arbitrary environmentJunio C Hamano, Mar 11, 2012
  13. 4/4 commit: pass author/committer info to hooksJunio C Hamano, Mar 11, 2012

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.