Ability to show diff on fail_on_changes
Description
fail_on_changes is great, but it lacks the possibility to show diffs about what has actually changed. This would be especially important in CI because it's not easy to get hold of that environment and figure it out manually.
pre-commit has the --show-diff-on-failure option to cater to this.
My personal idea of the perfect behavior is, that if the tool detects changed files and fails due to them, it should show the diff of the tree iff in CI (i.e. not show the diff if not in CI, because one can easily figure out locally if need be, and the diff output may wreak havoc in the tool doing the commit/showing its output).
My opinionated configs also set fail_on_changes: always, so the above behavior should not trigger only when fail_on_changes: ci.
I appreciate the above might not work for everyone, so maybe the above described behavior could be the default, and another option to explicitly toggle showing of the diff (on or off) should be added (--[no-]show-failure-diff?).
Or if there are backwards compatibility considerations, maybe the diff would never be shown by default, but would require passing the --show-failure-diff.
What problem it is solving?
Better understanding why fail_on_changes kicks in, especially/typically in CI.
+1 for this, no diff when fail_on_changes makes it not that useful.
Suggested implementation in #1227.