Re: [PATCHv3] git apply: option to ignore whitespace differences
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 28, 2009, 21:29 UTC
- Message-ID
- <7vljm84htf.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1248814820-25367-1-git-send-email-giuseppe.bilotta@gmail.com>
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
Show 7 quoted lines
> @@ -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.
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.
> + /* > + * Skip whitespace inside. We check for whitespace on > + * both buffers because we don't want "a b" to match > + * "ab"
* but that is only true when --ignore-space-change
* is in effect.
*
* If you want to match "if(a > b)" with "if (a > b)",
* please add --ignore-all-space option and use it.;-)
If I am reading the patch correctly, use of this option always disables checks and corrections of whitespace errors. I personally feel that somebody who is willing to accept a patch that has whitespace breakages that needs this option would not care, but the documentation should warn about it at the minimum.
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.