vcstool icon indicating copy to clipboard operation
vcstool copied to clipboard

Add git submodule support (to detect submodule repos)

Open varunsairam opened this issue 10 months ago • 1 comments

Found that git submodules were not getting detected by vcs. Believe the issue comes down to file structure and type.

(Also faced in issue: #198)

Typical git repo

git_repo
    |--- .git (directory)

Submodule repo

outer_repo
    |--- .git (directory)
    |--- submodule_repo
         |--- .git (file)

Contents of .git file (the one inside the submodule_repo):

gitdir: ../.git/modules/submodule_repo

So effectively, submodules don't have .git directory of their own but rather a .git linked file that links to the directory in the outer .git directory.

Currently, it appears that vcstool is designed to determine if a repo is a git repo by checking for only a .git directory: https://github.com/dirk-thomas/vcstool/blob/daf389377310f7f31b2171f51a79af82c31bf3e2/vcstool/clients/git.py#L31

Tried to fix this here. The submodules now seem to get detected as git repos. Hope there would be no unintended consequences though?

varunsairam avatar Apr 07 '24 22:04 varunsairam

really need this feature!!!

rty813 avatar Aug 01 '24 06:08 rty813