[PATCH v3 0/8] Better heuristics make prettier diffs
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Sep 5, 2016, 09:44 UTC
- Message-ID
- <cover.1473068229.git.mhagger@alum.mit.edu>
This is v3 of the diff-indent-heuristic patch series. Thanks to René, Junio, and Ramsay for their comments about v2 [1,2].
The heuristic itself hasn't changed since v2. Most of the changes are in the tests and in how `git blame` is wired up to support the new options. Changes since v1:
* In "diff: improve positioning of add/delete blocks in diffs":
* Make `score_cmp()` static.
* Add test t4059 as part of this commit, not as part of its
successor. * t4059: Create commits to use for the tests (rather than diffing
loose files with `--no-cache`), so that the same prep can be used
to test `git blame`. Split the tests into multiple smaller tests.* Add a test that `--no-indent-heuristic` overrides the config.
* Add a new commit "parse-options: add parse_opt_unknown_cb()":
* Allow "-h" help text to be generated for options even if they are
being handled by code external to `parse_options()`.If there's already a way to do this, I didn't find it.
* In "blame: honor the diff heuristic options and config":
* In v2, I suggested making `blame` honor all diff-related options.
Junio explained why this was a bad idea. So this version only
makes `blame` honor `--indent-heuristic` and
`--compaction-heuristic`.* Add some smoke tests.
This patch series is also available from my GitHub fork [3], branch "diff-indent-heuristic"
[1] http://public-inbox.org/git/cover.1471864378.git.mhagger@alum.mit.edu/ [2] http://public-inbox.org/git/a27aa17e-f602-fc49-92b3-2198e4772e47@ramsayjones.plus.com/ [3] https://github.com/mhagger/git
Michael Haggerty (8): xdl_change_compact(): fix compaction heuristic to adjust ixo xdl_change_compact(): only use heuristic if group can't be matched is_blank_line(): take a single xrecord_t as argument recs_match(): take two xrecord_t pointers as arguments xdl_change_compact(): introduce the concept of a change group diff: improve positioning of add/delete blocks in diffs parse-options: add parse_opt_unknown_cb() blame: honor the diff heuristic options and config
Documentation/diff-config.txt | 7 +- Documentation/diff-heuristic-options.txt | 7 + Documentation/diff-options.txt | 7 +- Documentation/git-annotate.txt | 1 + Documentation/git-blame.txt | 2 + builtin/blame.c | 12 + diff.c | 36 +- diff.h | 1 + git-add--interactive.perl | 5 +- parse-options-cb.c | 12 + parse-options.h | 1 + t/t4059-diff-indent.sh | 216 +++++++++++ xdiff/xdiff.h | 1 + xdiff/xdiffi.c | 635 ++++++++++++++++++++++++++----- 14 files changed, 828 insertions(+), 115 deletions(-) create mode 100644 Documentation/diff-heuristic-options.txt create mode 100755 t/t4059-diff-indent.sh
-- 2.9.3