What does “1 line adds whitespace errors” mean when applying a patch?

后端 未结 5 1358
暖寄归人
暖寄归人 2021-01-30 15:49

I\'m editing some markdown files of a cloned remote repository, and wanted to test creating and applying patches from one branch to another. However, every time I make any chang

5条回答
  •  暖寄归人
    2021-01-30 16:14

    You don't need to care.

    The warning enacts a standard of cleanliness of text files in regard to whitespace, the kind of thing that many programmers tend to care about. As the manual explains:

    What are considered whitespace errors is controlled by core.whitespace configuration. By default, trailing whitespaces (including lines that solely consist of whitespaces) and a space character that is immediately followed by a tab character inside the initial indent of the line are considered whitespace errors.

    By default, the command outputs warning messages but applies the patch.

    So, the "error" means that the change introduces a trailing whitespace, a whitespace-only line, or a space that precedes a tab. Other than that fact, there is nothing erroneous about the change, and it will apply cleanly and correctly. In other words, if you don't care about the "incorrect" whitespace, feel free to ignore the warning or turn it off with git config apply.whitespace nowarn.

提交回复
热议问题