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 --no-color option.
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).
I am using the git clang-format command which internally calls git diff. git clang-format does not support passing --no-color.
Got it! After discussing on the mailing list the current idea is to post the results on patchset comments only if it’s under a certain limit but host the results somewhere else and provide the link in the patchset comments if it’s above that limit.