All of lore.kernel.org
 help / color / mirror / Atom feed
From: Filip Gospodinov <filip.gospodinov@monetas.net>
To: git@vger.kernel.org
Subject: git submodule ignores --git-dir
Date: Thu, 10 Sep 2015 22:06:03 +0200	[thread overview]
Message-ID: <55F1E2AB.3020507@monetas.net> (raw)

Hi!

I use the `--git-dir` flag in some scripts such that I don't need to `cd` back
and forth. Recently, I've discovered that `--git-dir` does not seem to work
correctly for `git submodule`. Here is a short snippet to reproduce that behavior:

mkdir repo1 subm
(cd subm; git init; git commit -m 1 --allow-empty)
(cd repo1; git init; git submodule add ../subm subm; git commit -m "add subm")
git clone repo1 repo2
git --git-dir=$PWD/repo2/.git submodule update --init


which errors with the following output:

No submodule mapping found in .gitmodules for path 'subm'

But this works:
cd repo2; git --git-dir=$PWD/.git submodule update --init


I know that for this particular use case I can just use `git clone --recursive`
and that other use cases can be worked around by using `cd`. Still, I wonder if
the behavior I discovered is a bug or if it's expected.

git --version
git version 2.5.1

Thanks you!
Filip

             reply	other threads:[~2015-09-10 20:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 20:06 Filip Gospodinov [this message]
2015-09-11 15:15 ` git submodule ignores --git-dir Jens Lehmann
2015-09-11 15:28   ` John Keeping
2015-09-14 13:25     ` Filip Gospodinov
  -- strict thread matches above, loose matches on Subject: below --
2015-09-10 20:06 Filip Gospodinov

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=55F1E2AB.3020507@monetas.net \
    --to=filip.gospodinov@monetas.net \
    --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 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.