git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tay Ray Chuan <rctay89@gmail.com>
To: Michal Privoznik <mprivozn@redhat.com>
Cc: git@vger.kernel.org, gitster@pobox.com, trast@student.ethz.ch,
	peff@peff.net, Lawrence.Holding@cubic.com
Subject: Re: [PATCH] diff: Introduce diff.algorithm variable
Date: Tue, 13 Mar 2012 22:42:50 +0800	[thread overview]
Message-ID: <CALUzUxpR_bPLvnHRJrQ2wVpqJD6Ccg6r3RMa_sCDKHTapnJsdw@mail.gmail.com> (raw)
In-Reply-To: <06652d553040ad6b25608dc69d632f1ee38eaeca.1331300343.git.mprivozn@redhat.com>

On Fri, Mar 9, 2012 at 9:48 PM, Michal Privoznik <mprivozn@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@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
> @@ -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

  parent reply	other threads:[~2012-03-13 14:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 13:48 [PATCH] diff: Introduce diff.algorithm variable Michal Privoznik
2012-03-09 18:40 ` Junio C Hamano
2012-03-12  5:42   ` Junio C Hamano
2012-03-13 14:42 ` Tay Ray Chuan [this message]
2012-03-13 17:46   ` Junio C Hamano
2012-03-13 20:48     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALUzUxpR_bPLvnHRJrQ2wVpqJD6Ccg6r3RMa_sCDKHTapnJsdw@mail.gmail.com \
    --to=rctay89@gmail.com \
    --cc=Lawrence.Holding@cubic.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mprivozn@redhat.com \
    --cc=peff@peff.net \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).