git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:48 UTC

[PATCH v5 0/2] blame: make diff algorithm configurable

From
Antonin Delpeuch via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 6, 2025, 22:41 UTC
Message-ID
<pull.2075.v5.git.git.1762468914.gitgitgadget@gmail.com>
In-Reply-To
<pull.2075.v4.git.git.1762034252.gitgitgadget@gmail.com>
Changes since v4:
 * hide --minimal option
 * simplify tests to minimize spun processes
 * remove redundant XDF_NEED_MINIMAL in bit mask
Antonin Delpeuch (2):
  xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASK
  blame: make diff algorithm configurable
 Documentation/diff-algorithm-option.adoc |  20 +++
 Documentation/diff-options.adoc          |  21 +--
 Documentation/git-blame.adoc             |   2 +
 builtin/blame.c                          |  52 +++++-
 diff.c                                   |   2 -
 merge-ort.c                              |   2 -
 t/meson.build                            |   1 +
 t/t8015-blame-diff-algorithm.sh          | 203 +++++++++++++++++++++++
 xdiff/xdiff.h                            |   2 +-
 9 files changed, 279 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/diff-algorithm-option.adoc
 create mode 100755 t/t8015-blame-diff-algorithm.sh
base-commit: 4253630c6f07a4bdcc9aa62a50e26a4d466219d1
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2075%2Fwetneb%2Fblame_respects_diff_algorithm-v5
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2075/wetneb/blame_respects_diff_algorithm-v5
Pull-Request: https://github.com/git/git/pull/2075
Range-diff vs v4:
 1:  e81a5d2bd2 = 1:  e81a5d2bd2 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASK
 2:  920a6f3acb ! 2:  60015bbada blame: make diff algorithm configurable
     @@ builtin/blame.c: static int blame_move_callback(const struct option *option, con
      +		return error(_("option diff-algorithm accepts \"myers\", "
      +			       "\"minimal\", \"patience\" and \"histogram\""));
      +
     -+	*opt &= ~(XDF_NEED_MINIMAL | XDF_DIFF_ALGORITHM_MASK);
     ++	*opt &= ~XDF_DIFF_ALGORITHM_MASK;
      +	*opt |= value;
      +
      +	return 0;
     @@ builtin/blame.c: int cmd_blame(int argc,
      -		OPT_BIT(0, "minimal", &xdl_opts, N_("spend extra cycles to find better match"), XDF_NEED_MINIMAL),
      +		OPT_CALLBACK_F(0, "minimal", &xdl_opts, NULL,
      +			       N_("spend extra cycles to find a better match"),
     -+			       PARSE_OPT_NOARG, blame_diff_algorithm_minimal),
     ++			       PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, blame_diff_algorithm_minimal),
       		OPT_STRING('S', NULL, &revs_file, N_("file"), N_("use revisions from <file> instead of calling git-rev-list")),
       		OPT_STRING(0, "contents", &contents_from, N_("file"), N_("use <file>'s contents as the final image")),
       		OPT_CALLBACK_F('C', NULL, &opt, N_("score"), N_("find line copies within and across files"), PARSE_OPT_OPTARG, blame_copy_callback),
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	EOF
      +
      +	git -c diff.algorithm=histogram blame file.c > output &&
     -+	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output > without_varying_parts &&
     -+	sed -e "s/ *$//g" without_varying_parts > actual &&
     ++	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" \
     ++	    -e "s/ *$//g" output > actual &&
      +	test_cmp expected actual
      +'
      +
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	Commit_2 }
      +	EOF
      +
     -+	git -c diff.algorithm=myers blame file.c --diff-algorithm histogram &&
     -+	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output > without_varying_parts &&
     -+	sed -e "s/ *$//g" without_varying_parts > actual &&
     ++	git -c diff.algorithm=myers blame file.c --diff-algorithm histogram > output &&
     ++	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" \
     ++	    -e "s/ *$//g" output > actual &&
      +	test_cmp expected actual
      +'
      +
-- 
gitgitgadget
Previous: Junio C HamanoNext: Antonin Delpeuch via GitGitGadget
Message 21 of 32 in “blame: make diff algorithm configurable”
  1. blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Oct 20, 2025
  2. Junio C HamanoOct 20, 2025
  3. Antonin DelpeuchOct 22, 2025
  4. Junio C HamanoOct 22, 2025
  5. Phillip WoodOct 23, 2025
  6. blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Oct 28, 2025
  7. Junio C HamanoOct 28, 2025
  8. Antonin DelpeuchOct 28, 2025
  9. blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Oct 28, 2025
  10. Phillip WoodOct 29, 2025
  11. Junio C HamanoOct 29, 2025
  12. Antonin DelpeuchOct 30, 2025
  13. Phillip WoodOct 30, 2025
  14. 0/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 1, 2025
  15. 1/2 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASKAntonin Delpeuch via GitGitGadget, Nov 1, 2025
  16. 2/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 1, 2025
  17. Phillip WoodNov 3, 2025
  18. Phillip WoodNov 3, 2025
  19. Junio C HamanoNov 3, 2025
  20. Junio C HamanoNov 6, 2025
  21. 0/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 6, 2025
  22. 1/2 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASKAntonin Delpeuch via GitGitGadget, Nov 6, 2025
  23. 2/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 6, 2025
  24. Phillip WoodNov 7, 2025
  25. Junio C HamanoNov 7, 2025
  26. Junio C HamanoNov 7, 2025
  27. Junio C HamanoNov 17, 2025
  28. 0/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 17, 2025
  29. 1/2 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASKAntonin Delpeuch via GitGitGadget, Nov 17, 2025
  30. 2/2 blame: make diff algorithm configurableAntonin Delpeuch via GitGitGadget, Nov 17, 2025
  31. Phillip WoodNov 17, 2025
  32. Junio C HamanoNov 17, 2025

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.