git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jack Bates <bk874k@nottheoilrig.com>
Cc: git@vger.kernel.org
Subject: Re: Bug? clone ignores --git-dir
Date: Wed, 27 Nov 2019 21:33:41 +0900	[thread overview]
Message-ID: <xmqqh82pv6qi.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: 7d28416e-c927-4cd3-bac2-d8bfd02ce949@nottheoilrig.com

Jack Bates <bk874k@nottheoilrig.com> writes:

> ... repositories, however `clone` ignores `--git-dir`:

An intentional design decision (and it may be an unfortunate one by
now [*1*]) was to have the GIT_DIR (hence --git-dir) talk about the
*source side* of the clone, not the destination, e.g.

	cd /home/me/working/tree
	export GIT_DIR=/home/me/repo/sitory
	export GIT_WORK_TREE=$(pwd)

	# the above told Git that /home/me/working/tree has a
	# checkout but its repository body is not anywhere in its
	# subdirectory -- it is /home/me/repo/sitory.

	# now we clone the repository we are currently working on
	# without GIT_DIR applying to the source side, it won't
	# work.
	git clone . /else/where

And we cannot allow /home/me/repo/sitory (i.e. GIT_DIR for the
source repository) become the GIT_DIR for the resulting /else/where
repository (you'd be cloning to yourself).


[Footnote]

*1* with use of "git worktree" gaining traction, perhaps the need to
    create local clone out of the shared/same GIT_DIR may have
    diminished.


  parent reply	other threads:[~2019-11-27 12:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 18:07 Bug? clone ignores --git-dir Jack Bates
2019-11-27 11:51 ` Jeff King
2019-11-27 12:33 ` Junio C Hamano [this message]
2019-11-27 20:19   ` Jack Bates

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=xmqqh82pv6qi.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=bk874k@nottheoilrig.com \
    --cc=git@vger.kernel.org \
    /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).