git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCHv3] git apply: option to ignore whitespace differences
Date: Wed, 29 Jul 2009 08:33:18 +0200	[thread overview]
Message-ID: <cb7bb73a0907282333g26efd1d8y7d913fba8a426aa5@mail.gmail.com> (raw)
In-Reply-To: <7vljm84htf.fsf@alter.siamese.dyndns.org>

On Tue, Jul 28, 2009 at 11:29 PM, Junio C Hamano<gitster@pobox.com> wrote:
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>
>> @@ -205,6 +209,9 @@ running `git apply --directory=modules/git-gui`.
>>  Configuration
>>  -------------
>>
>> +apply.ignore-whitespace::
>> +     Set this boolean configuration flag if you want to ignore whitespace
>> +     differences to be ignored by default.
>
> That's a strange sentence.
>
>        When set to true, changes in amount of whitespace are ignored.

Indeed, my sentene was horrible.

> I am not happy with the name --ignore-whitespace.
>
> Perhaps --ignore-space-change, to be consistent with a "git diff" option,
> would be more appropriate.  Doing so has an added benefit of leaving the
> door open to add --ignore-all-space option to the patch application side
> later.

On the other hand, --ignore-whitespace matches the option name (and
behavior) of the 'patch' command (just like "git diff"'s matches the
'diff' option name and behavior). Principle of least surprise says
that someone coming to git from raw diff/patch setups would expect
--ignore-whitespace on the patch side.

A possible future expansion to allow ignoring all whitespace
completely would be to allow --ignore-whitespace=all

> If I am reading the patch correctly, use of this option always disables
> checks and corrections of whitespace errors.

Not exactly. Whitespace correction is not attempted to try matching
context lines, but the whitespace correction on the new lines is still
applied.

> I personally feel that
> somebody who is willing to accept a patch that has whitespace breakages
> that needs this option would not care

Indeed, my first patch fell through to the whitespace correction, I
changed it per your suggestion.

> but the documentation should warn
> about it at the minimum.

The code comments does mention that context line whitespace correction
that will be skipped. I'll add a note about it in the man page.

> Needless to say, a lot better option is not to disable the checks and
> corrections at all.  After all, this "ignore space change" option is about
> matching the common context lines and replaced/removed contents before the
> change, and checks and corrections are about added/replaced contents after
> the change.  They should be orthogonal.

They are, for new lines.

Actually, one thing that I've been thinking about doing is to adjust
the new lines to match the kind of whitespace change the context line
underwent. Example: if all the context lines had the change 4 spaces
-> tab, it would be nice to have the new lines undergo the same
change. However, this is going to be rather hard to implement.

-- 
Giuseppe "Oblomov" Bilotta

  reply	other threads:[~2009-07-29  6:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-28 21:00 [PATCHv3] git apply: option to ignore whitespace differences Giuseppe Bilotta
2009-07-28 21:29 ` Junio C Hamano
2009-07-29  6:33   ` Giuseppe Bilotta [this message]
2009-07-29  7:09     ` Junio C Hamano
2009-07-29  8:20       ` Giuseppe Bilotta
2009-07-29  8:39         ` Junio C Hamano
2009-07-29  9:05           ` Giuseppe Bilotta
2009-07-29  8:40     ` Nanako Shiraishi
2009-07-29  9:09       ` Giuseppe Bilotta
2009-07-31  0:27       ` Felipe Contreras
2009-07-31  0:48         ` Junio C Hamano
2009-07-31 15:38           ` Felipe Contreras
2009-07-31 16:16             ` Giuseppe Bilotta
2009-07-31 17:17               ` Junio C Hamano
2009-07-31 19:22                 ` Giuseppe Bilotta

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=cb7bb73a0907282333g26efd1d8y7d913fba8a426aa5@mail.gmail.com \
    --to=giuseppe.bilotta@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).