git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Kirillov <max@max630.net>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] setup.c: set workdir when gitdir is not default
Date: Thu, 4 Sep 2014 17:20:15 +0300	[thread overview]
Message-ID: <20140904142015.GA8894@wheezy.local> (raw)
In-Reply-To: <CACsJy8CS3jC54bTh8ySmpAmbQOycMvvnH=yMES0LJQ4zWkqLrA@mail.gmail.com>

On Thu, Sep 04, 2014 at 05:53:34PM +0700, Duy Nguyen wrote:
> On Thu, Sep 4, 2014 at 5:42 AM, Max Kirillov <max@max630.net> wrote:
>>         /* #0, #1, #5, #8, #9, #12, #13 */
>>         set_git_work_tree(".");
> 
> I wonder if we should setenv(GIT_WORK_TREE_) from inside this function
> instead. A quick glance over 'git grep set_git_work_tree' gives me the
> impression that it's safe to do so, and could cover future bugs
> similar to this.

Actually, I've been thinking about just the oppozite: remove
the setenv(GIT_DIR) from the discovery code at all. Because
backend performs the same discovery, and it would find the
same git directory itself. And leave environment variables to
be only set by user.

Currently environment variables are used for both purposes:
user can use them for hacky stuff, and git itself use them
for passing internal information. But, as we can see,
setting the variables can have bigger effect than expected.
When they are set by user, it's ok, let him try, fail and
set some else variable to adapt for his needs. But for git
code there is the discovery routines, lets just use them
always, it will cause a couple of extra (very few) IO calls
but should always give same (correct) result

-- 
Max

      reply	other threads:[~2014-09-04 14:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 22:42 [PATCH] setup.c: set workdir when gitdir is not default Max Kirillov
2014-09-04 10:44 ` Eric Sunshine
2014-09-04 14:23   ` Max Kirillov
2014-09-04 10:53 ` Duy Nguyen
2014-09-04 14:20   ` Max Kirillov [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=20140904142015.GA8894@wheezy.local \
    --to=max@max630.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@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).