Hi Jeremy,
Thanks for giving Git X-Modules a try and sharing your experience with us.
It seems like this a use-case for the “advanced branch rules” feature but when new branches are created on the parent repo, they don’t inherit any rules and have to be set up individually. If this is the case, what is the purpose of wildcards in the branch rules?
Right, we’ve introduced the branch rules editor just recently and there are some quirks with that feature, indeed.
When you add a new rule feature/*:feature/{1}
to the branch main
, this rule is effective to none of existing commits, it only gets applied to the ref main
:
refs/heads/main [main:main, feature/*:feature/{1}]
|
* B [main:main]
|
* A [main:main]
Then, when the branch main
fetches any changes from any modules, a new commit appears and this commit has the new rule:
refs/heads/main [main:main, feature/*:feature/{1}]
|
* C [main:main, feature/*:feature/{1}]
|
* B [main:main]
|
* A [main:main]
At this point you can create a branch feature/x
on commit C
or on any commit that has C
as an ancestor. Then the branch feature/x
gets synchronized with the branch feature/x
in the corresponding module:
refs/heads/feature/x [main:main, feature/*:feature/{1}]
|
* D [main:main, feature/*:feature/{1}]
|
* C [main:main, feature/*:feature/{1}]
|
* B [main:main]
|
* A [main:main]
So, in order to make the rule feature/*:feature/{1}
effective you’d need to make Git X-Modules fetch anything from any module on the branch main
.
We do want to change that behavior: we’re going to introduce .xmodules
file that stores information on all the x-modules within a commit file tree. So, when you add a new rule feature/*:feature/{1}
, we’re going to generate a new commit with a new .xmodules
file that has the new branch rule:
[module "xyz"]
url = https://github.com/org/repo
path = modules/xyz
ref = if refs/heads/main sync refs/heads/main
+ ref = if refs/heads/feature/* sync refs/heads/feature/{1}
That automatically gets rid of the problem as adding any new branch rule automatically generates a commit with the new rule being effective. Unfortunately, we’re quite limited resource-wise at the moment, so it’s hard to estimate when we’re able to introduce .xmodules
file descriptor support.
I’d also like to mention a couple of things that we’re not going to change with the next releases:
-
Note that the older commits A
and B
still don’t have the new rule, the branch rules get applied to new commits only.
-
Also, note that if you have some other branches, e.g. develop
you might need to add new branch rules to those branches as well.
Hopefully, that’s fine for your workflow, please let me know if any of those two points cause any problems for your team.
Finally, I’d like to mention that we’re running a survey on typical problems that our product helps to solve. It would be tremendously helpful for us if you could fill the form (it takes 5-10 minutes): https://forms.gle/wzCLoUDr8Jb937mw7
Thank you in advance!