From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Ilya Bobyr <ilya.bobyr@gmail.com>
Subject: Re: [RFC/PATCH v2 2/3] run-command: make sure hooks have always GIT_DIR
Date: Wed, 23 Apr 2014 16:15:36 -0500 [thread overview]
Message-ID: <53582d78e82e6_24448772ecf8@nysa.notmuch> (raw)
In-Reply-To: <xmqqoazrye6w.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>
> Why is this a good change?
When a hook is called from a command without NEED_WORK_TREE, GIT_DIR is not set
(e.g. git branch).
> How does it prevent existing hook scripts from suddenly start
> misbehaving, where they do *not* expect to see an explicit GIT_DIR
> pointing at the original repository hook gets run in exported into
> their environment?
Fine, I'll use "${GIT_DIR-.git}" in my hook tests.
> For example, one of my post-receive hooks in a repository I push into records
> $cwd (which is the GIT_DIR of receiving repository), chdir's to another
> repository and then executes "git pull $cwd" from there, and that relies on
> the fact that being at the top-level of that other repository without GIT_DIR
> environment pointing at elsewhere but having .git directory in that top-level
> repository is sufficient to kick the auto-discovery of the repository that
> receives the "pull" in order to work correctly.
Let's hope post-receive is never called from a command that has NEED_WORK_TREE then.
--
Felipe Contreras
next prev parent reply other threads:[~2014-04-23 21:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 19:42 [RFC/PATCH v2 0/3] New 'update-branch' hook Felipe Contreras
2014-04-23 19:42 ` [RFC/PATCH v2 1/3] sh-setup: export GIT_DIR Felipe Contreras
2014-04-23 20:01 ` Jeff King
2014-04-23 20:18 ` Junio C Hamano
2014-04-23 19:42 ` [RFC/PATCH v2 2/3] run-command: make sure hooks have always GIT_DIR Felipe Contreras
2014-04-23 20:37 ` Junio C Hamano
2014-04-23 21:15 ` Felipe Contreras [this message]
2014-04-23 19:42 ` [RFC/PATCH v2 3/3] Add 'update-branch' hook Felipe Contreras
2014-04-23 20:28 ` Junio C Hamano
2014-04-23 21:08 ` Felipe Contreras
2014-04-23 21:22 ` Junio C Hamano
2014-04-23 21:35 ` Felipe Contreras
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=53582d78e82e6_24448772ecf8@nysa.notmuch \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ilya.bobyr@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.