This is Raj Karadakal, I used to work in Juniper as SCM manager. In my new place I was looking for a solution that could mimic the functionality of repo tools. Can GitXmodules be a replacement for Android repo tools? Can it nest the repositories arbitrary levels? What is the limit on how many repos can be nested?
glad to hear from you and thank you for you continuous interest in our products!
I’m not familiar with the Repo tool much, but judging from the documentation, it’s able
to aggregate Git projects into the Android superproject
for this matter Git X-Modules is definitely able to replace the Repo tool, but it’s also stated to be a build tool and this functionality, probably, cannot be mimicked by X-Modules.
Git X-Modules is definitely able to nest repositories, there is no limitations of the nesting depth, yet there is the limitation that a module directory cannot contain a module, but a module repository can include modules that include modules themselves.
Thanks for your response. I am only looking for the feature to aggregate the Git repos. I am trying to understand what you said below
“yet there is the limitation that a module directory cannot contain a module, but a module repository can include modules that include modules themselves.”
What is the difference between “module directory”, “module” and “module repository” ?
I guess the repo hosting the X-module directory, will have all the commits happening natively in it in addition to the commits that get synched to and from external repos. This could mean that the host repo can potentially have millions of commits in it right?
Git X-Modules add-on allows adding data from one (source) repository to another (target) as a subdirectory in the target repository, so that there is a directory called
module, for example, containing data from the source repository among other directories and files in, say,
master branch of the target repository. What I meant talking about limitations was that this
module directory can only contain data from the source repository and not modules from other repositories. But at the same time the target repository can contain more than one module directory, and the source repository can also contain modules from other repositories, which can also contain modules themselves – this is the allowed nesting and it’s not limited in depth.
Regarding the commits – it depends on the X-Modules settings, if it’s set to squash commits, then it won’t be millions of commits, but without squashing number of commits will grow, indeed.
Raj, could you please advise is that correct you have a Bitbucket server and consider using Git X-Modules add-on for the server? Or is that any other kind of a Git server?
I just thought it would be easier to explain with an example.
Say, you have three repositories - Lib, App and Mono.
What you can do:
- Add Lib to App as a module. So the App repo will have an App/Lib directory, synced with the Lib repo.
- Add App to Mono as a module. So the Mono repo will have a Mono/App directory, synced with the App repo. There also will be a Mono/App/Lib directory inside it, which will be synced with the Lib repo.
- Any changes made either in Mono/App/Lib or in App/Lib will be synced with the Lib repo, and vice versa.
You can also add App to Mono as a module first, and then add Lib to App - it doesn’t matter.
What you CAN’T do:
- Add App to Mono as a module.
- Then attempt to create another module in the Mono/App directory, and sync it with the Lib repo.
The key to understanding is that a repository with X-Modules in it is just a regular repository, and can be treated as such - e.g. cloned, pushed to, or added as a module to another repository. It doesn’t really matter for Git X-Modules, what is inside the repository that is added as a module.
What does matter, is that a module directory (= a directory synced with another repository) could not be syncing with two repositories at once. This is why you can’t add another module to a directory that already is a module, but you can add a module to a repository that is synced with a directory in another repository via Git X-Modules.
We use the following terminology:
- A module (or an X-Module) is a directory in a repository that is synced with another repository. E.g. if an App repo has a module called Lib, the module directory will be App/Lib.
- A parent repository is a repository that contains a module (=a directory synced with another repository).
- A module repository is a repository that is added as a module to another repository (=synced with a directory in another repository).
The same repository can be both a parent and a module. In the example above, “App” in a parent repository to “Lib” and a module repository to “Mono”.
As for your second question regarding the transfer of commits from the module repository to the parent repository - we have a small article on that: Module pull options - GitX - TMate Docs.
I hope this helps.