{"thread":{"id":"52875","subject":"`git diff` fails to detect large re-indented blocks even with --color-moved-ws=allow-indentation-change","startedAt":"2020-02-24T00:44:59Z","lastAt":"2020-02-24T00:44:59Z","messageCount":1,"participants":["Timothee Cour"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"392368","messageId":"CANri+EzQZLg2djKvLxbPWh_8fr8oEqvaFF5BB1eAMCOYuB+4_w@mail.gmail.com","threadId":"52875","inReplyTo":null,"subject":"`git diff` fails to detect large re-indented blocks even with --color-moved-ws=allow-indentation-change","fromName":"Timothee Cour","fromEmail":"thelastmammoth@gmail.com","sentAt":"2020-02-24T00:44:28Z","receivedAt":"2020-02-24T00:44:59Z","isPatch":false,"sender":{"key":"thelastmammoth@gmail.com","avatar":null},"body":"see https://github.com/timotheecour/Nim/pull/37 for a self-contained\nminimal example\n\nthe actual diff contains a single large re-indented block (re-indented\nby 2 spaces); and a single re-indented line within that large block:\n## * getTempDir proc <#getTempDir>_\n\nnone of the tools I know of helps viewing the diff in this case:\n\n* problem 1: https://github.com/timotheecour/Nim/pull/37/files?w=1\ncompletely ignores the re-indented single line within the block\n* problem 2: https://github.com/timotheecour/Nim/pull/37/files shows a\nlarge complex diff composed of multiple diff blocks, hard to spot\nwhether code was changed or whether it's just re-indent\n* git diff --color-moved-ws=allow-indentation-change --color-moved=blocks HEAD^\nthis suffers from problem 1 and problem 2: the diff is complex and\nshows multiple blocks\n* git diff --color-moved-ws=allow-indentation-change --color-moved\nHEAD^ does not suffer from problem 1 but suffers from problem 2: the\ndiff is complex and shows multiple blocks; see comment below\n\n* even without reasoning about moved code (eg `--color-moved`), there\nis no `git diff` option I know of that correctly identifies blocks of\ntext that were merely re-indented UNIFORMLY.\n\nI've show the `git diff` output in that PR.  It makes it really hard\nto review diffs that are composed of essentially re-indentation; and\nto identify deviations from uniform re-indentation within re-indented\nblocks. Uniform re-indentation is important for correctness in\nwhitespace sensitive languages such as python, nim, where a spurious\nre-indentation could introduce a subtle behavior change; this should\nbe visible, not ignored.\n\n## expected git diff output\nperhaps an option `--color-moved-ws=smart-indentation-change` should\nbe introduced which would group code by uniform re-indentation level,\nand would show how much each block was re-indented by (positive or\nnegative). In example from that PR, it should show a large re-indented\nblock in 1 color, and show in another color the re-indented single\nline\n\n\n(ref: D20200223T154500)\n"}]}