it would also print terminal color codes […] After looking for various ways to remove it I settled with using git config color.diff false
I don’t know if this was among the considered ways, but you can set that directly in the git diff command, with the
posting the comments on Gerrit
Beware that comments have an approximate 16KB limit (configurable). Can be an issue when there is a considerable amount of violations. The result would be an HTTP error (I think 400, but don’t quote me on that) and the whole request unserved (that is, not just the message, but also the label).