From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "martin f. krafft" <madduck@madduck.net>, git@vger.kernel.org
Subject: Re: [PATCH] Export GIT_DIR after setting it
Date: Thu, 15 May 2008 19:55:55 +0200 [thread overview]
Message-ID: <20080515175555.GA13003@atjola.homenet> (raw)
In-Reply-To: <7vlk2bh45u.fsf@gitster.siamese.dyndns.org>
On 2008.05.15 10:23:57 -0700, Junio C Hamano wrote:
> "martin f. krafft" <madduck@madduck.net> writes:
>
> > The only problem I see now is when an external command (or the shell
> > script) can't properly deal with GIT_DIR being set, but then that's
> > a whole different bug.
>
> One thing that we did not have to worry about when git-sh-setup was
> invented is GIT_WORK_TREE and its cousin core.worktree. When the user
> uses GIT_DIR _but_ wants to work from a subdirectory of the checked out
> work tree, the user _must_ tell git where the top of the work tree is; in
> other words, setting and exporting only GIT_DIR is a misconfiguration.
>
> I have a suspicion that "the whole different bug" is what bit you --
> perhaps some places need to also set and export GIT_WORK_TREE as well when
> the do GIT_DIR.
For completeness, here's an actual example of how it breaks:
doener@atjola:g $ git_fake_bare_checkout() {
> url="$1"
> repo="$2"
> worktree="$3"
> git clone --no-checkout "$url" "$repo"
> cd "$repo"
> mkdir -p "$worktree"
> git read-tree HEAD
> git checkout-index -a --prefix="$worktree" || true
> git config core.worktree "$worktree"
> mv .git/* .
> rmdir .git
> }
doener@atjola:g $ git_fake_bare_checkout
git://git.madduck.net/etc/git.git git.git ../
Initialized empty Git repository in /home/doener/g/git.git/.git/
Receiving objects: 100% (6/6), done.
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
doener@atjola:git.git (master) $ git fetch
doener@atjola:git.git (master) $ git pull
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
So the git directory is not called .git but git.git, with core.worktree
set to "../". When "git fetch" is called directly, it correctly finds
that the git dir is "." Same for "git pull", but as GIT_DIR is neither
set in the environment, nor exported by git-pull, the commands that get
executed by git-pull do not find the git dir, because git-pull does
cd_to_toplevel first, and obviously the other commands won't look for
git.git, but just .git.
It kind of feels like a bug that git-pull does not export GIT_DIR there,
but you could probably also argue that it is wrong not to have GIT_DIR
set in the environment when using a non-standard name for the git dir.
Hm?
Björn
next prev parent reply other threads:[~2008-05-15 17:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 23:23 [PATCH] Export GIT_DIR after setting it martin f. krafft
2008-05-15 2:25 ` Junio C Hamano
2008-05-15 10:15 ` martin f. krafft
2008-05-15 17:23 ` Junio C Hamano
2008-05-15 17:55 ` Björn Steinbrink [this message]
2008-05-15 18:28 ` martin f. krafft
2008-05-15 18:44 ` Björn Steinbrink
2008-05-16 21:50 ` martin f. krafft
2008-05-20 16:17 ` martin f. krafft
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=20080515175555.GA13003@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=madduck@madduck.net \
/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).