我目前面临以下情况:
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -10130,7 +10160,22 @@ function myGreatFunc(param1, param2
let a = funcA(b, c);
if(funcB(a, d.a.a) >= e) {
- if(d.b === undefined
+ let f = c * parseInt(g.a[b].a);
+ if(h !== null
+ && (h.a.a >= c
+ && h.a.b === b
+ || funcA(h.a.b, h.a.a) >= a
+ )
+ ) f = 0;
+/* if(b === 'a'
+ && c === 1
+ && d.a.name === 'b'
+ && (d.c.a.includes('c')
+ || d.c.a.includes('d')
+ )
+ ) console.log('e', f);*/
+
+/* if(d.b === undefined
|| d.b.a > c * parseInt(g.a[b].a)
|| d.b.a === c * parseInt(g.a[b].a)
&& d.b.b < a
目标是删除所有评论。
这里的问题在于大块的结尾,它只包括块注释的开头,而不是它的结尾。因此,它将最后 3 行保留为上下文,而我也希望将它们删除。
尝试 n°1
保留原始上下文行,因此from-file-range
不需要修改
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -10130,7 +10160,11 @@ function myGreatFunc(param1, param2
let a = funcA(b, c);
if(funcB(a, d.a.a) >= e) {
- if(d.b === undefined
+ let f = c * parseInt(g.a[b].a);
+ if(h !== null
+ && (h.a.a >= c
+ && h.a.b === b
+ || funcA(h.a.b, h.a.a) >= a
+ )
+ ) f = 0;
+
- || d.b.a > c * parseInt(g.a[b].a)
- || d.b.a === c * parseInt(g.a[b].a)
- && d.b.b < a
注意:尝试删除的每个上下文行的前导空格已正确替换(而不是仅仅预先放置),用-
.
尝试 n°2
删除原始上下文行
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -10130,4 +10160,11 @@ function myGreatFunc(param1, param2
let a = funcA(b, c);
if(funcB(a, d.a.a) >= e) {
- if(d.b === undefined
+ let f = c * parseInt(g.a[b].a);
+ if(h !== null
+ && (h.a.a >= c
+ && h.a.b === b
+ || funcA(h.a.b, h.a.a) >= a
+ )
+ ) f = 0;
+
结果
两次尝试都遇到了:
error: patch failed: myFile.html:10130
error: myFile.html: patch does not apply
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]?
笔记
使用git version 2.22.0.windows.1
如何编辑那个大块以达到抢手的效果?