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

Re: global hooks - once again

From
ESEugene Sajine <euguess@gmail.com>
Date
Jul 2, 2010, 19:47 UTC
Message-ID
<AANLkTikMEDUI7d5Mzwm8r43zCYTqefyI06PHOMvT1iLz@mail.gmail.com>
In-Reply-To
<7v630x1yl8.fsf@alter.siamese.dyndns.org>
On Fri, Jul 2, 2010 at 3:18 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Eugene Sajine <euguess@gmail.com> writes:
>
>> For example, so i could say
>> $ git config --global hooks.dir ~/git/hooks
>
> I don't think "global" hooks are useful for people who work on more than
> one project, or people who interact in more than one ways to projects.
> Different projects typically have different needs out of the hooks
> (e.g. pre-commit policy), and different workflows typically call for
> different needs out of the hooks (e.g. I would want to be able to rebase
> in my private working repository but not in the repository I use for
> integration of other people's branches).
>
> So I am fairly negative on your particular example above.

Well, you forgot about another half of users that are working with many projects but using one policy for example in one company, or if the guy works with several projects, but wants some of his custom hooks to be applied for all his repos/projects, for example if he want some general actions to be executed before commit, like spell check of the commit message. If I have 40 repos --global approach is the way to go. In addition, i don't think there is a downside in this particular example as it is not a mandatory property that I propose. If you need a global hook there should be an easy way to work with it. If you don't need it - just don't touch anything and work on per repo basis.

Show 9 quoted lines
>
> But it is understandable for one to use more than one repository for the
> same project and use them in the same way; in such a case, I agree that a
> way to ensure that these repositories use the same set of hooks (and
> non-hooks, e.g. commit templates, local ignore pattern files, etc.) is
> desirable.
>
> So I would imagine that your example without "--global" would be a
> reasonable thing to do once per repository.

once again it is only a part of use cases. there might be several repos/projects for one user. --global is necessary option I'm talking about user level hooks. He has no admin access to /usr/local/ and too many repos to deal with each one of them and set up hooks per repo.

>   [alias]
>   set-hooks = !"sh -c 'rm -fr .git/hooks && ln -s $1 .git/hooks' -"

This is good one, but not enough. Not that it is too difficult to execute it 40 times, but just the fact that in order to understand how to do that i had to write to git list;) Having it in git config makes it straight forward for end user and much user "friendlier"

Thanks, Eugene

Previous: Junio C HamanoNext: Peter Kjellerstedt
Message 5 of 14 in “global hooks - once again”
  1. Eugene SajineJul 2, 2010
  2. Jonathan NiederJul 2, 2010
  3. Eugene SajineJul 2, 2010
  4. Junio C HamanoJul 2, 2010
  5. Eugene SajineJul 2, 2010
  6. Peter KjellerstedtJul 5, 2010
  7. Alex RiesenJul 6, 2010
  8. Eugene SajineJul 6, 2010
  9. Peter KjellerstedtJul 6, 2010
  10. demerphqJul 6, 2010
  11. Eugene SajineJul 6, 2010
  12. Eugene SajineJul 6, 2010
  13. demerphqJul 6, 2010
  14. Jonathan NiederJul 2, 2010

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.