Synopsis of man page for githooks.
For example post-merge and post-rewrite hooks work perfectly with $GIT_DIR
variable. It is set automagically to .git subdirectory of my working
directory. For sure it can be defined by setting $GIT_DIR explicitly or
with --separate-git-dir option. And this is expected behavior.
But some hooks (pre-rebase for example) don't set default value for
$GIT_DIR at all. And this it does not seem obvious for me.
On Wednesday, May 27, 2015 at 3:17:47 PM UTC+3, Konstantin Khomoutov wrote:
What piece of documentation made you beleive this environment variable
has to be set when a Git hook (or a pre-rebase hook in particular) is
run? From what I gather from the git(5) and githooks(5) manual pages,
the GIT_DIR env. variable is supposed to be set by external tools (like
SCMs making use of Git), not by Git itself. That is, if this variable
is set, Git obeys it (unless the --git-dir command-line option has been
speficied when some of Git programs was run).
The git(5) manual page even explicitly states the following at the
start of its section on GIT_* env. variables:
These environment variables apply to all core Git commands.
Nb: it is worth noting that they may be used/overridden by SCMS
sitting above Git so take care if using Cogito etc.
From the sample pre-rebase script (in a freshly initialized Git
repository) I gather that it just runs various Git commands, and hence
it's supposedly run in the work tree (or in the repository folder in
case of a bare repository).
--
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.