I'm responsible for several (rather small) programs, which share a lot of code via different libraries. I'm wondering what the best repository layout is to develop the different prorgrams (and libraries), and keep the libraries in sync across all the programs.
For the sake of argument let's say there are two programs with two libraries:
- Program1
- Library1
- Library2
- Program2
- Library1
- Library2
Naturally, bug fixes and enhancements for the libraries should (eventually) merge to all programs. Since the libraries are being worked on while working on the different programs, using externals definitions seems out of the question.
So I thought to treat my libraries at all but one place as vendor branches but I'm not sure what the best layout for this would be.
I was thinking something along the lines of:
- Libraries
- Library1 (ancestor)
- Library2 (ancestor)
- Program1
- Program1 code
- Library1 (vendor branch)
- Library2 (vendor branch)
- ...
Then say when developing Program1 some changes are made for Library2, I merge them back to the Libraries part of the repository, and merge them from there to all other programs when desired.
Merging to the other programs can't always happen immediately, the people working on Program2 could be close to a release and rather finish that first, create a tag, and only then update all libraries.
I'm a bit concerned this will result in many merges and a bit of a maintenance headache after a while but I don't really see a much better solution.
Then again, this seems a rather common use case to me, so I thought I'd just ask the stackoverflow community, what's the best repository layout to achieve this?