什么是“1行添加空白错误”是指在应用补丁时? [英] What does "1 line adds whitespace errors" mean when applying a patch?

查看:130
本文介绍了什么是“1行添加空白错误”是指在应用补丁时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编辑克隆远程存储库的一些降价文件,并且想要测试从一个分支到另一个分支的创建和应用修补程序。但是,每次我进行任何更改时,都会在 git apply 中收到以下消息:

  0001-b.patch:16:尾随空格。 
警告:1行添加空格错误。

(这是在我的Mac上发生的,我不知道原始代码的创建位置。 )



警告信息的含义是什么,我需要注意吗?

解决方案 div>

你不需要关心。

这个警告提供了一个关于空格的纯文本文件的标准,许多程序员倾向于关心。正如手册所解释的那样:


通过core.whitespace配置可以认为空白错误是由
控制的。默认情况下,在行的
初始缩进中,尾随空白符
(包括仅由空白符组成的行)和空格符
字符被视为空白符号错误。



默认情况下,该命令会输出警告消息,但会应用该补丁。

因此,错误意味着更改引入了尾随空格,仅空白行或空格,该空格位于选项卡之前。除此之外,没有什么错误的变化,它会适用干净和正确。换句话说,如果你不关心不正确的空格,可以忽略这个警告或者用 git config apply.whitespace nowarn 来关闭它。


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 change at all, I get the following message during git apply:

0001-b.patch:16: trailing whitespace.
warning: 1 line adds whitespace errors.

(This is happening on my Mac, and I don't know where the original code was created.)

What does the warning message mean, and do I need to care?

解决方案

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.

这篇关于什么是“1行添加空白错误”是指在应用补丁时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆