From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] bare repository detection does not work with aliases
Date: Fri, 8 Mar 2013 01:37:56 -0500 [thread overview]
Message-ID: <20130308063756.GA29242@sigill.intra.peff.net> (raw)
In-Reply-To: <94c531c1-57a0-4464-9f30-3c63f0c1a056@email.android.com>
On Thu, Mar 07, 2013 at 10:27:04PM -0800, Junio C Hamano wrote:
> The $GIT_BARE idea sounds very sensible to me.
Unfortunately, it is not quite as simple as that. I just wrote up the
patch, and it turns out that we are foiled by how core.bare is treated.
If it is true, the repo is definitely bare. If it is false, that is only
a hint for us.
So we cannot just look at is_bare_repository() after setup_git_directory
runs. Because we are not "definitely bare", only "maybe bare", it
returns false. We just happen not to have a work tree. We could do
something like:
if (is_bare_repository_cfg || !work_tree)
setenv("GIT_BARE", "1", 1);
which I think would work, but feels kind of wrong. We are bare in this
instance, but somebody setting GIT_WORK_TREE in a sub-process would
want to become unbare, presumably, but our variable would override them.
Just looking through all of the code paths, I am getting a little
nervous that I would not cover all the bases for such a $GIT_BARE to
work (e.g., doing GIT_BARE=0 would not do I would expect as a user,
because of the historical way we treat core.bare=false).
So rather than introduce something like $GIT_BARE which is going to
bring about all new kinds of corner cases, I think I'd rather just pass
along a $GIT_NO_IMPLICIT_WORK_TREE variable, which is much more direct
for solving this problem, and is less likely to end up having bugs of
its own.
-Peff
next prev parent reply other threads:[~2013-03-08 6:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-07 22:47 [BUG] bare repository detection does not work with aliases Mark Lodato
2013-03-08 5:48 ` Jeff King
2013-03-08 6:27 ` Junio C Hamano
2013-03-08 6:37 ` Jeff King [this message]
2013-03-08 7:15 ` [PATCH] setup: suppress implicit "." work-tree for bare repos Jeff King
2013-03-08 7:44 ` Johannes Sixt
2013-03-08 8:42 ` Jeff King
2013-03-08 9:28 ` [PATCHv2] setup and GIT_IMPLICIT_WORK_TREE Jeff King
2013-03-08 9:29 ` [PATCH v2 1/3] cache.h: drop LOCAL_REPO_ENV_SIZE Jeff King
2013-03-08 9:30 ` [PATCH v2 2/3] environment: add GIT_PREFIX to local_repo_env Jeff King
2013-03-08 21:39 ` Eric Sunshine
2013-03-08 21:44 ` Jeff King
2013-03-08 23:03 ` Junio C Hamano
2013-03-08 9:32 ` [PATCH v2 3/3] setup: suppress implicit "." work-tree for bare repos Jeff King
2013-03-08 7:54 ` [PATCH] " Junio C Hamano
2013-03-08 8:43 ` 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=20130308063756.GA29242@sigill.intra.peff.net \
--to=peff@peff.net \
--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).