git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Pelisse <apelisse@gmail.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH] diff: add --ignore-blank-lines option
Date: Mon, 27 May 2013 09:14:15 +0200	[thread overview]
Message-ID: <CALWbr2xzSC8ZGggCUYbS7ZWEOHnZnxFJWOfHCOBkVZFQS9KcEw@mail.gmail.com> (raw)
In-Reply-To: <51A2722A.8040200@kdbg.org>

On Sun, May 26, 2013 at 10:35 PM, Johannes Sixt <j6t@kdbg.org> wrote:
> Am 26.05.2013 19:58, schrieb Antoine Pelisse:
>> The goal of the patch is to introduce the GNU diff
>> -B/--ignore-blank-lines as closely as possible. The short option is not
>> available because it's already used for "break-rewrites".
>>
>> When this option is used, git-diff will not create hunks that simply
>> adds or removes empty lines, but will still show empty lines
>> addition/suppression if they are close enough to "valuable" changes.
>
> So when an addition or removal of a blank line appears in a hunk that
> also has non-blank-line changes, the addition or removal is not treated
> specially?

Exactly.

> How is a blank line defined? What happens if a line that has only
> whitespace is added or removed?

xdl_blankline() is the best description of what I considered a blank line.
If no --ignore-space-* option is given, it's a line that starts and
ends with '\n'.
If any --ignore-space-* option is given, it's a line that has any
number of isspace(3)-defined characters, followed by '\n'.

> I'm thinking of diffs of files with CRLF

Good you did, because I didn't ;-)

> line breaks, where the CR would count as whitespace in the line, I think.

With the current implementation, an empty line with CRLF will not show
as a blank line if no space option is given. As CR is a space
according to isspace(3), the line will be removed with any space
option.

>> +--ignore-blank-lines::
>> +     Ignore changes whose lines are all blank.
>
> I think this is too terse and does not convey what the option really does.

That's the description from GNU diff man page. But indeed it could be
more precise.

>> +test_expect_success 'ignore-blank-lines: only new lines' '
>> +     seq 5 >x &&
>
> Please use test_seq instead of seq in all new tests.

Will fix.

> -- Hannes
>

  reply	other threads:[~2013-05-27  7:14 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 [this message]
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
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=CALWbr2xzSC8ZGggCUYbS7ZWEOHnZnxFJWOfHCOBkVZFQS9KcEw@mail.gmail.com \
    --to=apelisse@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.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.
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).