git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* GIT_DIR=. for hooks?
@ 2010-01-06 13:55 Michael J Gruber
  2010-01-06 17:13 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Michael J Gruber @ 2010-01-06 13:55 UTC (permalink / raw)
  To: Git Mailing List

Hi there,

as it seems hooks (at least post-receive) are called with a $PWD in the
.git dir and GIT_DIR=. exported.

Now, that leads to problems when, say, diffing between the index and the
worktree ("Don't do that!", I know). Without cd'ing around, the worktree
is not found, and after "cd ..", the git-dir is not found.

I can unset GIT_DIR or set WORK_TREE, of course, but I'm wondering
whether GIT_DIR=. is a sane setting at all: a git-dir in $PWD is always
found, and when cd'ing away that setting does not help either.

Michael

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GIT_DIR=. for hooks?
  2010-01-06 13:55 GIT_DIR=. for hooks? Michael J Gruber
@ 2010-01-06 17:13 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2010-01-06 17:13 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Git Mailing List

Michael J Gruber <git@drmicha.warpmail.net> writes:

> I can unset GIT_DIR or set WORK_TREE, of course,

That is not just an acceptable but _the_ right way to write hooks that
touch the files in the work tree.  In earlier versions of git, a git-dir
in $PWD was not found without GIT_DIR=. and hooks are supposed to work
across versions of git, so this behaviour got stuck.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-06 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06 13:55 GIT_DIR=. for hooks? Michael J Gruber
2010-01-06 17:13 ` Junio C Hamano

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).