git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Lederhofer <matled@gmx.net>
To: Sergio <sergio.callegari@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC] GIT_WORK_TREE
Date: Sun, 3 Jun 2007 21:32:03 +0200	[thread overview]
Message-ID: <20070603193203.GA24781@moooo.ath.cx> (raw)
In-Reply-To: <loom.20070603T175743-376@post.gmane.org>

Sergio <sergio.callegari@gmail.com> wrote:
> Matthias Lederhofer <matled <at> gmx.net> writes:
> If I am not wrong, with this we detach the WT from the REPO by letting git know
> our working tree if the working tree does not include a repo (.git) directory.
> And this is done either:
> - by setting the GIT_WORK_TREE environment variable whenever needed
> - by passing the --work-tree parameter to git when needed
> - by setting the core.worktree config option in the git repo, so that the
> repository knows where its default work tree is...
> 
> Is this correct? or am I missing some other ways?

That's right, you'd set GIT_DIR and core.worktree/GIT_WORK_TREE.

> Would it make sense to make the _WT_ know where its repo is?
>
> I.e. having something like a .git-repo file a the top dir of a WT, so that when
> git is invoked within the WT it can scan up the WT until it finds the .git-repo
> file and automatically decide that GIT_WORK_TREE is at the dir containing that
> .git-repo file and that GIT_DIR is at the file pointed by that .git-repo?

Symlinking the .git directory is quite similar to this and works
already without this patch series.  Anyway I spontaneously can think
of the following use cases, so it might be interesting to add this
feature:
- The use case Nguyen mentioned, e.g. the filesystem does not support
  symlinks and for some reason it is not possible to use the git
  repository next to the working tree.
- When executing potentially 'dangerous' programs in the working tree
  it is safer to have a file pointing to the repository than placing
  the repository or a symlink to the repository in the working tree
  (breaking the .git-repo file might be confusing but is not as bad as
  breaking the repository).
- In case of a publicly available working tree it might be ok to
  publish the path to the repository accidentially (which might happen
  if the permissions for the .git-repo file are too loose) but there
  would be no risk that wrong permissions could disclose the
  repository itself.

What I haven't thought through is if it could make sense to honor the
GIT_WORK_TREE/core.worktree setting when such a .git-repo file is used
or just use the directory containing the file as work tree.

  reply	other threads:[~2007-06-03 19:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-03 14:44 [RFC] GIT_WORK_TREE Matthias Lederhofer
2007-06-03 14:46 ` [PATCH 1/7] rev-parse: document --is-inside-git-dir Matthias Lederhofer
2007-06-03 14:46 ` [PATCH 2/7] rev-parse: introduce --is-bare-repository Matthias Lederhofer
2007-06-03 14:47 ` [PATCH 3/7] test git rev-parse Matthias Lederhofer
2007-06-06  7:01   ` [PATCH 3/7 (amend)] " Matthias Lederhofer
2007-06-03 14:47 ` [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree Matthias Lederhofer
2007-06-05  7:52   ` Junio C Hamano
2007-06-05 16:49     ` [PATCH] filter-branch: always export GIT_DIR if it is set Matthias Lederhofer
2007-06-05 17:27       ` Johannes Schindelin
2007-06-05 20:39         ` Junio C Hamano
2007-06-06  7:16       ` [PATCH (amend)] " Matthias Lederhofer
2007-06-06  7:10   ` [PATCH 4/7 (amend)] introduce GIT_WORK_TREE to specify the work tree Matthias Lederhofer
2007-06-03 14:48 ` [RFC] GIT_WORK_TREE Matthias Lederhofer
2007-06-03 14:51   ` Matthias Lederhofer
2007-06-03 14:48 ` [PATCH 6/7] extend rev-parse test for --is-inside-work-tree Matthias Lederhofer
2007-06-06  7:13   ` [PATCH 6/7 (amend)] " Matthias Lederhofer
2007-06-03 14:49 ` [PATCH 7/7] test GIT_WORK_TREE Matthias Lederhofer
2007-06-06  7:14   ` [PATCH 7/7 (amend)] " Matthias Lederhofer
2007-06-03 16:02 ` [RFC] GIT_WORK_TREE Sergio
2007-06-03 19:32   ` Matthias Lederhofer [this message]
2007-06-03 21:34     ` Sergio
2007-06-06 21:29 ` [PATCH] setup_git_directory: fix segfault if repository is found in cwd Matthias Lederhofer

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=20070603193203.GA24781@moooo.ath.cx \
    --to=matled@gmx.net \
    --cc=git@vger.kernel.org \
    --cc=sergio.callegari@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).