From: Petr Baudis <pasky@suse•cz>
To: Frank Lichtenheld <frank@lichtenheld•de>
Cc: gitster@pobox•com, git@vger•kernel.org
Subject: Re: [PATCH RESEND] Git.pm: Set GIT_WORK_TREE if we set GIT_DIR
Date: Thu, 7 May 2009 21:40:47 +0200 [thread overview]
Message-ID: <20090507194047.GA17989@machine.or.cz> (raw)
In-Reply-To: <1241703688-6892-1-git-send-email-frank@lichtenheld.de>
On Thu, May 07, 2009 at 03:41:27PM +0200, Frank Lichtenheld wrote:
> From: Frank Lichtenheld <flichtenheld@astaro•com>
>
> 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 <flichtenheld@astaro•com>
> ---
> perl/Git.pm | 2 ++
> t/t9700-perl-git.sh | 4 ++++
> t/t9700/test.pl | 13 +++++++++++++
> 3 files changed, 19 insertions(+), 0 deletions(-)
>
> No comments and doesn't seem to have been applied, so resent unchanged.
>
> diff --git a/perl/Git.pm b/perl/Git.pm
> index 291ff5b..4313db7 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());
> }
This looks obviously correct?
You could even skip the first chdir and use $self->wc_path() .
$self->wc_subdir() in the second one to save a syscall, I guess. ;-)
I've really forgot most of the code already so it's not worth much, but
Acked-by: Petr Baudis <pasky@suse•cz>
prev parent reply other threads:[~2009-05-07 19:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 13:41 [PATCH RESEND] Git.pm: Set GIT_WORK_TREE if we set GIT_DIR Frank Lichtenheld
2009-05-07 13:41 ` [PATCH RESEND] Git.pm: Always set Repository to absolute path if autodetecting Frank Lichtenheld
2009-05-25 7:33 ` Johannes Sixt
2009-05-27 10:54 ` Frank Lichtenheld
2009-05-27 11:16 ` Johannes Sixt
2009-05-27 13:46 ` Frank Lichtenheld
2009-05-07 19:40 ` Petr Baudis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090507194047.GA17989@machine.or.cz \
--to=pasky@suse$(echo .)cz \
--cc=frank@lichtenheld$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox