From: Jeff King Date: Mon, 12 Mar 2012 11:29:21 GMT Subject: Re: [PATCH 3/3] commit: pass author/committer info to hooks Message-ID: <20120312112921.GB12921@sigill.intra.peff.net> In-Reply-To: <7vsjhfxuhh.fsf_-_@alter.siamese.dyndns.org> On Sun, Mar 11, 2012 at 04:11:38AM -0700, Junio C Hamano wrote: > However, when the command was reimplemented in C, the rewritten code > was not very faithful to the original, and hooks stopped getting the > authorship information given with "--author". Fix this by exporting > the necessary environment variables. > [...] > * This is the last patch of the simpler of the two approaches, that > builds on top of the two common preparatory patches. It uses setenv() > to directly affect the execution environment of "git commit" process, > which is closer to the original scripted Porcelain implementation. FWIW, I like this approach better. It's simpler, and I think it is perfectly sane to define "--author" as "act as if the contents were in GIT_AUTHOR_*"[1]. We do the same thing already with "git --git-dir", "git --work-tree", and other variables, and it keeps the code simple by making the environment variable the definitive source. -Peff [1] Your approach is slightly more complex, in that it handles "-c" (which is a good thing). But I think the principle is the same.