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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 9, 2012 at 9:48 PM, Michal Privoznik <mprivozn@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
> 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
> @@ -1,3 +1,24 @@
> +diff.algorithm::
> +    Choose a diff algorithm.  The variants are as follows:
> ++
> +--
> +histogram::
> +    This is the fastest algorithm.
> +
> +myers::
> +    The classical Myers diff algorithm. This is the default.
> +
> +minimal::
> +    Like 'myers', but spend extra time making sure that the diff
> +    is the shortest possible for the set of changes performed.
> +
> +patience::
> +    The patience diff algorithm, which first matches unique lines
> +    with each other.  This sometimes results in more readable (if
> +    longer) patches than the other algorithms.
> +--
> ++
> +

Considering that --minimal isn't really an algorithm, could this be
instead made to a "default options to always pass to diff" config? I
imagine this would make the codepath involved in this patch much
simpler (just reuse the argc/argv opt parsing machinery).

Additionally, it would be useful for users who want to, say, set the
context to 5 lines always.

-- 
Cheers,
Ray Chuan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]