All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Norbert Kiesel <nkiesel@gmail.com>,
	Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH] diff: prefer indent heuristic over compaction heuristic
Date: Fri, 16 Dec 2016 17:30:57 -0800	[thread overview]
Message-ID: <xmqq7f6zqr3i.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161217005442.5866-1-jacob.e.keller@intel.com> (Jacob Keller's message of "Fri, 16 Dec 2016 16:54:42 -0800")

Jacob Keller <jacob.e.keller@intel.com> writes:

> From: Jacob Keller <jacob.keller@gmail.com>
>
> The current configuration code for enabling experimental heuristics
> prefers the last-set heuristic in the configuration. However, it is not
> necessarily easy to see what order the configuration will be read. This
> means that it is possible for a user to have accidentally enabled both
> heuristics, and end up only enabling the older compaction heuristic.
>
> Modify the code so that we do not clear the other heuristic when we set
> each heuristic enabled. Then, during diff_setup() when we check the
> configuration, we will first check the newer indent heuristic. This
> ensures that we only enable the newer heuristic if both have been
> enabled.
>
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
>  diff.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

Although I do not think we should spend too much braincycles on this
one (we should rather just removing the older one soonish), I think
this patch is going in a wrong direction.  I agree that "the last
one wins" is a bit hard to see (until you check with "git config -l"
perhaps) but it at least is predictable.  With this patch, you need
to KNOW that indent wins over compaction, perhaps by knowing the
order they were developed, which demands a lot more from the users.

We probably should just keep one and remove the other.

> diff --git a/diff.c b/diff.c
> index ec8728362dae..48a5b2797e3d 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -223,16 +223,10 @@ void init_diff_ui_defaults(void)
>  
>  int git_diff_heuristic_config(const char *var, const char *value, void *cb)
>  {
> +	if (!strcmp(var, "diff.indentheuristic"))
>  		diff_indent_heuristic = git_config_bool(var, value);
> +	if (!strcmp(var, "diff.compactionheuristic"))
>  		diff_compaction_heuristic = git_config_bool(var, value);
>  	return 0;
>  }

  reply	other threads:[~2016-12-17  1:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-17  0:54 [PATCH] diff: prefer indent heuristic over compaction heuristic Jacob Keller
2016-12-17  1:30 ` Junio C Hamano [this message]
2016-12-17  8:02   ` Jacob Keller
2016-12-22 21:12     ` Junio C Hamano
2016-12-22 21:41       ` Jacob Keller
2016-12-22 22:43         ` Junio C Hamano
2016-12-23  7:22       ` Jeff King
2016-12-23  8:12         ` Jacob Keller
2016-12-23 16:19           ` Jeff King
2016-12-23 17:45             ` Junio C Hamano
2016-12-23 21:17               ` Junio C Hamano
2016-12-23 22:21                 ` Jeff King
2016-12-23 22:23                   ` Jacob Keller
2016-12-24 12:55                 ` Michael Haggerty
2017-04-27 21:17                   ` Stefan Beller
2017-04-28  8:11                     ` Jeff King
2017-04-28  8:40                     ` Martin Liška

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=xmqq7f6zqr3i.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.com \
    --cc=nkiesel@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.