git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Next: Michael Haggerty
Message 1 of 16 in “Better heuristics make prettier diffs”
  1. 0/8 Better heuristics make prettier diffsMichael Haggerty, Sep 5, 2016
  2. 1/8 xdl_change_compact(): fix compaction heuristic to adjust ixoMichael Haggerty, Sep 5, 2016
  3. 7/8 parse-options: add parse_opt_unknown_cb()Michael Haggerty, Sep 5, 2016
  4. 3/8 is_blank_line(): take a single xrecord_t as argumentMichael Haggerty, Sep 5, 2016
  5. 2/8 xdl_change_compact(): only use heuristic if group can't be matchedMichael Haggerty, Sep 5, 2016
  6. 5/8 xdl_change_compact(): introduce the concept of a change groupMichael Haggerty, Sep 5, 2016
  7. 8/8 blame: honor the diff heuristic options and configMichael Haggerty, Sep 5, 2016
  8. 6/8 diff: improve positioning of add/delete blocks in diffsMichael Haggerty, Sep 5, 2016
  9. 4/8 recs_match(): take two xrecord_t pointers as argumentsMichael Haggerty, Sep 5, 2016
  10. Junio C HamanoSep 7, 2016
  11. Jacob KellerSep 7, 2016
  12. Junio C HamanoSep 7, 2016
  13. Michael HaggertySep 19, 2016
  14. Junio C HamanoSep 19, 2016
  15. Junio C HamanoSep 19, 2016
  16. Michael HaggertySep 20, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.