From: Antoine Pelisse <apelisse@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH] diff: add --ignore-blank-lines option
Date: Mon, 17 Jun 2013 23:33:08 +0200 [thread overview]
Message-ID: <CALWbr2x0gxQ8boXEa3WJUbaA8e9imt9Ri_NFmANEhJuK6Moi+A@mail.gmail.com> (raw)
In-Reply-To: <7vd2rkcy6r.fsf@alter.siamese.dyndns.org>
>>>> + } else if (changes != ULONG_MAX &&
>>>> + xch->i1 + changes - (lxch->i1 + lxch->chg1) > max_common) {
>>>> + break;
>>
>> If we are no longer in "interesting zone" (changes != ULONG_MAX), it
>> means we will stop if the distance is too big.
>> "changes" is used in the calculation to consider the changes we have
>> already ignored (xch->i1 - (lxch->i1 + lxch->chg1) will only work if
>> xch and lxch are consecutive, we need to add the blank lines we
>> ignored).
>
> And this uses max_common that is much larger than max_ignorable
> because...?
>
> The last interesting change, with its post context and inter hunk
> gap, together with precontext for this one, is close enough to the
> beginning of this one. So it is understandable if xch by itself is
> intereseting to use max_common. Even an interesting one, if that is
> so far from the last interesting one, should not be part of this
> hunk.
>
> However, if the current one is by itself uninteresting, should we
> still use the max_common, or should this be compared with
> max_ignorable?
Because of the "recursive definition", we don't know yet if an
ignorable change will be interesting or not.
We need to make sure it will be close to another interesting change first.
If it is, it will fall in the first if part, and lxch will catch-up.
If not, we will eventually be too far and break.
Re-reading note: OK, This last sentence ("If not we will eventually be
too far and break") is actually a bug. We might break before we find
something interesting while we should keep going. For example in such
a case, we should display like this, but won't:
@@ -x,x +x,x @@
+change <--- That is lxch
1
2
3
+ <--- Here we leave "interesting"
4
5
+ <--- We are too far and quit searching
6
7
+
8
9
+
10
11
+change
>>>> + } else {
>>>> + if (changes == ULONG_MAX)
>>>> + changes = 0;
>>>> + changes += xch->chg2;
>>>
>>> Puzzled beyond guessing. Also it is curious why here and only here
>>> we look at chg2 side of the things, not i1/chg1 in this whole thing.
>>
>> chg2 being the number of blank line *additions*.
>
> This is on the else side of if (!xch->ignore), so we are looking at
> ignored hunk, which means there is only blank line change. Can chg2
> be 0 while chg1 is not zero, i.e. xch being a blank line removal?
Exactly. It can be a blank line removal. But I don't want to consider
it in the calculation.
Here's why:
We have:
1
2
3
4
5
6
and change it to:
change
1
2
3
4
5
6
change
What should be the output of diff --ignore-blank-lines ?
I chose this alternative:
@@ -1,3 +1,4 @@
+change
1
2
3
@@ -7,3 +5,4 @@
4
5
6
+change
While one could have chosen:
@@ -1,10 +1,8 @@
+change
1
2
3
-
-
-
-
4
5
6
+change
> What should happen in that case? Don't we want to show it, for the
> same reason we want to keep removal, as long as it is close enough
> to the interesting zone?
Nothing is interesting here, we just leave the interesting zone (if
not already left) because everything else failed.
next prev parent reply other threads:[~2013-06-17 21:33 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALWbr2x0gxQ8boXEa3WJUbaA8e9imt9Ri_NFmANEhJuK6Moi+A@mail.gmail.com \
--to=apelisse@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 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).