git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Wilson <cwilson@cdwilson.us>
To: git@vger.kernel.org
Subject: Why does adding an existing repo as a submodule modify .git/config?
Date: Sun, 22 May 2011 13:02:54 -0700	[thread overview]
Message-ID: <irbq5a$h38$1@dough.gmane.org> (raw)

(I posted this question below on
http://stackoverflow.com/questions/6083357/why-does-adding-an-existing-repo-as-a-submodule-modify-git-config
and was recommended to ask the mailing list)

If I add a submodule that does not currently exist, no submodule
information is added to .git/config.

$ mkdir testing
$ cd testing
$ git init
$ git submodule add git@git.server:submodule.git
$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true

However, if I add a repo that currently exists as a submodule, the url
is added to .git/config:

$ mkdir testing
$ cd testing
$ git init
$ git clone git@git.server:submodule.git
$ git submodule add git@git.server:submodule.git
$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[submodule "submodule"]
    url = git@git.server:submodule.git

I would have assumed that in both cases, git submodule add would have
only modified .gitmodules, and that git submodule init would have
updated the project's .git/config.

I'm aware this is intentional behavior
(https://github.com/git/git/commit/c2f939170c65173076bbd752bb3c764536b3b09b),
but I don't understand why.

Why is .git/config modified in the second case but not the first? Can
somebody explain the rational for this behavior?

             reply	other threads:[~2011-05-22 20:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-22 20:02 Christopher Wilson [this message]
2011-05-23 18:43 ` Why does adding an existing repo as a submodule modify .git/config? Jens Lehmann
2011-05-24  1:19   ` Mark Levedahl
2011-05-24  7:06     ` Christopher Wilson
2011-05-25  1:06       ` Mark Levedahl
2011-05-25  3:11         ` Christopher Wilson
2011-05-26 21:35           ` Jens Lehmann

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='irbq5a$h38$1@dough.gmane.org' \
    --to=cwilson@cdwilson.us \
    --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).