On Fri, 24 Apr 2015 12:54:57 -0700 (PDT)
Konrád Lőrinczi <klorin...@gmail.com> wrote:

> Well, I noticed, that I had a bug in  post-receive hook, so here is
> the fixed one:
> #!/bin/sh
> export GIT_WORK_TREE=/domains/site/test-workdir/
> export GIT_DIR=/domains/git/site-bare.git/
> cd $GIT_DIR
> git checkout -f
> However, the problem still remains.
> Also GIT_TRACE=1 did not help, there was no any useful info.

GIT_TRACE only traces your local Git instance, and has nothing to do
with the Git process working on the server side.

On the other hand, exporting GIT_TRACE=1 will be an interesting thing
to do before running `git checkout -f` if you're debugging your hook
script like I have outlined in my first response.

I would restate that you supposedly has to start using `set -e` or,
better, `set -e -u` in your hook script.  Start with [1] and the
pointers it gives.  Otherwise your hook script, as a program, is almost
as broken with regard to error handling as a typical PHP program: when
an error happens, it gets logged somewhere and the execution continues.
This is a broken logic: if you *know* you should ignore an error
running a particular command, you specifically arrange for ignoring its
error return, like with

  a_command_which_is_ok_to_fail || true

to make the script not exit when that command fails.
Otherwise anything which gone wrong will terminate the scipt.

1. http://serverfault.com/q/143445/118848

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to