#50 ✓resolved
davetron5000 (at gmail)

commit via gitx doesn't trigger pre/post-commit hook

Reported by davetron5000 (at gmail) | December 18th, 2008 @ 12:46 AM | in 0.7

I've got a post-commit hook that pushes my repo to another partition. On the command, git commits successfully trigger this hook.

GitX, however, doesn't.

I suppose it could be some sort of cwd issue (my script seems to work assuming it's run from repo root, regardless of where I run git commit).

Is there error output somewhere that GitX might let me debug what's going on?

Comments and changes to this ticket

  • Pieter de Bie

    Pieter de Bie December 22nd, 2008 @ 08:30 PM

    • State changed from “new” to “open”

    You have to explicitly call the post-commit hooks if you don't use git-commit to commit files. So, we'll have to add some logic to try and figure out if there's a hook, and if so, call it.

  • Peter Jaros

    Peter Jaros April 10th, 2009 @ 06:43 PM

    • Title changed from “commit via gitx doesn't trigger post-commit hook” to “commit via gitx doesn't trigger pre/post-commit hook”

    On the assumption that the solution will solve both problems, let me expand this to include pre-commit hooks. I've got one which stops me from committing code marked with "NOCOMMIT". Unfortunately, GitX lets me commit it, to my embarrassment. :)

  • Enrique Osuna

    Enrique Osuna April 20th, 2009 @ 09:42 PM

    I provided a potential fix to this problem, pull-request has been submitted.


    I've tested it with my local pre-/post- commit hooks and works pretty well.

  • Pieter de Bie

    Pieter de Bie April 20th, 2009 @ 10:32 PM

    Thanks for working on this. I just have a few comments:

    • I think it's nice to make the hook method return an int an take an extra NSString method, so you can use

    if ([repo executeHook:@"pre-commit" output:&str])

    perhaps you can make two methods, one taking the extra string param, and one without. I'm not sure you need the output of a hook anywhere anyway?

    • It's nice to make the extra parameter NULL-safe
    • It should return nil instead of an empty string
  • Pieter de Bie

    Pieter de Bie May 19th, 2009 @ 12:25 AM

    • State changed from “open” to “resolved”

    I did this myself, and it's now in my master branch, so I'm going to close this ticket.

  • Pieter de Bie

    Pieter de Bie June 10th, 2009 @ 01:20 PM

    • State changed from “resolved” to “open”

    We should set GIT_DIR etc. before invoking the hook, some hooks may depend on this

  • Pieter de Bie

    Pieter de Bie June 11th, 2009 @ 06:55 PM

    • Milestone set to 0.7
  • Pieter de Bie

    Pieter de Bie June 11th, 2009 @ 07:16 PM

    • State changed from “open” to “resolved”

    Fixed in f0000ca70b (PBGitRepository: Specify environment when calling hooks)

  • milan joy

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

GitX is the nice-looking gitk clone for OS X

People watching this ticket