diff options
author | Masatake Osanai <unpush@gmail.com> | 2011-02-15 07:13:04 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-02-14 15:28:13 -0800 |
commit | 48d9e6ae4bcb6fd08562595aed47bef7326ec144 (patch) | |
tree | 79de4fa2c09d73b2ea793db9b0bcd64bcbba1941 /git-mergetool.sh | |
parent | Git 1.7.4.1 (diff) | |
download | tgif-48d9e6ae4bcb6fd08562595aed47bef7326ec144.tar.xz |
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>
Diffstat (limited to 'git-mergetool.sh')
0 files changed, 0 insertions, 0 deletions