From: Jeff King <peff@peff.net>
To: Jack Bates <bk874k@nottheoilrig.com>
Cc: git@vger.kernel.org
Subject: Re: Bug? clone ignores --git-dir
Date: Wed, 27 Nov 2019 06:51:24 -0500 [thread overview]
Message-ID: <20191127115124.GE22221@sigill.intra.peff.net> (raw)
In-Reply-To: <7d28416e-c927-4cd3-bac2-d8bfd02ce949@nottheoilrig.com>
On Tue, Nov 26, 2019 at 11:07:27AM -0700, Jack Bates wrote:
> If you `git rebase --exec 'gulp runtests-parallel --runners user'` this
> project, the tests perform Git operations on various subprojects [1], but
> because Git exports `GIT_DIR` and `GIT_WORK_TREE`, they end up operating on
> the parent project instead.
>
> Adding `--git-dir` and `--work-tree` overrides `GIT_DIR` and `GIT_WORK_TREE`
> [2], forcing the tests to operate on the correct repositories, however
> `clone` ignores `--git-dir`:
>
> > git init repository
> > git --git-dir git-dir clone repository directory
> I'd expect Git to create a directory `git-dir` and put the index, etc.
> there, but instead it creates `directory/.git`, as usual. I'm not sure if
> this is a bug or the expected behavior?
This is the expected behavior. "clone" and "init" are special in that
they are creating _new_ repositories, so they explicitly ignore the
any notion of the current repository.
I'm not quite sure what you're trying to do. I'd think:
git clone --bare repository git-dir
would do what you want, but then I'm not sure why you're specifying
"directory" in the first place, or what you expect to happen. Are you
looking for clone's --separate-git-dir option, perhaps?
-Peff
next prev parent reply other threads:[~2019-11-27 11:51 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 [this message]
2019-11-27 12:33 ` Junio C Hamano
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=20191127115124.GE22221@sigill.intra.peff.net \
--to=peff@peff.net \
--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).