git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Why does adding an existing repo as a submodule modify .git/config?

From
Jens Lehmann <jens.lehmann@web.de>
Date
May 26, 2011, 21:35 UTC
Message-ID
<4DDEC795.3030304@web.de>
In-Reply-To
<BANLkTingA2oRY4i6OnYSz8PGdTRDqXVdFw@mail.gmail.com>
Am 25.05.2011 05:11, schrieb Christopher Wilson:
Show 8 quoted lines
> On Tue, May 24, 2011 at 6:06 PM, Mark Levedahl <mlevedahl@gmail.com> wrote:
> 
>> However, while you could then change submodule-add to not register the
>> submodule, you would now have the condition of having a submodule that is
>> checked out in the current tree but *not* registered in .git/config.
> 
> Isn't this exactly what "git submodule add" currently does for
> submodules that are NOT added in place?

That is the inconsistency this thread is about. Thanks Christopher for bringing that up and to Mark for explaining the rationale for updating the url in .git/config. I really agree with what Mark said there and also concur with Christopher that a "git submodule add" should always update the url in .git/config, no matter if it is an already existing repo being added or a freshly cloned one.

But unfortunately there is more to it than just adding a
	git config submodule."$path".url "$realrepo"
to the module_clone branch in cmd_add() because that makes tests break
where "git submodule init" doesn't copy the "update" settings into
.git/config anymore as it already finds an url configured there and
thinks there is nothing to do. I'm looking into fixing that right now,
so stay tuned ...
Previous: Christopher Wilson
Message 7 of 7 in “Why does adding an existing repo as a submodule modify .git/config?”
  1. Christopher WilsonMay 22, 2011
  2. Jens LehmannMay 23, 2011
  3. Mark LevedahlMay 24, 2011
  4. Christopher WilsonMay 24, 2011
  5. Mark LevedahlMay 25, 2011
  6. Christopher WilsonMay 25, 2011
  7. Jens LehmannMay 26, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.