On 25.10.23 13:52, jm...@redhat.com wrote:
> From: Jakob Meng <c...@jakobmeng.de>
>
> A patch created with 'git format-patch' can contain trailing spaces.
> When editing a patch, e.g. to fix a typo in the title, the trailing
> spaces should not be removed. This becomes tricky when editors like
> Kate identify a space followed by form feed as a trailing space and
> remove both. This will result in a broken patch which cannot be applied
> cleanly. Although this case should likely be considered a editor bug,
> keeping trailing spaces in a patch is the right thing to do and also
> helps mitigating these kinds of editor bugs.

Whether this is a editor bug or not is debatable. For example, Kate uses 
QChar's isSpace() [0] to identify a "trailing space" [1] which considers a form 
feed character (0x0c) a space.

In future Kate releases this issue will surface less often because Kate's 
interpretation of 'trim_trailing_whitespaces' from .editorconfig has been 
changed [3].

[0] https://doc.qt.io/qt-5/qchar.html#isSpace
[1] 
https://github.com/KDE/ktexteditor/blob/10210ec1dd06afa1e7b19a4fff722a8a23719161/src/document/katedocument.cpp#L5643
[2] 
https://github.com/qt/qtbase/blob/5628600a07295db6ed6683e97fafb0c45ddea505/src/corelib/text/qchar.h#L554
[3] 
https://github.com/KDE/ktexteditor/commit/94b328fc64e543d91930845d2a96ce08d3043295

> Fixes: 07f6d6a0cb51 ("Add editorconfig file.")
>
> Signed-off-by: Jakob Meng <c...@jakobmeng.de>
> ---
>  .editorconfig | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/.editorconfig b/.editorconfig
> index 685c72750..5be5415da 100644
> --- a/.editorconfig
> +++ b/.editorconfig
> @@ -13,6 +13,10 @@ indent_style = space
>  indent_size = 4
>  max_line_length = 79
>  
> +[*.{patch,diff}]
> +insert_final_newline = false
> +trim_trailing_whitespace = false
> +
>  [include/linux/**.h]
>  indent_style = tab
>  indent_size = tab


_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to