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

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

 



(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@xxxxxxxxxx: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@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

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?

--
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]