git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently
Date: Sat, 3 Nov 2007 12:16:30 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0711031211520.4362@racer.site> (raw)
In-Reply-To: <fcaeb9bf0711030457se2f5f5bpd9aa463e878cd621@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1940 bytes --]

Hi,

On Sat, 3 Nov 2007, Nguyen Thai Ngoc Duy wrote:

> On 11/3/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > On Sat, 3 Nov 2007, Nguyễn Thái Ngọc Duy wrote:
> >
> > > Without this, work_tree handling code in setup_git_directory will be 
> > > activated. If you stay in root work tree (no prefix), it does not 
> > > harm. It does if you work from a subdirectory though.
> > >
> > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> > > ---
> > >  Turns out my patch on NEED_WORK_TREE is fixing a wrong place.
> > >
> > >  setup.c |    1 +
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/setup.c b/setup.c
> > > index 145eca5..6f8f769 100644
> > > --- a/setup.c
> > > +++ b/setup.c
> > > @@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
> > >                       if (chdir(work_tree_env) < 0)
> > >                               die ("Could not chdir to %s", work_tree_env);
> > >                       strcat(buffer, "/");
> > > +                     inside_work_tree = 1;
> >
> > I really have to wonder why this is needed, as it should be deduced
> > (correctly!) when you ask is_inside_work_tree().
> 
> Because setup_git_directory() does not? From what I see,
> setup_git_directory() calls setup_git_directory_gently() then check
> for inside_work_tree variable almost immediately
> (check_repository_format() does not seem to ask
> is_inside_work_tree()).

Ah, I see the problem.

>From your commit message I assumed that you fixed the wrong spot... Which 
you did not.  It would have helped me if the message had read:

	When both GIT_DIR and GIT_WORK_TREE are set, and 
	setup_git_directory_gently() changes the current working 
	directory accordingly, it should also set inside_work_tree = 1.

Your fix is the proper one, but it not only fixes setup_git_directory(), 
but all callers of setup_git_directory_gently().

Thanks,
Dscho

  parent reply	other threads:[~2007-11-03 12:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-03 10:03 [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently Nguyễn Thái Ngọc Duy
2007-11-03 11:38 ` Johannes Schindelin
     [not found]   ` <fcaeb9bf0711030457se2f5f5bpd9aa463e878cd621@mail.gmail.com>
2007-11-03 12:16     ` Johannes Schindelin [this message]
2007-11-03 13:18 ` Nguyễn Thái Ngọc Duy
2007-11-03 13:25   ` Johannes Schindelin
2007-11-04  4:33   ` Junio C Hamano
2007-11-04  7:03     ` Nguyen Thai Ngoc Duy
2007-11-07 20:42       ` Junio C Hamano
2007-11-07 20:54         ` Johannes Schindelin
2007-11-09 11:32       ` Johannes Schindelin
2007-11-09 11:34       ` [PATCH] builtin-blame: set up the work_tree before the first file access Johannes Schindelin

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=Pine.LNX.4.64.0711031211520.4362@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).