[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Bug when adding submodules

On Sat, May 23, 2015 at 1:47 AM, Ruth Linehan <ruth@xxxxxxxxxxxxxx> wrote:

I am trying to use JGit for a project involving submodules. Specifically, I am trying to initialize a new submodule and add it to a superproject. The submodule I am trying to initialize and add is already within the working tree of the superproject. I would like to do a `submodule add` using the path that it is already at and using a relative url, basically like:

$ git submodule add ./submodules/foo.git ./submodules/foo

The documentation for git-submodule indicates that doing this is supported, and I am able to achieve this from command line git. However, when I try to do this with JGit I encounter https://bugs.eclipse.org/bugs/show_bug.cgi?id=467611Â(which prevents adding the submodule when it already exists within the working tree of the super project). This seems to be because JGit just does a clone of the submodule, whereas the git-submodule code checks to see whether the directory already exists, and if so whether it has a .git directory within it. If this is the case, it just adds the directory to the index and adds the configuration to the .gitmodules file, rather than doing a clone.

Is there any chance of getting some attention on this? Otherwise, if we were to try to patch this ourselves, do yâall have any thoughts or advice?

I replied in the bug reportÂ

Also, it seems like what JGit does for a "submodule add" is different from cgit: JGit keeps the gitdir for the added submodule in a .git directory within the submodules working tree, whereas cgit puts the gitdir for the submodule in .git/modules of the parent repo, and links the .git directory of the submodule to <superproject>/.git/modules/<submodule path>. Whatâs up with this, and any plans on changing this to match gitâs filesystem layout? It seems based on the comment inÂhttps://bugs.eclipse.org/bugs/show_bug.cgi?id=380130#c2Âthat there was at one point an effort to do this, but I canât tell what the status of it is.

support for the new submodule storage layout was added last December here