~sircmpwn/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Check new_lines value to validate patch

Details
Message ID
<20191128054510.564-1-hans@datyedyeguy.net>
DKIM signature
missing
Download raw message
Patch: +1 -1
Looks like lib2git includes the optional/conditional 'No newline at
end of file' line within the lines collection of the hunk, which could
throw off the new line count.  So rather than that, try checking the
new_lines value to make sure that is 1.

One can see how this scenario is causing the test to fail with the
following patches

Fail:
https://lists.sr.ht/~sircmpwn/email-test-drive/patches/9184

Success:
https://lists.sr.ht/~sircmpwn/email-test-drive/patches/9187
---
 email_tutorial/app.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/email_tutorial/app.py b/email_tutorial/app.py
index ace94c7..8d42233 100644
--- a/email_tutorial/app.py
+++ b/email_tutorial/app.py
@@ -71,7 +71,7 @@ def get_reply(diff, mail):
     # Note: there will only ever be one since we asserted that this is an
     # addition:
     hunk = patch.hunks[0]
-    if len(hunk.lines) != 1:
+    if hunk.new_lines != 1:
         return MIMEText(render_template("wrong-content", **{"from": from_[0]}))
     content = hunk.lines[0].content
     if stage_1.match(content) is not None:
-- 
2.16.2.windows.1
Details
Message ID
<BYU6HHEOS73Y.27L2XTZ1EQ2DZ@homura>
In-Reply-To
<20191128054510.564-1-hans@datyedyeguy.net> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/git-send-email.io
   0da79cb..93de7fd  master -> master
 * [new tag]         0.1.9 -> 0.1.9