gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Having two precommit hooks


From: John Meinel
Subject: Re: [Gnu-arch-users] Having two precommit hooks
Date: Sun, 10 Oct 2004 11:13:35 -0500
User-agent: Mozilla Thunderbird 0.8 (Windows/20040913)

Thomas Lord wrote:
    > From: Mikhael Goikhman <address@hidden>

    > Like others, I thought "precommit" suggests the tree may be modified.
    > If we are going to have two precommit hooks, then I suggest to use
    > intuitive names this time, i.e. prepare-commit and confirm-commit hooks.

A "hook" is the opportunity to invoke a user-specified computation at
a point during another computation when, otherwise, such invocation
would be impossible.

A pre-commit hook that allowed tree modifications would have to be
run, in effect, before the commit did anything else at all.   But you
can already do that, without a hook, just by modifying the tree before
calling commit.

Why in the world should `tla commit' have a hook that runs before
doing anything else?  Should `cat' and `ls' have such hooks too?

-t



Here is my view on it. When I run 'tla commit' I want to make sure that what I am committing is clean with respect to whatever rules I have set up. Right now, the current hooks allow me to do that, no problem.

However, it turns out that there are some trivial corrections that can be done automatically. (Such as chmod'ing files) where I can tell my script ahead of time that I always want this. There are a few ways to do this.

1) Write a wrapper script just for tla that runs my fixup script, and then runs tla commit.
2) Have a pre-precommit hook that can run at the appropriate time.
3) Run the precommit hook which if it has to do any corrections, aborts the commit, and has me run it again. 4) Make sure that I always run the fixup script manually before running tla commit.

4 is out pretty quickly because the whole point of automating it is because I would tend to forget.

3 is what I am currently doing, because that is all tla currently supports. It's a little ugly because on my system (cygwin) it's fairly common to get spurious chmod changes. So most of my commit's will fail the first time, but succeed the second time. Leaving a lot of ,,commit-* directories that I need to remember to clean up.

2 is what I would like. Yes, it does seem like "ls" and "cat" shouldn't need these "run this before I do anything", but they don't have *any* hooks that I know of. Some of the request is because you've allowed the system to be flexible enough to do quite a bit, but it doesn't fit all circumstances. You can say that it fits the ones it needs to because you have:

1, which I might switch to if I find that 3 is too messy. It just isn't very nice to have lots of layer scripts lying everywhere. So I need to remember to always type tla-commit when I want to commit, but for everything else, I just use tla *. Because I generally use aba, it's probably not hard to alter "aba commit" as a script that runs whatever I want before "tla commit". I'll probably go down that road if you decide that tla won't change. Life goes on, workarounds will be found.

I'm just discussing the idea of hook scripts. You already had the functionality of "before I commit, make sure everything is okay." I was just asking for "before I commit, make sure everything is okay, and fix trivial errors if you can."

If you no likey, I'll do it a different way.

John
=:->

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]