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

Re: Patches for git-push --confirm and --show-subjects

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 15, 2009, 00:46 UTC
Message-ID
<7v7hw19gr5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1252970294.11581.71.camel@localhost.localdomain>
Owen Taylor <otaylor@redhat.com> writes:
> If I can figure out the rest of it, I'll look at adding a hook on top as
> a sweetener :-)
Please don't.
I seriously suggest you start from, and stick to, nothing but a hook.

The pre-push codepath is conceptually very simple --- something needs to inspect a list of <ref, old, new> and say yes or no. But what the users want needs great customizability (e.g. Daniel's sign-off validation example). It's the prime example of codepath that should have a hook and no built-in policy logic.

You have to enable the necessary hook in all your repositories, and if that bothers you, then *that* can (and should) be solved as a separate issue by devising a mechanism that can be extended to the other hooks to solve the same issue once and for all.

E.g. perhaps in $HOME/.gitconfig, you may want to allow
	[hook]
        	prePush = $HOME/.githooks/my-pre-push-hook
                preCommit = $HOME/.githooks/my-pre-commit-hook

Lack of a general mechanism to allow users to say "I want this hook to apply to all of my repositories" is not an excuse to add tons of complex code in the codepath. Just give users the mechanism and leave the policy logic to them.

Previous: Owen TaylorNext: Owen Taylor
Message 11 of 15 in “Patches for git-push --confirm and --show-subjects”
  1. Owen TaylorSep 13, 2009
  2. 1/4 push: add --confirm option to ask before sending updatesOwen Taylor, Sep 13, 2009
  3. 2/4 push: allow configuring default for --confirmOwen Taylor, Sep 13, 2009
  4. 3/4 push: add --show-subjects option to show commit synopsisOwen Taylor, Sep 13, 2009
  5. 4/4 push: allow configuring default for --show-subjectsOwen Taylor, Sep 13, 2009
  6. Junio C HamanoSep 14, 2009
  7. Junio C HamanoSep 14, 2009
  8. Owen TaylorSep 14, 2009
  9. Daniel BarkalowSep 14, 2009
  10. Owen TaylorSep 14, 2009
  11. Junio C HamanoSep 15, 2009
  12. Owen TaylorSep 15, 2009
  13. Junio C HamanoSep 15, 2009
  14. Owen TaylorSep 15, 2009
  15. Daniel BarkalowSep 15, 2009

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.