git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: david@lang.hm
Cc: git@vger.kernel.org
Subject: Re: post-receive hook
Date: Fri, 30 May 2008 11:06:33 +0200	[thread overview]
Message-ID: <200805301106.33992.johan@herland.net> (raw)
In-Reply-To: <alpine.DEB.1.10.0805300108140.4014@asgard.lang.hm>

On Friday 30 May 2008, david@lang.hm wrote:
> I'm trying to setup a post-receive hook to do a checkout -f when I push to 
> a public repo (it's a web based tool and I want the executables to be 
> updated with a push)
> 
> unfortunantly if I just add git checkout -f to the post-receive hooks it 
> checks the files out in the .git directory.
> 
> if I do a cd .. ; git checkout -f I get an error message complaining that 
> it's not in a git repository, but if I manually cd to that directory and 
> do a checkout it works.
> 
> what am I missing here?

I'm guessing that the post-receive hook is invoked with "GIT_DIR=.", which goes bad the moment you chdir anywhere. I have this in my own update hook script:

if [ "$GIT_DIR" = "." ]; then
	GIT_DIR=`pwd`
fi

If you do this before the "cd .. ; git checkout -f", you might have better luck.


Have fun! :)

...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

  reply	other threads:[~2008-05-30  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30  8:10 post-receive hook david
2008-05-30  9:06 ` Johan Herland [this message]
2008-05-30  9:43   ` david

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200805301106.33992.johan@herland.net \
    --to=johan@herland.net \
    --cc=david@lang.hm \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).