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

Re: How to bypass the post-commit hook?

From
JHJan Hudec <bulb@ucw.cz>
Date
Dec 31, 2007, 09:31 UTC
Message-ID
<20071231093152.GC20098@efreet.light.src>
In-Reply-To
<46dff0320712302108i61f3b868obb93f89c1c24062c@mail.gmail.com>
On Mon, Dec 31, 2007 at 13:08:05 +0800, Ping Yin wrote:
Show 18 quoted lines
> On Dec 31, 2007 5:50 AM, Jan Hudec <bulb@ucw.cz> 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.
Show 12 quoted lines
> 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 <bulb@ucw.cz>
Previous: Jan HudecNext: Jan Hudec
Message 5 of 9 in “How to bypass the post-commit hook?”
  1. Ping YinDec 30, 2007
  2. Jan HudecDec 30, 2007
  3. Pascal ObryDec 31, 2007
  4. Jan HudecJan 14, 2008
  5. Jan HudecDec 31, 2007
  6. Jan HudecDec 31, 2007
  7. Ping YinDec 31, 2007
  8. Jan HudecDec 31, 2007
  9. Ping YinDec 31, 2007

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.