Subject: Re: How to bypass the post-commit hook?

From: Jan Hudec <[email-masked]>
Date: Mon, 31 Dec 2007 10:31:52 +0100

On Mon, Dec 31, 2007 at 13:08:05 +0800, Ping Yin wrote:
> On Dec 31, 2007 5:50 AM, Jan Hudec <[email-masked]> wrote:
> >
> > On Sun, Dec 30, 2007 at 23:12:12 +0800, Ping Yin wrote:
> > > --no-verify can bypass pre-commit hook? Then how to bypass post-commit hook?
> > >
> > > Usually I want post-commit take effect. However, in the middle of
> > > git-rebase, i want to bypass post-commit when 'git-commit --amend'
> > > since my post-commit hooks will modify the working directory and so
> > > make following rebase troubesome.
> >
> > There does not seem to be an option to do it, but you can always temporarily
> > disable it (unset the executable permission on it).
> >
> > By the way, what is your post-commit hook doing anyway? Modifying the work
> > tree *after* a commit does not sound like a common thing to do.
> >
> I have already considered disabling hook temporarily, but it is a
> little annoying.

Well, I guess noone thought it would be useful to disable it.

> I use post-commit because i don't find a better way to update imported
> css version automatically
> 
> $ cat foo.css
> @import url(bar.css?57e708)
> ...
> 
> When i modify bar.css and then commit it ( with blob sha1 bf7059)，I
> use post-commit to modify foo.css
> $ cat foo.css
> @import url(bar.css?bf7059)
> ...

But that file is not versioned, is it?

Because if it is, you want to commit it in the very same commit as bar.css
and therefore want to do it in the *pre*-commit hook. Since obviously the
foo.css wants to include the current version of bar.css, not the previous
one.

Note, that while you don't know the commit sha1 before the commit, you do
know the *blob* sha1s. So you can do this change in pre-commit hook.

-- 
						 Jan 'Bulb' Hudec <[email-masked]>