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: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently
Date: Fri, 9 Nov 2007 11:32:24 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0711091129450.4362@racer.site> (raw)
In-Reply-To: <20071104070307.GA26071@laptop>

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

Hi,

On Sun, 4 Nov 2007, Nguyen Thai Ngoc Duy wrote:

> On Sat, Nov 03, 2007 at 09:33:40PM -0700, Junio C Hamano wrote:
> > Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> > 
> > > 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.
> > >
> > > 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.
> > 
> > Please add automated test script for this, thanks.
> > 
> 
> Thank you for reminding.  I tried to put a test in
> t1501-worktree.sh and found out core.worktree can override
> inside_work_tree previously set by setup_git_directory_gently(),
> activating the worktree code in setup_git_directory() again.
> 
> This made me think setup_git_directory_gently() should use
> get_git_work_tree() instead. But then git_work_tree_cfg may not be
> initialized when get_git_work_tree() is called (starting from
> setup_git_directory(), git_work_tree_cfg is initialized in
> check_repository_format_version(), which is called _after_
> setup_git_directory_gently()).
> 
> The interaction between these variables and functions is really beyond
> my knowledge. Johannes, can you have a look at this? In theory the
> following test should pass:
> 
> diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
> index 7ee3820..bdb7720 100755
> --- a/t/t1501-worktree.sh
> +++ b/t/t1501-worktree.sh
> @@ -103,6 +103,11 @@ test_expect_success 'repo finds its work tree from work tree, too' '
>  	 test sub/dir/tracked = "$(git ls-files)")
>  '
>  
> +test_expect_success 'Try a command from subdir in worktree' '
> +	(cd repo.git/work/sub &&
> +	GIT_DIR=../.. GIT_WORK_TREE=.. git blame dir/tracked)
> +'
> +
>  test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '
>  	cd repo.git/work/sub/dir &&
>  	GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \

This does not really test work_tree, but if blame uses the work_tree 
machinery correctly.

I will send out a patch to builtin-blame.c in a minute.

However, this test case still fails, since blame needs a HEAD revision!  
And in t1501 there is no commit done yet.

Ciao,
Dscho

  parent reply	other threads:[~2007-11-09 11:32 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
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 [this message]
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.0711091129450.4362@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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).