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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/23/11 6:19 PM, Mark Levedahl wrote:
> On 05/23/2011 02:43 PM, Jens Lehmann wrote:
>> Am 22.05.2011 22:02, schrieb Christopher Wilson:
>>
>> Hmm, this looks like an inconsistency to me too. It would be great
>> to hear about the background, so I added Mark to the CC, maybe he
>> can shed some light.
>>
> I think the comment in c2f939170c651 describes the reasoning well
> enough. (You may disagree with the reasoning, but that is a different
> matter :^).
> 
> Mark

Mark, thanks for the reply.  Maybe I'm a bit daft, but I'm still a
little confused by your comment in the commit :)

I've included your commit message below with my questions interlaced.

C: "When adding a new submodule in place, meaning the user created the
submodule as a git repo in the superproject's tree first, we don't go
through "git submodule init" to register the module."

Q: Why don't we go through "git submodule init" to register the
submodule?  Isn't that the whole point of having a separate "submodule
init" command, to register the module in .git/config?

C: "Thus, the submodule's origin repository URL is not stored in
.git/config, and no subsequent submodule operation will ever do so."

I'm not sure this is true.  For example:

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

# At this point, I opened up .git/config in an editor and removed the
entire submodule section.

$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
$ git submodule init
$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[submodule "submodule"]
    url = git@xxxxxxxxxx:submodule.git

Q: As far as I can tell, a subsequent submodule operation (git submodule
init) has stored the submodule's origin repository URL in .git/config.
Can you elaborate on what you meant by the statement "no subsequent
submodule operation will ever do so"?

C: "In this case, assume the URL the user supplies to "submodule add" is
the one that should be registered, and do so."

Q: Can you elaborate on why a 2 step "git submodule add" + "git
submodule init" wasn't sufficient?  What is the reason for adding this
functionality into the "git submodule add" command, when "git submodule
init" does the same job?

Again, sorry if I'm asking dumb questions... :)  Just want to understand
the context for your commit.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]