Re: [RFC] gitweb wishlist and TODO list
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Jun 21, 2006, 17:36 UTC
- Message-ID
- <e7c034$1c1$1@sea.gmane.org>
- In-Reply-To
- <20060621164503.GA1285@h4x0r5.com>
Ryan Anderson wrote:
Show 11 quoted lines
> On Wed, Jun 21, 2006 at 03:05:35PM +0200, Dennis Stosberg wrote: >> (2) Setting %ENV has no effect on spawned processes under mod_perl, >> so the git commands would never find the project directories. >> My first thought was to set $GIT_DIR on the commands' command >> lines like in open($fh, '$GIT_DIR=blah git-rev-list ...') but it >> would lead to an extra shell being spawned on every invocation >> of a git command. > > I haven't looked at gitweb much, but why can't you solve this by doing > manual pipe,fork,exec combinations? That should give you complete > control over the environment, right?
In gitweb.cgi we now use magic open "-|" invocation, e.g.:
open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
in git-rerere we still fork magically, but exec explicitely
my $pid = open($in, '-|');
die "$!" unless defined $pid;
if (!$pid) {
exec(qw(git ls-files -z -u)) or die "$!: ls-files";
}The same is done in git-annotate (via open_pipe sub which takes care of ActiveState Perl implementation); git-archimport, git-cvsexportcommit (via safe_pipe_capture); git-send-email (without encapsulating in a subroutine; it also uses backticks)
git-svn uses fork + redirecting output + exec and waitpid for quiet_run subroutine and system call.
git-cvsimport uses system call, backticks, straight pipe open, i.e. using "git-command |", and magic open "-|" like gitweb.cgi. git-cvsserver has safe_pipe_capture, but sometimes uses backticks. git-fmt-merge-message uses backticks only. git-mv uses backticks and pipe. git-svnimport uses system call and pipe.
What a mess. We really need Git.pm module...
And to answer your question, AFAICT exec cannot modify environment, not like execve (or execle wrapper). POE (POE::Wheel::Run) or IPC::Run modules perhaps...
-- Jakub Narebski Warsaw, Poland ShadeHawk on #git