From: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>
To: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] setup_git_directory: Setup cwd properly if worktree is found
Date: Tue, 27 Nov 2007 21:12:27 +0700 [thread overview]
Message-ID: <fcaeb9bf0711270612p52ce20eaue39eac1d529c3fd3@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0711121224430.4362@racer.site>
On Nov 12, 2007 7:31 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Mon, 12 Nov 2007, Nguyen Thai Ngoc Duy wrote:
>
> > On Nov 12, 2007 6:57 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> >
> > > But what about setup_git_directory_gently()? If the working tree is
> > > overridden by the config, this function is still bogus, right?
> >
> > Hmm.. thinking a little bit more. I guess you're right because
> > GIT_WORK_TREE takes precedence over core.worktree. Maybe some more bits
> > for check_repository_format_version(). Tough decision because, from the
> > value of inside_work_tree, we don't know if we can safely skip
> > overriding inside_work_tree.
>
> I was thinking about adding check_repository_format_version() and a check
> for inside_work_tree < 0 with obvious handling in two places, probably as
> a function: first, when we have a gitdirenv but no work_tree_env, and
> second, at the end of _gently() when we found a git dir but only if
> work_tree_env was not set.
>
> > > As far as I see, setup_git_directory_gently() only works correctly
> > > when core.worktree is _not_ set, unless GIT_WORK_TREE is set (which is
> > > supposed to override the config setting). Note: I treat GIT_WORK_TREE
> > > the same as --work-tree, since at that time they are identical.
> > >
> > > Maybe the config stuff has to move into _gently()?
> >
> > Well, it could be a bit more complicated because you need to know
> > GIT_DIR first before reading config. I'd rather not move as _gently()
> > is complicated already.
>
> AFAICT it is not a question of complexity, but of correctness. Wouldn't
> you agree that the prefix _gently() returns is wrong if we don't fix it?
>
> Besides, it might be needed anyway if we are serious about the version
> check. This check, however, would have to be done _whenever_ we found a
> git directory, not only when work_tree_env is NULL.
Question time. setup_git_directory_gently() can be happy even if there
is no repository. Now if we move version check into setup_..._gently
and it finds git program is too old to handle the repository, what
would we do? die() like in check_repository_format() or tell the
caller there is no repository?
--
Duy
next prev parent reply other threads:[~2007-11-27 14:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-12 11:24 [PATCH] setup_git_directory: Setup cwd properly if worktree is found Nguyễn Thái Ngọc Duy
2007-11-12 11:57 ` Johannes Schindelin
[not found] ` <fcaeb9bf0711120413w180c07e1qbf1b186753593d7@mail.gmail.com>
2007-11-12 12:31 ` Johannes Schindelin
2007-11-27 14:12 ` Nguyen Thai Ngoc Duy [this message]
2007-11-27 14:46 ` Johannes Schindelin
2007-11-12 12:53 ` Johannes Sixt
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=fcaeb9bf0711270612p52ce20eaue39eac1d529c3fd3@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).