Thread (1 message) 1 message, 1 author, 2025-11-07

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

From: Junio C Hamano <hidden>
Date: 2025-11-07 15:57:18

"Antonin Delpeuch via GitGitGadget" [off-list ref] writes:
From: Antonin Delpeuch <redacted>

The diff algorithm used in 'git-blame(1)' is set to 'myers',
without the possibility to change it aside from the `--minimal` option.

There has been long-standing interest in changing the default diff
algorithm to "histogram", and Git 3.0 was floated as a possible occasion
for taking some steps towards that:

https://lore.kernel.org/git/xmqqed873vgn.fsf@gitster.g/ (local)

As a preparation for this move, it is worth making sure that the diff
algorithm is configurable where useful.

Make it configurable in the `git-blame(1)` command by introducing the
`--diff-algorithm` option and make honor the `diff.algorithm` config
variable. Keep Myers diff as the default.

Signed-off-by: Antonin Delpeuch <redacted>
---
This step does not have anything surprising in it, knowing what the
previous iteration contained.  Looking good.

Other than that many redirections into a file are written with a
space between redirection operator and its target, i.e.

    command > output &&

that should be, according to the coding guidelines, written like

    command >output &&

that is.
+test_expect_success 'blame respects the order of diff options' '
+	cat >expected <<-\EOF &&
+...
+	EOF
+
+	git blame file.txt --minimal --diff-algorithm myers > output &&
+	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output > actual &&
+	test_cmp expected actual
+'
Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help