Skip to main content

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

On Thu, May 28, 2015 at 2:24 AM, Ruth Linehan <ruth@xxxxxxxxxxxxxx> wrote:

On Wed, May 27, 2015 at 3:19 PM, Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
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 (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 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

Ah, I missed this, thanks.  It looks like this added support for the new layout to SubmoduleUpdateCommand. Any plans for making the same updates to SubmoduleAddCommand?

looks like we missed that, please file a bug to track this


Back to the top