All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Daniel Graña" <dangra@gmail.com>,
	git@vger.kernel.org,
	"Richard Hartmann" <richih.mailinglist@gmail.com>
Subject: Re: [PATCH] Solve git-submodule issues with detached work trees
Date: Mon, 23 Jul 2012 19:38:56 +0200	[thread overview]
Message-ID: <500D8C30.9010807@web.de> (raw)
In-Reply-To: <7vsjcjnjvj.fsf@alter.siamese.dyndns.org>

Am 23.07.2012 07:09, schrieb Junio C Hamano:
> Daniel Graña <dangra@gmail.com> writes:
> 
>> A common way to track dotfiles with git is using GIT_DIR and
>> GIT_WORK_TREE to move repository out of ~/.git with something like:
>>
>>     git init --bare ~/.dotfiles
>>     alias dotfiles="GIT_DIR=~/.dotfiles GIT_WORK_TREE=~ git"
>>
>>     dotfiles add ~/.bashrc
>>     dotfiles commit -a -m "add my bashrc"
>>     ...
>>
>> but git-submodule complains when trying to add submodules:
>>
>>     dotfiles submodule add http://path.to/submodule
>>     fatal: working tree '/home/user' already exists.
>>
>>     git --git-dir ~/.dotfiles submodule add http://path.to/submodule
>>     fatal: /usr/lib/git-core/git-submodule cannot be used without a
>> working tree.
>>
>> Signed-off-by: Daniel Graña <dangra@gmail.com>
>> ---
> 
> I think this is in line with what we discussed earlier on list when
> the interaction between GIT_DIR/GIT_WORK_TREE and submodules came up
> the last time.  Jens?

Yes, I think this is the only way submodules in current git can
be used with the GIT_DIR and GIT_WORK_TREE environment variables:
set them when adding or initializing the submodule and always use
the same settings when accessing them later. Daniel's dotfile
alias achieves exactly that, so his fix looks good. But I agree
the tests should be improved as you already pointed out.

  reply	other threads:[~2012-07-23 17:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-22 14:49 [PATCH] Solve git-submodule issues with detached work trees Daniel Graña
2012-07-23  5:09 ` Junio C Hamano
2012-07-23 17:38   ` Jens Lehmann [this message]
2012-07-23 18:21     ` Junio C Hamano
2012-07-23 20:02       ` Jens Lehmann
2012-07-23 20:34         ` Junio C Hamano
2012-07-23 23:17           ` Jens Lehmann
2012-07-23 23:42             ` Junio C Hamano
2012-07-23 18:22     ` Daniel Graña
2012-07-23 18:25   ` Richard Hartmann
2012-07-23 18:27     ` Richard Hartmann

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=500D8C30.9010807@web.de \
    --to=jens.lehmann@web.de \
    --cc=dangra@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=richih.mailinglist@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.