1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-18 06:54:55 +01:00
git/perl
Masatake Osanai 48d9e6ae4b perl: command_bidi_pipe() method should set-up git environmens
When command_input_pipe and command_output_pipe are used as a
method of a Git::repository instance, they eventually call into
_cmd_exec method that sets up the execution environment such as
GIT_DIR, GIT_WORK_TREE environment variables and the current
working directory in the child process that interacts with the
repository.

command_bidi_pipe however didn't expect to be called as such, and
lacked all these set-up.  Because of this, a program that did this
did not work as expected:

    my $repo = Git->repository(Directory => '/some/where/else');
    my ($pid, $in, $out, $ctx) =
    $repo->command_bidi_pipe(qw(hash-object -w --stdin-paths));

This patch refactors the _cmd_exec into _setup_git_cmd_env that
sets up the execution environment, and makes _cmd_exec and
command_bidi_pipe to use it.

Note that unlike _cmd_exec that execv's a git command as an
external process, command_bidi_pipe is called from the main line
of control, and the execution environment needs to be restored
after open2() does its magic.

Signed-off-by: Masatake Osanai <unpush@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-14 15:28:13 -08:00
..
.gitignore Make perl/ build procedure ActiveState friendly. 2006-12-04 13:39:32 -08:00
Git.pm perl: command_bidi_pipe() method should set-up git environmens 2011-02-14 15:28:13 -08:00
Makefile perl/Makefile: Unset INSTALL_BASE when making perl.mak 2010-08-12 21:55:17 -07:00
Makefile.PL perl/Makefile.PL: detect MakeMaker versions incompatible with DESTDIR 2009-09-25 14:00:04 -07:00
private-Error.pm Assorted typo fixes 2007-02-03 21:49:54 -08:00