Michal Privoznik | 9 Mar 14:48 2012
Picon

[PATCH] diff: Introduce diff.algorithm variable

Some users have preference over various diff algorithms. However,
now they are forced to use appropriate argument every time they
run git-diff and tools using it. This is impractical. Therefore
create new variable which can set preferred algorithm. Of course,
this can be overridden on command line via --diff-algorithm=*.
Accepted values are myers (default), histogram, minimal, patience.

Signed-off-by: Michal Privoznik <mprivozn <at> redhat.com>
---
This is basically v2 for:

   http://www.spinics.net/lists/git/msg176100.html

As we agreed on list, I've switched from diff.patience to
diff.algorithm and created new argument --diff-algorithm.

Please keep me CC'ed as I am not signed into the list.

 Documentation/diff-config.txt          |   21 +++++++++++++++++++
 Documentation/diff-options.txt         |   23 +++++++++++++++++++++
 contrib/completion/git-completion.bash |   13 +++++++++++
 diff.c                                 |   35 ++++++++++++++++++++++++++++++++
 4 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
index 6aa1be0..1047e81 100644
--- a/Documentation/diff-config.txt
+++ b/Documentation/diff-config.txt
 <at>  <at>  -1,3 +1,24  <at>  <at> 
+diff.algorithm::
(Continue reading)

Junio C Hamano | 9 Mar 19:40 2012
Picon
Picon

Re: [PATCH] diff: Introduce diff.algorithm variable

Michal Privoznik <mprivozn <at> redhat.com> writes:

> Some users have preference over various diff algorithms. However,
> now they are forced to use appropriate argument every time they
> run git-diff and tools using it. This is impractical. Therefore
> create new variable which can set preferred algorithm. Of course,

We tend to prefer avoiding these subjective and judgemental words
like "forced" and "impractical" when the paragraph conveys the same
reasoning even when they are toned down.

> diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
> index 6aa1be0..1047e81 100644
> --- a/Documentation/diff-config.txt
> +++ b/Documentation/diff-config.txt
>  <at>  <at>  -1,3 +1,24  <at>  <at> 
> +diff.algorithm::
> +    Choose a diff algorithm.  The variants are as follows:

In order to avoid confusing users, we may want to mention that it is
deliberate that this configuration does not apply to plumbing
commands.

It may make sense to drop the enumeration of "The variants are...",
and say that it can take the values valid for the "--diff-algorithm"
parameter to the "diff" family of commands.  We do not have to worry
about keeping two enumerations in sync if we did so.

> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
> index 7d4566f..4e8bc5b 100644
(Continue reading)

Junio C Hamano | 12 Mar 06:42 2012
Picon
Picon

Re: [PATCH] diff: Introduce diff.algorithm variable

Junio C Hamano <gitster <at> pobox.com> writes:

> The last two hunks gives me a queasy feeling for some reason.  I
> think I recently saw a patch to clean up this area to clarify that
> PATIENCE/HISTOGRAM are not independent option bits (but I cannot
> remember where) and we probably should use the approach taken by
> that patch.

I did some digging; no wonder I remember it---it is one of the stuff
I wrote and then later discarded.

  http://thread.gmane.org/gmane.comp.version-control.git/191036/focus=191038

I think this "algorithm" thing should build on that patch, even
though the later parts of the series in that thread has turned out
to be unwanted.

Thanks.
Tay Ray Chuan | 13 Mar 15:42 2012
Picon

Re: [PATCH] diff: Introduce diff.algorithm variable

On Fri, Mar 9, 2012 at 9:48 PM, Michal Privoznik <mprivozn <at> redhat.com> wrote:
> Some users have preference over various diff algorithms. However,
> now they are forced to use appropriate argument every time they
> run git-diff and tools using it. This is impractical. Therefore
> create new variable which can set preferred algorithm. Of course,
> this can be overridden on command line via --diff-algorithm=*.
> Accepted values are myers (default), histogram, minimal, patience.
>
> Signed-off-by: Michal Privoznik <mprivozn <at> redhat.com>
> ---
> This is basically v2 for:
>
>   http://www.spinics.net/lists/git/msg176100.html
>
> As we agreed on list, I've switched from diff.patience to
> diff.algorithm and created new argument --diff-algorithm.
>
> Please keep me CC'ed as I am not signed into the list.
>
>  Documentation/diff-config.txt          |   21 +++++++++++++++++++
>  Documentation/diff-options.txt         |   23 +++++++++++++++++++++
>  contrib/completion/git-completion.bash |   13 +++++++++++
>  diff.c                                 |   35 ++++++++++++++++++++++++++++++++
>  4 files changed, 92 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
> index 6aa1be0..1047e81 100644
> --- a/Documentation/diff-config.txt
> +++ b/Documentation/diff-config.txt
>  <at>  <at>  -1,3 +1,24  <at>  <at> 
(Continue reading)

Junio C Hamano | 13 Mar 18:46 2012
Picon
Picon

Re: [PATCH] diff: Introduce diff.algorithm variable

Tay Ray Chuan <rctay89 <at> gmail.com> writes:

> Considering that --minimal isn't really an algorithm,...

I think this discussion thread already settled that "minimal" *is* an
algorithm for the purpose of this topic, considering that the --minimal
option does not apply anything but myers.
Jeff King | 13 Mar 21:48 2012
Picon

Re: [PATCH] diff: Introduce diff.algorithm variable

On Tue, Mar 13, 2012 at 10:46:46AM -0700, Junio C Hamano wrote:

> Tay Ray Chuan <rctay89 <at> gmail.com> writes:
> 
> > Considering that --minimal isn't really an algorithm,...
> 
> I think this discussion thread already settled that "minimal" *is* an
> algorithm for the purpose of this topic, considering that the --minimal
> option does not apply anything but myers.

I don't know that it is settled. I proposed it as a concept, and nobody
else objected. It is true that right _now_ --minimal doesn't do anything
for non-myers algorithms, but in theory it could. IOW, it is a matter of
the user's perspective whether the flag is "use the minimal Myers diff
algorithm" versus "spend extra effort to make the diff more minimal, no
matter which algorithm is being used". If the latter, it is only that we
have not (yet) implemented the extra effort tweaks to the other
algorithms.

So I think we could go either way.

-Peff

Gmane