Version control churn when reusing sub-sheets
Description
Sort of related to #7945 (closed), except this affects individual projects multiply-instantiating sheets.
Since KiCAD 6 stores reference data in the kicad_sch file but ignores it when loading sub-sheets, sheet reuse is possible. The problem is that the contents of the reference data in the subsheet will change depending on the context in which you last saved the sheet. This creates unnecessary churn in version control systems, since the reference data for all the symbols will flip-flop fairly regularly.
Musings on solutions
One possible solution is to only ever write out only the placeholder reference as defined by the symbol library (U?
). On the other hand, I imagine one use-case is that people want to be able to duplicate sheets from other projects and keep reference designators.
Another option is to always write out the references of the instantiation with the lowest page number when writing a sheet. This seems like a nice middle ground; it'll make VCS happy within a project and not diverge much from behavior today. It doesn't help with #7945 (closed), however.
A third option is to make the behavior selectable via a project setting. This could be called "optimize for version control systems" and could include other behaviors down the road as well.
Steps to reproduce
- Create a project with two instantiations of the same sheet
a
, so it looks like
/
|-> a1
'-> a2
- On
a
, add some component. - Annotate the schematic, so a1 has U1 and a2 has U2.
- Open up a1 and save.
- Check the content of a.kicad_sch. It'll have U1 as the reference.
- Open up a2 and save.
- Check the content of a.kicad_sch again. It'll have U2 as the reference.
KiCad Version
Application: KiCad Schematic Editor
Version: 6.0.2, release build
Libraries:
wxWidgets 3.0.4
Platform: Linux 5.13.0-28-generic x86_64, 64 bit, Little endian, wxGTK, xubuntu, x11
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.68.0
ngspice: 31
Compiler: GCC 9.3.0 with C++ ABI 1013
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON