Simplify diffing & merging of message & parser generated files through .gitattributes
There was some interest in this on mattermost so it's worth creating an issue.
Generated messages & generated parser files are meaningless to inspect. Their source files are easier to read. So there are two things we can do with git attributes.:
- Not clutter entire screens with differences of generated files when diff-ing branches or commits or so on. This can be done via the
- Temporarily trick git into solving these spurious conflicts on generated files since a regeneration has to happen anyway. This can be done via
merge=theirsattributes. Almost certainly both are wrong, but there's no magical
merge=$(make messages && make parsers)so they would have to do. Advantage of
merge=ours: zero diff, but you will probably have other conflicts and that means other modified files so it let's you focus on them. Advantage of
merge=theirs: some diff which will tell you nothing more than what files need regenerating.
Git attributes are assigned per file or directory. Since we have generated message & parser files in open directories with other source code files, our attributes would work directly associated with the generated files.