git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Philip Oakley" <philipoakley@iee.org>
To: "Duy Nguyen" <pclouds@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Git List" <git@vger.kernel.org>, "Jeff King" <peff@peff.net>
Subject: Re: git ate my home directory :-(
Date: Tue, 26 Mar 2013 21:47:11 -0000	[thread overview]
Message-ID: <460E50A0F7A14FA796D6D74E25DA78F3@PhilipOakley> (raw)
In-Reply-To: 20130326094844.GA32583@duynguyen-vnpc.dek-tpc.internal

From: "Duy Nguyen" <pclouds@gmail.com>
Sent: Tuesday, March 26, 2013 9:48 AM
> On Tue, Mar 26, 2013 at 08:02:30AM -0000, Philip Oakley wrote:
>> >> Yeah, for historical reasons GIT_WORK_TREE defaults to $(pwd) when
>> >> GIT_DIR is explicitly set.
>> >
>> > And it *WILL* be that way til the end of time.  Unless you are at
>> > the top level of your working tree, you are supposed to tell where
>> > the top level is with GIT_WORK_TREE when you use GIT_DIR.  Always.
>>
>> Should this important warning be part of the git(1) documentation on
>> the
>> environment variables (and possibly other places) given the
>> consequences
>> of this case? It wasn't something I'd appreciated from a simple
>> reading.
>
> Something like this, maybe?
>
> -- 8< --
> Subject: [PATCH] git.txt: document the implicit working tree setting
> with GIT_DIR
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> Documentation/git.txt | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index 7efaa59..ce55abf 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -671,6 +671,8 @@ Git so take care if using Cogito etc.
>  specifies a path to use instead of the default `.git`
>  for the base of the repository.
>  The '--git-dir' command-line option also sets this value.
> + If neither GIT_WORK_TREE nor '--work-tree' is set, the
> + current directory will become the working tree.

I didn't feel this conveyed the Dire Warning effect that would be needed
to avoid the original misunderstanding.

It is easy to miss some of the potential consequences when other
priorities are pressing.

As Junio wondered, perhaps rhetorically, in a later message  "Why do
these people set GIT_DIR without setting GIT_WORK_TREE in the first
place?"

Perhaps
"If the GIT_DIR environment variable is set then it specifies a path to
use instead of the default `.git` for the base of the repository. Note
that the current directory `.` will be used as the working
GIT_WORK_TREE, if not set elsewhere. The --git-dir command-line
option also sets the GIT_DIR environment variable."


>
> 'GIT_WORK_TREE'::
>  Set the path to the working tree.  The value will not be
> -- 
> 1.8.2.82.gc24b958
> -- 8< --
> --
Philip 

  parent reply	other threads:[~2013-03-26 21:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 21:38 git ate my home directory :-( Richard Weinberger
2013-03-25 21:43 ` Jonathan Nieder
2013-03-25 22:02   ` Junio C Hamano
2013-03-25 22:08     ` Jonathan Nieder
2013-03-25 22:15       ` Junio C Hamano
2013-03-25 22:06   ` Junio C Hamano
2013-03-25 22:09     ` Richard Weinberger
2013-03-25 22:15       ` Jonathan Nieder
2013-03-25 22:20       ` Junio C Hamano
2013-03-25 22:27         ` Richard Weinberger
2013-03-25 22:13     ` Jonathan Nieder
2013-03-25 22:21       ` Brandon Casey
2013-03-26  8:02     ` Philip Oakley
2013-03-26  9:48       ` Duy Nguyen
2013-03-26 15:04         ` Jeff King
2013-03-26 16:32           ` Junio C Hamano
2013-03-27 13:05           ` Duy Nguyen
2013-03-26 21:47         ` Philip Oakley [this message]
2013-03-26 13:07       ` Richard Weinberger
2013-03-26 14:56         ` Jeff King
2013-03-26 17:06           ` Richard Weinberger
2013-03-26 17:20             ` demerphq
2013-03-26 17:48               ` Jeff King
2013-03-26 19:08                 ` demerphq
2013-03-26 17:41             ` Jeff King
2013-03-26 18:20               ` Junio C Hamano
2013-03-26 20:08                 ` Jeff King
2013-03-26 20:11                   ` [DONOTAPPLY PATCH 1/3] environment: set GIT_WORK_TREE when we figure out work tree Jeff King
2013-03-26 20:16                     ` Jonathan Nieder
2013-03-26 20:12                   ` [DONOTAPPLY PATCH 2/3] setup: warn about implicit worktree with $GIT_DIR Jeff King
2013-03-26 20:21                     ` Jonathan Nieder
2013-03-26 20:27                       ` Jeff King
2013-03-26 20:35                         ` Jonathan Nieder
2013-03-27  8:24                         ` Matthieu Moy
2013-03-26 20:13                   ` [DONOTAPPLY PATCH 3/3] setup: treat GIT_DIR without GIT_WORK_TREE as a bare repo Jeff King

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=460E50A0F7A14FA796D6D74E25DA78F3@PhilipOakley \
    --to=philipoakley@iee.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=richard@nod.at \
    /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).