git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zach Welch <zw@superlucidity.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Junio C Hamano <junio@siamese.dyndns.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: "GIT_INDEX_FILE" environment variable
Date: Fri, 22 Apr 2005 02:14:24 -0700	[thread overview]
Message-ID: <4268C070.3010706@superlucidity.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0504212200400.2344@ppc970.osdl.org>

Howdy,

Linus Torvalds wrote:
> On Thu, 21 Apr 2005, Junio C Hamano wrote: 
>>I am thinking about an alternative way of doing the above by
>>some modifications to the git core.  I think the root of this
>>problem is that there is no equivalent to GIT_INDEX_FILE and
>>SHA1_FILE_DIRECTORY that tells the core git where the project
>>top directory (i.e. the root of the working tree that
>>corresponds to what $GIT_INDEX_FILE describes) is.
> 
> I'd _really_ prefer to just try to teach people to work from the "top" 
> directory instead.

Would it be okay if that were settable on a per-repository basis? :)
Or do you have specific subset of operations you want restricted?

>> - A new environment variable GIT_WORKING_TREE points at the
>>   root of the working tree.
[snip]
> I really don't like it that much, but to some degree it obviously is
> exactly what "--prefix=" does to checkout-cache. It's basically saying 
> that all normal file operations have to be prefixed with a magic string. 

I'm going to script it one way or the other, but the environment route
allows me to set things up after a fork and before exec in Perl. This
works regardless of what git command I'm running, and should work even
with ithreads. This ease of use would not be the case with the
'--prefix' solution, as scripting the commands would requiring passing
arguments to those commands that need/support them at a higher level
than is desirable.

At present, I have implemented Yogi to support being able to run
commands from a different working directory than the root of the
repository, and that behavior might be per-repository settable
(someday). If I had my way, I would like to see git support the
following variables:

  GIT_WORKING_DIRECTORY   - default to '.'
  GIT_CACHE_DIRECTORTY    - default to ${GIT_WORKING_DIRECTORY}/.git
  GIT_OBJECT_DIRECTORY    - defaults to ${GIT_CACHE_DIRECTORY}/objects

The reasoning is simple: One object repository can be shared among
numerous working caches, which can be shared among multiple working
directories (e.g. any directories under the project root, but maybe also
import/exports, or other magic...). There are two layers of one to many
relationships between the three classes of directories, and my scripts
want to make use of that flexibility to the hilt.

Also, do you really think git will only ever have the index file, and
not someday possibly other related bits? (You may have said that
elsewhere, but I missed it.) If that's ever the case, the directory
variable is the way to go; scripts can be forward compatible and won't
risk accidentally mingling repository data when their scripts have only
set GIT_INDEX_FILE and not GIT_SOME_OTHER_FILE.

That said, I think GIT_INDEX_FILE would supplement the above scheme
nicely, overriding a default of ${GIT_CACHE_DIRECTORY}/index, because of
use cases you've described.

Cheers,

Zach

      parent reply	other threads:[~2005-04-22  9:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21 18:09 "GIT_INDEX_FILE" environment variable Linus Torvalds
2005-04-21 18:11 ` Davide Libenzi
2005-04-21 18:37 ` Linus Torvalds
2005-04-22  0:21 ` Junio C Hamano
2005-04-22  5:05   ` Linus Torvalds
2005-04-22  6:23     ` Junio C Hamano
2005-04-22 10:35       ` Petr Baudis
2005-04-22 19:24       ` Linus Torvalds
2005-04-22 20:20         ` Junio C Hamano
2005-04-22 22:14           ` Linus Torvalds
2005-04-22 22:31             ` Junio C Hamano
2005-04-22 22:33             ` Petr Baudis
2005-04-22 22:55               ` Linus Torvalds
2005-04-22  9:14     ` Zach Welch [this message]

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=4268C070.3010706@superlucidity.net \
    --to=zw@superlucidity.net \
    --cc=git@vger.kernel.org \
    --cc=junio@siamese.dyndns.org \
    --cc=torvalds@osdl.org \
    /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).