使用format-patch生成patch,在am打patch的时候,告警:
1 2 3 4 5 6 7 8 9 10 11 12 13 | git am /work/Xrouter/kernel/patches-4.14.120/0001-add-openwrt-patches.patch /home/yuan/staging/git/linux-4.14.120/rebase-apply/patch:800: trailing whitespace. ------- /home/yuan/staging/git/linux-4.14.120/rebase-apply/patch:809: trailing whitespace. /home/yuan/staging/git/linux-4.14.120/rebase-apply/patch:813: trailing whitespace. /home/yuan/staging/git/linux-4.14.120/rebase-apply/patch:820: trailing whitespace. /home/yuan/staging/git/linux-4.14.120/rebase-apply/patch:821: trailing whitespace. # swconfig dev ethX vlan 4 set ports '0 1t 2 5t' warning: squelched 68 whitespace errors warning: 73 lines add whitespace errors. |
原因是文件没有以空白行结尾。
解决办法:
可以在打patch的时候,自动补上行尾空白行,然后重新生成patch。
$ git am --reject --whitespace=fix <patch path>
$ git format-patch -1
参考
https://blog.csdn.net/haoyujie/article/details/100014149