After adding modules using the xmodule GUI, the modules are not showing up in the parent module in Github.
Hello,
I looked into the logs and it seems that you’ve confused “Root Path” and “Repository Path”. Usually “Root Path” should be empty. Let me explain the difference with the following examples.
Suppose you have parent repository with the structure:
├── contrib/
└── file
and the module repository with the structure:
└── directory
└── subdirectory
└── file-in-module
Case 1. Repository Path = “contrib/module”, Root Path = “” (i.e. is empty).
In this case the module repository will be [fully] inserted into parent repository as “contrib/module” directory. So the parent repository will have the following structure:
├── contrib
│ └── module
│ └── directory
│ └── subdirectory
│ └── file-in-module
└── file
Case 2. Repository Path = “contrib/module”, Root Path = “directory”. This means that the module will not be inserted fully but only contents it “directory” will be inserted:
├── contrib
│ └── module
│ └── subdirectory
│ └── file-in-module
└── file
Case 3. Repository Path = “contrib/module”, Root Path = “directory/subdirectory”. Similarly, only contents of “directory/subdirectory” of the module will be inserted at “contrib/module”:
├── contrib
│ └── module
│ └── file-in-module
└── file
Case 4. Repository Path = “contrib/module”, Root Path = “some/non/existing/path”. As the “Root Path” doesn’t exist in the module, the parent repostiory tree will not be affected immediately (because Git doesn’t support empty directories):
├── contrib/
└── file
But then if you create a file in “some/non/existing/path” of the module repository and push the change, then “contrib/module” directory with that file will be created in the parent repository. So these directories (“Repository Path” in the parent repository and “Root Path” in the module repository) stay linked even though initially the parent repository doesn’t seem to be changed.
I think that what happened to you is that “Case 4”. So I would recommend you to change the “Root Path” to the empty value and then you’ll see the module directory on GitHub.
If you have any further questions, feel free to ask, we’ll gladly respond to all of them.
Thank you Dmitry.
Yesterday when I had this issue, I tried to create the directory in my parent repo with a single dummy file called readme.
Today I tried removing the root path, but it is still not working. Should I remove the directories which I added yesterday?
Thanks,
Wayne
Hello Wayne,
this issue you’ve experienced should be now fixed on gitx.dev - there actually was a bug that prevented sync to run. Both your “parent” repositories should have module directories and files.
Thank for the help. So no the question is … how do we support multiple branches in the Repo since we are selecting branches for the submodules ?
Hello Wayne,
When you configure an x-module for a given parent repository, you can select any branch in the parent repository and specify a branch in a module repository synchronized with the selected branch in the parent repository.
This way you can specify the mapping between existing branches in the parent repository and existing branches in all module repositories.
When a new branch gets created on a commit in a parent repository and that commit has x-modules configured, those x-modules remain in the commit tree but they don’t get automatically synchronized with any branches in module repositories for the created branch in the parent repository.
You can go to the x-modules settings page for the created branch in the parent repository and specify the mapped branches for every x-module there. As soon as you apply the new settings, the mapped branches get synchronized between the parent repository and configured module repositories.
This is the way x-modules operate at the moment. However, we also have another internal mechanism for synchronizing branches between a parent repository and its modules, it’s called ref rules:
if a given commit has an x-module, this x-module may have a list of rules:
if refs/heads/master sync refs/heads/master
if refs/heads/* sync refs/heads/parent/${1}
These rules work as follow:
- If master branch points to this commit in a parent repository, then corresponding x-module is synced with master branch in a module repository;
- If branch ‘foo’ points to this commit in a parent repository, then corresponding x-modules is synced with branch ‘refs/heads/parent/foo’ in a module repository.
That also means that if you create a new branch ‘foo’ in a parent repository, X-Modules automatically creates branch ‘refs/heads/parent/foo’ in a module repository and this branches are kept in sync for a given x-module.
Unfortunately, we didn’t make the ref rules available in the UI just yet, so the new branches does not get synchronized automatically as soon as they get created and one needs to specify the mapped branches for corresponding modules at x-modules settings page. This feature is on our roadmap, but it’s hard to give any estimate on its availability at the moment.
Hope this information is helpful. Don’t hesitate to ask additional questions if you have any. Your feedback is very welcome.