From da159c7759418bb14af655968dfa7a98bdcb8661 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Thu, 7 May 2009 15:41:27 +0200 Subject: Git.pm: Set GIT_WORK_TREE if we set GIT_DIR Otherwise git will use the current directory as work tree which will lead to unexpected results if we operate in sub directory of the work tree. Signed-off-by: Frank Lichtenheld Acked-by: Petr Baudis Signed-off-by: Junio C Hamano --- perl/Git.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'perl') diff --git a/perl/Git.pm b/perl/Git.pm index 291ff5b53c..4313db75b5 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -1280,6 +1280,8 @@ sub _cmd_exec { my ($self, @args) = @_; if ($self) { $self->repo_path() and $ENV{'GIT_DIR'} = $self->repo_path(); + $self->repo_path() and $self->wc_path() + and $ENV{'GIT_WORK_TREE'} = $self->wc_path(); $self->wc_path() and chdir($self->wc_path()); $self->wc_subdir() and chdir($self->wc_subdir()); } -- cgit v1.2.3