在我维护的一段代码中,有时会收到贡献者未经明显原因而重新排列了段落的拉取请求。以下是一个示例:
diff --git a/knuth.tex b/knuth.tex
index 2f6a2f8..7b0827d 100644
--- a/knuth.tex
+++ b/knuth.tex
@@ -1,6 +1,6 @@
Thus, I came to the conclusion that the designer of a new
system must not only be the implementer and first
-large||scale user; the designer should also write the first
+large-scale user; the designer should also write the first
user manual.
The separation of any of these four components would have
@@ -9,8 +9,7 @@ all these activities, literally hundreds of improvements
would never have been made, because I would never have
thought of them or perceived why they were important.
-But a system cannot be successful if it is too strongly
-influenced by a single person. Once the initial design is
-complete and fairly robust, the real test begins as people
-with many different viewpoints undertake their own
-experiments.
+But a system cannot be successful if it is too strongly influenced by
+a single person. Once the initial design is complete and fairly
+robust, the real test begins as people with many different viewpoints
+undertake their own experiments.
如您所见,第一个hunk通过将||
替换为-
引入了实际更改,而第二个hunk只是更改了换行和空格。事实上,第二个hunk的word-diff
为空。
是否可以制定一项政策(例如在GitHub或我的CI中)以拒绝包含此类“空”hunk的提交,或重新格式化补丁以完全省略这些hunk,以便我可以使用git apply
而不包含它们?
--word-diff
的问题在于它生成的补丁与git apply
不兼容。 - Henri Menke