git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Antoine Pelisse <apelisse@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH] diff: add --ignore-blank-lines option
Date: Tue, 04 Jun 2013 13:46:44 -0700	[thread overview]
Message-ID: <7v61xt7gej.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CALWbr2zJCxbW8Qug0i=oGvKZV5-vcAugextxMuQp9jaoaZYpyg@mail.gmail.com> (Antoine Pelisse's message of "Tue, 4 Jun 2013 21:08:03 +0200")

Antoine Pelisse <apelisse@gmail.com> writes:

> On Tue, Jun 4, 2013 at 8:26 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Antoine Pelisse <apelisse@gmail.com> writes:
>>
>>> +xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg) {
>>>       xdchange_t *xch, *xchp;
>>>       long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen;
>>> +     long ignorable_context = max_common / 2 - 1;
>>
>> Could you explain how this math works?
>
> I think it doesn't, mostly because I misinterpreted the "interhunkctxlen".
> I will try to think about that and provide a reroll.

OK.  Thanks.

I think the logic would be more like:

 1. Start from xscr, find the first xchp that is !xchp->ignore;
    if there is none, we are done. There is no more to show.

 2. Remember the xchp as the beginning.

 3. Tangle ->next pointer to find the next xch that is !xch->ignore;
    if there is none, we are also done.  xdchanges between the
    beginning you remembered in the step 2. and your current xchp
    are the only things we want to show.

 4. Measure the distance between the end of xchp and the beginning
    of xch.

    - If it is larger than max_common, xdchanges between the
      beginning you remembered in the step 2. and your current xchp
      are the only things we want to show.  The next iteration will
      start by skipping the blank-only changes between xchp and xch.

    - If it is short enough, assign xchp = xch and go back to 3. to
      find more interesting hunks (that is why we remembered the
      real "beginning" in step 2.).

  reply	other threads:[~2013-06-04 20:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-26 17:58 [PATCH] diff: add --ignore-blank-lines option Antoine Pelisse
2013-05-26 20:35 ` Johannes Sixt
2013-05-27  7:14   ` Antoine Pelisse
2013-06-01  8:48     ` Antoine Pelisse
2013-06-04 18:26 ` Junio C Hamano
2013-06-04 19:08   ` Antoine Pelisse
2013-06-04 20:46     ` Junio C Hamano [this message]
2013-06-04 20:51       ` Antoine Pelisse
2013-06-08 20:44       ` Antoine Pelisse
2013-06-09  7:33         ` Eric Sunshine
2013-06-09 20:07         ` Junio C Hamano
2013-06-09 20:32           ` Antoine Pelisse
2013-06-09 21:28             ` Junio C Hamano
2013-06-10 21:03           ` Antoine Pelisse
2013-06-10 21:43             ` Junio C Hamano
2013-06-12 13:21               ` Antoine Pelisse
2013-06-12 17:22                 ` Junio C Hamano
2013-06-15 13:01                   ` Antoine Pelisse
2013-06-17 16:18                     ` Junio C Hamano
2013-06-17 17:58                       ` Antoine Pelisse
2013-06-17 19:09                       ` Antoine Pelisse
2013-06-17 19:52                         ` Junio C Hamano
2013-06-17 21:33                           ` Antoine Pelisse
2013-06-17 23:27                             ` Junio C Hamano
2013-06-19 18:46                               ` Antoine Pelisse
2013-06-19 22:23                                 ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7v61xt7gej.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=apelisse@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).