git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: builtin command's prefix question
Date: Thu, 6 Dec 2007 22:26:29 +0700	[thread overview]
Message-ID: <fcaeb9bf0712060726r383c3a36j798a439b9dbb0cae@mail.gmail.com> (raw)
In-Reply-To: <7vlk88n648.fsf@gitster.siamese.dyndns.org>

On Dec 6, 2007 5:12 AM, Junio C Hamano <gitster@pobox.com> wrote:
> The intention is:
>
>  * If GIT_DIR is set but not GIT_WORK_TREE (nor core.worktree in
>    config), you are either inside project.git/ directory of bare
>    repository or at the toplevel of worktree-full directory.  This has
>    been the traditional behaviour before GIT_WORK_TREE and we shouldn't
>    break the existing setups that assume this behaviour.  So in that
>    sense, with this combination:
>
>    - If the repository is bare, the value of the prefix should not
>      matter; the command that wants to look at prefix by definition
>      wants to run from a subdirectory but there is no notion of
>      "the user directory being a subdirectory of the top of the work
>      tree" in a bare repository;
>
>    - If the repository is not bare, the user directory _MUST_ be at the
>      top of the work tree, as that is what the traditional behaviour is.
>      Anything else would break existing setups.
>
>      IOW, if you use GIT_DIR and still want to run from a subdirectory
>      of the worktree, you must have either GIT_WORK_TREE or
>      core.worktree to tell where the top of the worktree is, and if you
>      don't, then you must be at the top.
>
>    So the right thing to do in this case is not going anywhere and using
>    prefix=NULL.

You are right. It is quite obvious from the code. No idea why I had
that in my mind.

>  * I would say it is a misconfiguration if GIT_DIR is not set and
>    GIT_WORK_TREE is, as the sole purpose of GIT_WORK_TREE is so that you
>    can work from a subdirectory when you set GIT_DIR.  I may be missing
>    an obvious use case that this is useful, but I do not think of any.
>    Dscho may be able to correct me on this, as he fixed up the original
>    work tree series that was even messier quite a bit during the last
>    round.

On Dec 6, 2007 6:22 AM, Junio C Hamano <gitster@pobox.com> wrote:
> However, if we define setup() to behave this way when GIT_DIR is not
> defined and GIT_WORK_TREE is:
>
>  (1) internally pretend as if GIT_DIR was specified to be the
>      directory where the command was started from (iow, do getcwd()
>      once upon startup);
>
>  (2) chdir to GIT_WORK_TREE (which means "callers of setup() always
>      run from the top of the work tree");
>
>  (3) set prefix to NULL;

(1) is fine by me, even if it goes up to find a gitdir. But (3), no,
prefix should be set as relative path from worktree top directory to
user current directory, not NULL.

> ...
> While I still think the combination is simply crazy and does not make
> any sense, if enough users on the list agrees that it makes sense, I
> wouldn't mind setup() did (1) to (3) mentioned above.  The alternative
> is simply to declare GIT_WOR+1 on whatever way that makes worktree less complicated. so your alternative ++K_TREE without GIT_DIR is a nonsense and
> either error error out or ignore GIT_WORK_TREE, which might be easier to
> explain to people.

I don't use either way you mentioned. So no comment here. But again,
no (3) please.
-- 
Duy

  parent reply	other threads:[~2007-12-06 15:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-05 16:56 builtin command's prefix question Nguyen Thai Ngoc Duy
2007-12-05 22:12 ` Junio C Hamano
2007-12-05 23:22   ` Junio C Hamano
2007-12-05 23:43     ` Junio C Hamano
2007-12-06 15:26   ` Nguyen Thai Ngoc Duy [this message]
2007-12-06 15:48     ` Johannes Schindelin
2007-12-06 16:04       ` Junio C Hamano

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=fcaeb9bf0712060726r383c3a36j798a439b9dbb0cae@mail.gmail.com \
    --to=pclouds@gmail.com \
    --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).